/* acpl-tracking.css - Fixed transparent background and equal height containers */

/* Enhanced ACPL Cargo Tracking Plugin Styles - Fixed */
:root {
    --primary-color: #215387;
    --secondary-color: #1a4570;
    --accent-color: #ff6b6b;
    --success-color: #2ecc71;
    --error-color: #e74c3c;
    --text-primary: #2c3e50;
    --text-secondary: #34495e;
    --background-light: rgba(255, 255, 255, 0.95);
    --background-transparent: rgba(255, 255, 255, 0.1); /* UPDATED: More transparent background */
    --shadow-light: 0 4px 15px rgba(0, 0, 0, 0.08);
    --shadow-medium: 0 8px 25px rgba(0, 0, 0, 0.15);
    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* UPDATED: Transparent Container */
#acpl-tracking-container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 30px;
    background: transparent; /* CHANGED: Made completely transparent */
    backdrop-filter: none; /* REMOVED: No backdrop filter for full transparency */
    border-radius: var(--border-radius);
    box-shadow: none; /* REMOVED: No shadow for transparent look */
    color: var(--text-primary);
    position: relative;
    overflow: visible;
    display: flex;
    flex-direction: column;
    min-height: 200px;
}

#acpl-tracking-container > * {
    position: relative;
    z-index: 1;
}

/* Title - Only shown when explicitly provided in shortcode */
.acpl-tracking-title {
    text-align: center;
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.acpl-tracking-title span {
    font-size: 2.2em;
    font-weight: 700;
    color: white !important; /* FIXED: Made text white with !important */
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7); /* UPDATED: Stronger shadow for better visibility */
    letter-spacing: 1px;
}

/* Form */
#acpl-tracking-form {
    background: var(--background-light);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    padding: 25px;
    margin-bottom: 25px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: var(--shadow-light);
}

.acpl-form-group {
    margin-bottom: 20px;
}

.acpl-form-group.focused {
    transform: translateY(-2px);
}

.acpl-form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-weight: 600;
    font-size: 1.05em;
    color: var(--text-primary);
}

.acpl-form-group input[type="text"] {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid rgba(102, 126, 234, 0.2);
    border-radius: 50px;
    font-size: 16px;
    background: white;
    color: var(--text-primary);
    transition: var(--transition);
    box-sizing: border-box;
}

.acpl-form-group input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
    transform: translateY(-2px);
}

/* Button */
#track-btn {
    background: linear-gradient(135deg, var(--accent-color), #ee5a24);
    color: white;
    padding: 14px 40px;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.35);
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 0 auto;
    min-width: 160px;
    position: relative;
    overflow: hidden;
}

#track-btn:hover:not(.loading) {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.5);
}

#track-btn.loading {
    cursor: not-allowed;
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
}

.acpl-btn-loader {
    display: flex;
    align-items: center;
    justify-content: center;
}

.acpl-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

/* Enhanced Loading Animation */
#acpl-loading {
    text-align: center;
    padding: 60px 20px;
    background: var(--background-light);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    border: 1px solid rgba(255, 255, 255, 0.2);
    margin-bottom: 20px;
    color: var(--text-primary);
}

.acpl-loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.acpl-loading-spinner {
    position: relative;
    width: 60px;
    height: 60px;
}

.acpl-spinner-ring {
    position: absolute;
    border: 3px solid transparent;
    border-radius: 50%;
    animation: rotate 2s linear infinite;
}

.acpl-spinner-ring:nth-child(1) {
    width: 60px;
    height: 60px;
    border-top-color: var(--primary-color);
    animation-delay: 0s;
}

.acpl-spinner-ring:nth-child(2) {
    width: 45px;
    height: 45px;
    top: 7.5px;
    left: 7.5px;
    border-top-color: var(--accent-color);
    animation-delay: 0.3s;
    animation-direction: reverse;
}

.acpl-spinner-ring:nth-child(3) {
    width: 30px;
    height: 30px;
    top: 15px;
    left: 15px;
    border-top-color: var(--success-color);
    animation-delay: 0.6s;
}

/* Results */
.acpl-tracking-results {
    background: var(--background-light);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    padding: 25px;
    margin-top: 25px;
    box-shadow: var(--shadow-medium);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: var(--text-primary);
    animation: slideInUp 0.6s ease-out;
}

.acpl-results-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--primary-color);
    position: relative;
}

.acpl-results-header::after {
    content: "";
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 2px;
    background: var(--accent-color);
    border-radius: 2px;
}

