/* style.css for ACX Shipment Tracker Plugin - Optimized for Mobile */

.acx-tracking-container {
    background-color: #ffffff;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    max-width: 100%; /* Ensures container fills available width */
    margin: 40px auto;
    font-family: 'Inter', sans-serif;
    text-align: center;
}

.acx-tracking-container h2 {
    font-size: 2em;
    color: #2c3e50;
    margin-bottom: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.acx-tracking-container p {
    color: #7f8c8d;
    margin-bottom: 25px;
    font-size: 1.1em;
}

.acx-tracking-container form {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    margin-bottom: 30px;
}

.acx-tracking-container input[type="text"] {
    flex: 1;
    min-width: 250px;
    padding: 12px 18px;
    border: 1px solid #ced4da;
    border-radius: 8px;
    font-size: 1em;
    color: #34495e; /* Ensure input text is dark */
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.acx-tracking-container input[type="text"]:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    outline: none;
}

.acx-tracking-container button[type="submit"] {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 123, 255, 0.2);
}

.acx-tracking-container button[type="submit"]:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 123, 255, 0.3);
}

/* Message styles */
.acx-tracking-message {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: left;
    font-size: 1em;
}

.acx-tracking-message.acx-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.acx-tracking-message.acx-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Results container */
.acx-tracking-results {
    text-align: left;
    margin-top: 30px;
    border-top: 1px solid #eceeef;
    padding-top: 20px;
}

.acx-tracking-results h3 {
    font-size: 1.6em;
    color: #2c3e50;
    margin-bottom: 15px;
    font-weight: 600;
    text-align: center; /* Center the AWB number */
}

.acx-tracking-results h4 {
    font-size: 1.3em;
    color: #34495e;
    margin-top: 25px;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 2px solid #007bff; /* Highlight section headers */
}

/* Table styles - Standard table display for larger screens */
.acx-tracking-results table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 auto 20px auto; /* Centered horizontally, 20px bottom margin */
    background-color: #ffffff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    overflow: hidden; /* Ensures rounded corners apply to content */
    display: table; /* Default display as table */
    /* table-layout: fixed; */ /* Removed to allow columns to adjust naturally */
}

/* Wrapper for tables to allow horizontal scrolling on smaller viewports */
/* It's crucial that your PHP code wraps the tables in a div with this class, e.g.,
   <div class="table-responsive"><table ...></table></div>
*/
.acx-tracking-results .table-responsive {
    overflow-x: auto; /* Enables horizontal scrolling if content overflows */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    margin-bottom: 20px; /* Space after each responsive table block */
}


.acx-tracking-results thead {
    display: table-header-group; /* Ensure header is displayed */
}

.acx-tracking-results tbody {
    display: table-row-group; /* Ensure body is displayed */
}

.acx-tracking-results tr {
    display: table-row; /* Ensure rows are displayed as table rows */
    border: none; /* Remove previous block-style border */
}

.acx-tracking-results th,
.acx-tracking-results td {
    border: 1px solid #e9ecef; /* Re-add individual cell borders */
    padding: 12px 15px;
    text-align: left;
    font-size: 0.95em;
    color: #000000; /* Ensure text in table cells is black */
    display: table-cell; /* Ensure cells are displayed as table cells */
    width: auto; /* Let content determine width */
    word-break: break-word; /* Allows long words to break and wrap */
}

.acx-tracking-results th {
    background-color: #007fd1; /* Table header background color */
    color: white; /* White text for headers */
    font-weight: 600;
    white-space: nowrap; /* Prevent headers from wrapping too much */
    border-bottom: 1px solid #007fd1; /* Border for header bottom */
}

.acx-tracking-results tr:nth-child(even) {
    background-color: #fbfbfc;
}

.acx-tracking-results table.acx-tracking-history th,
.acx-tracking-results table.acx-tracking-history td {
    vertical-align: top;
}