.acpl-results-title {
    font-size: 1.8em;
    font-weight: 700;
    color: var(--text-primary);
}

/* FIXED: Equal Height Grid Layout for Side-by-Side Tables */
.acpl-table-containers-wrapper {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    width: 100%;
    position: relative;
    z-index: 1;
    align-items: start; /* CHANGED: Align items to start instead of stretch */
}

/* Desktop specific adjustments */
@media (min-width: 768px) {
    .acpl-table-containers-wrapper {
        grid-template-columns: repeat(2, 1fr);
        align-items: stretch; /* ADDED: Make containers equal height on desktop */
    }
    
    /* Special handling for horizontal tables (first table) */
    .acpl-horizontal-table-container {
        grid-column: 1 / -1;
    }
}

/* FIXED: Equal height table containers */
.acpl-table-container {
    border-radius: var(--border-radius);
    overflow: visible;
    box-shadow: var(--shadow-light);
    background: white;
    display: flex;
    flex-direction: column;
    min-height: 200px;
    height: 100%; /* ADDED: Make containers fill available height */
    max-height: none;
}

.acpl-table-title {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 15px 20px;
    font-weight: 600;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 50px;
    font-size: 0.95em;
    flex-shrink: 0; /* ADDED: Prevent title from shrinking */
}

/* FIXED: Better content distribution */
.acpl-responsive-table-wrapper {
    padding: 0;
    flex: 1; /* CHANGED: Take remaining space */
    overflow-y: visible;
    max-height: none;
    display: flex; /* ADDED: Flex container */
    flex-direction: column; /* ADDED: Column direction */
}

.acpl-info-card {
    background: white;
    margin-bottom: 0;
    border-radius: 0;
    overflow: hidden;
    box-shadow: none;
    border: none;
    border-bottom: 1px solid rgba(52, 152, 219, 0.1);
    transition: var(--transition);
    flex: 1; /* ADDED: Make cards expand to fill space */
    display: flex; /* ADDED: Flex container */
    flex-direction: column; /* ADDED: Column direction */
}

.acpl-info-card:hover {
    background-color: rgba(52, 152, 219, 0.02);
    transform: none;
}

.acpl-info-card:last-child {
    border-bottom: none;
    flex-grow: 1; /* ADDED: Last card grows to fill remaining space */
}

.acpl-info-field {
    display: flex;
    padding: 12px 18px;
    border-bottom: 1px solid rgba(52, 152, 219, 0.05);
    align-items: flex-start;
    min-height: 42px;
}

.acpl-info-field:last-child {
    border-bottom: none;
}

.acpl-info-field:nth-child(even) {
    background-color: rgba(52, 152, 219, 0.02);
}

.acpl-field-label {
    font-weight: 600;
    color: var(--text-primary);
    min-width: 120px;
    max-width: 140px;
    flex-shrink: 0;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    line-height: 1.4;
    padding-top: 2px;
}

.acpl-field-value {
    color: var(--text-secondary);
    flex: 1;
    word-break: break-word;
    padding-left: 15px;
    font-size: 0.92em;
    line-height: 1.4;
    font-weight: 500;
    overflow-wrap: break-word;
    max-height: none;
    overflow-y: visible;
}

/* UPDATED: Button-like status styling for first table first row */
.acpl-horizontal-table-container table.responsive tbody tr:first-child td.status-cell-delivered {
    position: relative;
    padding: 8px 12px !important;
    color: transparent !important;
    background-color: transparent !important;
}

.acpl-horizontal-table-container table.responsive tbody tr:first-child td.status-cell-delivered::after {
    content: attr(data-status-text);
    display: inline-block;
    color: white !important;
    font-weight: bold;
    background-color: #2ecc71 !important;
    border-radius: 20px; /* More rounded for button look */
    padding: 6px 16px;
    font-size: 0.85em;
    text-align: center;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(46, 204, 113, 0.3);
    border: 2px solid #27ae60;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
}

.acpl-horizontal-table-container table.responsive tbody tr:first-child td.status-cell-delivered:hover::after {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(46, 204, 113, 0.4);
}

.acpl-horizontal-table-container table.responsive tbody tr:first-child td.status-cell-pending {
    position: relative;
    padding: 8px 12px !important;
    color: transparent !important;
    background-color: transparent !important;
}

.acpl-horizontal-table-container table.responsive tbody tr:first-child td.status-cell-pending::after {
    content: attr(data-status-text);
    display: inline-block;
    color: white !important;
    font-weight: bold;
    background-color: #f39c12 !important;
    border-radius: 20px; /* More rounded for button look */
    padding: 6px 16px;
    font-size: 0.85em;
    text-align: center;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(243, 156, 18, 0.3);
    border: 2px solid #e67e22;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
}

.acpl-horizontal-table-container table.responsive tbody tr:first-child td.status-cell-pending:hover::after {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(243, 156, 18, 0.4);
}

/* FIXED: Better horizontal table styling with equal height */
.acpl-horizontal-table-container {
    width: 100%;
    max-width: none;
    margin: 0 auto;
    max-height: none;
    display: flex; /* ADDED: Flex container */
    flex-direction: column; /* ADDED: Column direction */
}

.acpl-horizontal-table-container .acpl-responsive-table-wrapper {
    overflow-x: auto;
    max-height: none;
    overflow-y: visible;
    flex: 1; /* ADDED: Take remaining space */
}

.acpl-horizontal-table-container table.responsive {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0;
    table-layout: auto;
    min-width: 600px;
    height: 100%; /* ADDED: Full height */
}

.acpl-horizontal-table-container th,
.acpl-horizontal-table-container td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid rgba(52, 152, 219, 0.1);
    font-size: 0.9em;
    line-height: 1.4;
    vertical-align: top; /* ADDED: Align content to top */
}