/* Specific styles for the "View POD" link */
.acx-tracking-results table a {
    color: #007bff;
    text-decoration: none;
    font-weight: 500;
}

.acx-tracking-results table a:hover {
    text-decoration: underline;
}

/* Responsive adjustments for tables - stack on small screens */
@media (max-width: 768px) {
    .acx-tracking-container {
        margin: 20px auto;
        padding: 20px;
    }

    .acx-tracking-container form {
        flex-direction: column;
        gap: 10px;
    }

    .acx-tracking-container input[type="text"],
    .acx-tracking-container button[type="submit"] {
        width: 100%;
        min-width: unset;
    }

    .acx-tracking-results h3 {
        font-size: 1.5em;
    }

    .acx-tracking-results h4 {
        font-size: 1.2em;
    }

    .acx-tracking-results table {
        /* On small screens, make the table behave like a list of blocks */
        display: block;
        width: 100%;
        box-shadow: none; /* Remove table shadow when stacked */
        border-radius: 0;
        overflow: visible; /* Allow overflow if needed within stacked blocks */
    }

    .acx-tracking-results thead {
        display: none; /* Hide header on small screens when stacking */
    }

    .acx-tracking-results tbody {
        display: block;
    }

    .acx-tracking-results tr {
        border: 1px solid #dee2e6;
        margin-bottom: 15px;
        border-radius: 8px;
        overflow: hidden;
        display: block; /* Each row becomes a block */
        background-color: #ffffff; /* Ensure consistent background for each row block */
    }
    .acx-tracking-results tr:nth-child(even) {
        background-color: #fbfbfc; /* Keep stripe effect for row blocks */
    }


    .acx-tracking-results td {
        border: none; /* No internal borders for stacked items */
        border-bottom: 1px solid #e9ecef; /* Separator between key-value pairs */
        position: relative;
        padding-left: 50%; /* Space for the label */
        text-align: right;
        display: block; /* Each cell is a block */
        word-break: break-word; /* Ensure long words break within the value */
    }

    .acx-tracking-results td:last-child {
        border-bottom: 0; /* No border on the last key-value pair in a row block */
    }

    .acx-tracking-results td:before {
        position: absolute;
        left: 15px;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap; /* Prevent label from wrapping if it's too long */
        text-align: left;
        font-weight: 600;
        color: #495057;
        content: attr(data-label);
        box-sizing: border-box; /* Include padding in width */
    }
    /* Specific labels for responsive tables using data-label attribute */
    .acx-tracking-info-table td:nth-of-type(1):before { content: "AWB No."; }
    .acx-tracking-info-table td:nth-of-type(2):before { content: "Booking Date"; }
    .acx-tracking-info-table td:nth-of-type(3):before { content: "Consignee Name"; }
    .acx-tracking-info-table td:nth-of-type(4):before { content: "Destination"; }
    .acx-tracking-info-table td:nth-of-type(5):before { content: "No. Of Pieces"; }
    .acx-tracking-info-table td:nth-of-type(6):before { content: "Status"; }
    .acx-tracking-info-table td:nth-of-type(7):before { content: "Delivery Date"; }
    .acx-tracking-info-table td:nth-of-type(8):before { content: "Delivery Time"; }
    .acx-tracking-info-table td:nth-of-type(9):before { content: "Receiver Name"; }
    .acx-tracking-info-table td:nth-of-type(10):before { content: "Forwarding No."; }
    .acx-tracking-info-table td:nth-of-type(11):before { content: "View POD"; }

    .acx-delivery-info-table td:nth-of-type(1):before { content: "Date"; }
    .acx-delivery-info-table td:nth-of-type(2):before { content: "Time"; }
    .acx-delivery-info-table td:nth-of-type(3):before { content: "Location"; }
    .acx-delivery-info-table td:nth-of-type(4):before { content: "Activity"; }
    .acx-delivery-info-table td:nth-of-type(5):before { content: "Remarks"; }
}