.acpl-horizontal-table-container th {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    font-weight: 700;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 16px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.acpl-horizontal-table-container tr:nth-child(even) {
    background-color: rgba(52, 152, 219, 0.02);
}

.acpl-horizontal-table-container tr:hover {
    background-color: rgba(52, 152, 219, 0.05);
}

/* Mobile responsive handling */
@media (max-width: 767px) {
    .acpl-table-containers-wrapper {
        grid-template-columns: 1fr !important;
        align-items: start; /* CHANGED: No stretch on mobile */
    }
    
    .acpl-table-container {
        max-height: none;
        height: auto; /* CHANGED: Auto height on mobile */
    }
    
    .acpl-horizontal-table-container table.responsive {
        min-width: 100%;
    }
    
    .acpl-horizontal-table-container table.responsive thead {
        display: none;
    }
    
    .acpl-horizontal-table-container table.responsive tr {
        display: block;
        margin-bottom: 15px;
        border: 1px solid rgba(52, 152, 219, 0.15);
        border-radius: 8px;
        box-shadow: var(--shadow-light);
    }
    
    .acpl-horizontal-table-container table.responsive td {
        display: block;
        text-align: right;
        padding: 10px 15px;
        border-bottom: 1px dotted rgba(52, 152, 219, 0.1);
        position: relative;
        padding-left: 50%;
        font-size: 0.9em;
    }
    
    .acpl-horizontal-table-container table.responsive td:last-child {
        border-bottom: none;
    }
    
    .acpl-horizontal-table-container table.responsive td::before {
        content: attr(data-label);
        position: absolute;
        left: 15px;
        top: 10px;
        width: calc(50% - 20px);
        font-weight: 600;
        color: var(--text-primary);
        text-align: left;
        text-transform: uppercase;
        font-size: 0.75em;
    }
    
    /* UPDATED: Mobile status styling - button-like */
    .acpl-horizontal-table-container table.responsive tr:first-child td.status-cell-delivered {
        position: relative;
        padding: 10px 15px !important;
        color: transparent !important;
        background-color: transparent !important;
    }
    
    .acpl-horizontal-table-container table.responsive tr:first-child td.status-cell-delivered::after {
        content: attr(data-status-text);
        position: absolute;
        right: 15px;
        top: 50%;
        transform: translateY(-50%);
        display: inline-block;
        color: white !important;
        font-weight: bold;
        background-color: #2ecc71 !important;
        border-radius: 20px;
        padding: 6px 16px;
        font-size: 0.8em;
        text-align: center;
        white-space: nowrap;
        box-shadow: 0 2px 8px rgba(46, 204, 113, 0.3);
        border: 2px solid #27ae60;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    
    .acpl-horizontal-table-container table.responsive tr:first-child td.status-cell-pending {
        position: relative;
        padding: 10px 15px !important;
        color: transparent !important;
        background-color: transparent !important;
    }
    
    .acpl-horizontal-table-container table.responsive tr:first-child td.status-cell-pending::after {
        content: attr(data-status-text);
        position: absolute;
        right: 15px;
        top: 50%;
        transform: translateY(-50%);
        display: inline-block;
        color: white !important;
        font-weight: bold;
        background-color: #f39c12 !important;
        border-radius: 20px;
        padding: 6px 16px;
        font-size: 0.8em;
        text-align: center;
        white-space: nowrap;
        box-shadow: 0 2px 8px rgba(243, 156, 18, 0.3);
        border: 2px solid #e67e22;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    
    .acpl-info-field {
        flex-direction: column;
        align-items: flex-start;
        padding: 12px 15px;
        min-height: auto;
    }
    
    .acpl-field-label {
        width: 100%;
        margin-bottom: 6px;
        font-size: 0.8em;
        min-width: unset;
        max-width: unset;
    }
    
    .acpl-field-value {
        width: 100%;
        padding-left: 0;
        font-size: 0.9em;
    }
}

/* Error States */
.acpl-error {
    background: linear-gradient(135deg, var(--error-color), #c0392b);
    color: white;
    padding: 20px;
    border-radius: var(--border-radius);
    margin: 20px 0;
    text-align: center;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    word-break: break-word;
    overflow-wrap: break-word;
    font-size: 16px;
    line-height: 1.5;
}

.acpl-no-results {
    text-align: center;
    padding: 60px 20px;
    color: #7f8c8d;
    word-break: break-word;
    overflow-wrap: break-word;
}

.acpl-no-results p {
    font-size: 1.3em;
    margin: 0;
    font-weight: 500;
    line-height: 1.4;
}

.acpl-no-results small {
    display: block;
    margin-top: 10px;
    font-size: 0.9em;
    opacity: 0.8;
}

/* Notifications */
.acpl-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    padding: 15px 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-medium);
    border-left: 4px solid var(--success-color);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 1000;
    transform: translateX(400px);
    transition: transform 0.3s ease;
    max-width: 350px;
    word-break: break-word;
    overflow-wrap: break-word;
}

.acpl-notification.error {
    border-left-color: var(--error-color);
}

.acpl-notification.show {
    transform: translateX(0);
}

.acpl-notification span {
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.4;
}

/* Animations */
@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes rotate {
    to { transform: rotate(360deg); }
}

@keyframes slideInUp {
    from { 
        opacity: 0; 
        transform: translateY(30px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

/* Mobile responsive design */
@media (max-width: 767px) {
    #acpl-tracking-container {
        margin: 10px;
        padding: 20px;
    }
    
    .acpl-tracking-title {
        flex-direction: column;
        gap: 8px;
        margin-bottom: 25px;
    }
    
    .acpl-tracking-title span {
        font-size: 1.8em;
    }
    
    #acpl-tracking-form {
        padding: 20px;
    }
    
    .acpl-form-group input[type="text"] {
        font-size: 16px;
        padding: 12px 18px;
    }
    
    #track-btn {
        width: 100%;
        padding: 16px 20px;
        font-size: 16px;
    }
    
    .acpl-tracking-results {
        padding: 20px;
    }
    
    .acpl-results-title {
        font-size: 1.5em;
    }
    
    .acpl-notification {
        right: 10px;
        left: 10px;
        max-width: none;
        transform: translateY(-100px);
        font-size: 14px;
    }
    
    .acpl-notification.show {
        transform: translateY(0);
    }
    
    .acpl-error {
        padding: 16px;
        font-size: 14px;
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 480px) {
    #acpl-tracking-container {
        margin: 5px;
        padding: 15px;
    }
    
    .acpl-tracking-title span {
        font-size: 1.5em;
    }
    
    #acpl-tracking-form {
        padding: 15px;
    }
    
    .acpl-tracking-results {
        padding: 15px;
    }
    
    .acpl-notification {
        padding: 12px 16px;
        font-size: 13px;
    }
}

/* Print Styles */
@media print {
    #acpl-tracking-container {
        background: white !important;
        color: black !important;
        box-shadow: none !important;
    }
    
    #acpl-tracking-form,
    #acpl-loading {
        display: none !important;
    }
    
    .acpl-tracking-results {
        background: white !important;
        color: black !important;
        box-shadow: none !important;
    }
    
    .acpl-info-card {
        border: 1px solid #ddd !important;
        break-inside: avoid;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #0066cc;
        --secondary-color: #004499;
        --accent-color: #cc0000;
        --text-primary: #000000;
        --text-secondary: #333333;
    }
    
    .acpl-info-field:nth-child(even) {
        background-color: #f0f0f0;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .acpl-spinner-ring {
        animation: none !important;
    }
    
    .acpl-spinner {
        animation: none !important;
    }
}