﻿html {
    box-sizing: border-box;
    min-height: 100%;
}

*,
*::before,
*::after {
    box-sizing: inherit;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    font-family: 'Quicksand', Helvetica, Arial, sans-serif;
    line-height: 1.45;
    background: #f4f5f7;
    color: #1f2937;
}

button,
input,
select,
textarea {
    font: inherit;
}

img {
    max-width: 100%;
    height: auto;
}

a {
    color: #d71920;
    text-decoration: none;
}

    a:hover {
        text-decoration: underline;
    }

[hidden] {
    display: none !important;
}


/* ============================================================
   PAGE
   ============================================================ */

.page-shell {
    min-height: 100vh;
    background: #f4f5f7;
}

.tracking-card {
    width: 100%;
    max-width: 760px;
    min-height: 100vh;
    margin: 0 auto;
    padding: 18px 14px 190px;
    background: #ffffff;
}


/* ============================================================
   HEADER
   ============================================================ */

.tracking-hero {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e5e7eb;
}

.tracking-hero-logo {
    flex: 0 0 76px;
}

    .tracking-hero-logo img {
        display: block;
        width: 76px;
        max-height: 58px;
        object-fit: contain;
    }

.tracking-hero-copy {
    flex: 1;
    min-width: 0;
}

    .tracking-hero-copy h1 {
        margin: 0 0 3px;
        color: #1f2937;
        font-size: 21px;
        font-weight: 800;
        line-height: 1.15;
    }

    .tracking-hero-copy p {
        margin: 0;
        color: #6b7280;
        font-size: 13px;
        line-height: 1.35;
    }


/* ============================================================
   STANDARD PANELS
   ============================================================ */

.info-panel,
.product-table {
    width: 100%;
    margin: 0 0 12px;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid #e2e5e9;
    border-radius: 9px;
}

.info-label,
.product-table-head {
    padding: 8px 12px;
    background: #f3f4f6;
    border-bottom: 1px solid #e2e5e9;
    color: #4b5563;
    font-size: 12px;
    font-weight: 800;
}

.panel-content {
    padding: 12px;
}

.info-value {
    margin: 0;
    color: #111827;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
}

.info-subvalue {
    margin-top: 2px;
}


/* ============================================================
   STATUS / DATE
   ============================================================ */

.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 5px 10px;
    background: #d71920;
    color: #ffffff;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    text-transform: uppercase;
}

.date-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 0;
    background: transparent;
    color: #111827;
    font-size: 15px;
    font-weight: 700;
}

.status-message {
    margin: 0;
    color: #b42318;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
}

#statusMessageSection .panel-content {
    background: #fff7f7;
}


/* ============================================================
   DELIVERY INFORMATION BOX
   ============================================================ */

.delivery-info-box {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
    margin-top: 12px;
    padding: 14px 16px;
    background: #eef8ff;
    border: 1px solid #9fd3ff;
    border-radius: 9px;
}

.delivery-info-icon {
    width: 32px;
    flex: 0 0 32px;
    color: #0674d8;
    font-size: 29px;
    font-weight: 800;
    line-height: 1;
    text-align: center;
}

.delivery-info-content {
    flex: 1;
    min-width: 0;
}

.delivery-info-title {
    margin: 0 0 3px;
    color: #003b8f;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.3;
}

.delivery-info-message {
    margin: 0;
    color: #123b70;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.45;
}

.calendar-delivery-info-box {
    margin-top: 0;
    margin-bottom: 16px;
}


/* ============================================================
   LIVE TRACKING
   ============================================================ */

.live-tracking-card {
    width: 100%;
    margin: 0 0 12px;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid #dfe3e8;
    border-radius: 9px;
}

.live-tracking-header {
    padding: 9px 12px;
    background: #f3f4f6;
    border-bottom: 1px solid #dfe3e8;
    color: #4b5563;
    font-size: 12px;
    font-weight: 800;
}

.live-tracking-body {
    padding: 12px;
}

.live-progress-panel {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0 0 10px;
    padding: 12px;
    background: #e9edf2;
    border-radius: 7px;
}

.live-progress-icon {
    width: 22px;
    flex: 0 0 22px;
    font-size: 18px;
    line-height: 1.2;
}

.live-progress-copy {
    flex: 1;
    min-width: 0;
}

.live-progress-title {
    margin-bottom: 2px;
    color: #1f2937;
    font-size: 13px;
    font-weight: 800;
}

.live-progress-text {
    color: #374151;
    font-size: 13px;
    line-height: 1.4;
}

.live-summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin: 0 -12px;
    border-top: 1px solid #e5e7eb;
    border-bottom: 1px solid #e5e7eb;
}

.live-summary-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 12px;
}

    .live-summary-item:first-child {
        border-right: 1px solid #e5e7eb;
    }

.live-summary-icon {
    width: 20px;
    flex: 0 0 20px;
    font-size: 15px;
    line-height: 1.3;
}

.live-summary-copy {
    flex: 1;
    min-width: 0;
}

.live-summary-label {
    margin-bottom: 2px;
    color: #4b5563;
    font-size: 11px;
    font-weight: 800;
}

.live-summary-value {
    margin-bottom: 2px;
    color: #111827;
    font-size: 18px;
    font-weight: 800;
    line-height: 1.15;
}

.live-summary-note,
.live-summary-warning {
    color: #6b7280;
    font-size: 10px;
    line-height: 1.3;
}

.live-summary-warning {
    color: #d71920;
}

.live-detail-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 12px 0;
    border-bottom: 1px solid #e5e7eb;
}

.live-detail-icon {
    width: 20px;
    flex: 0 0 20px;
    font-size: 15px;
    line-height: 1.3;
}

.live-detail-copy {
    flex: 1;
    min-width: 0;
}

.live-detail-label {
    margin-bottom: 2px;
    color: #4b5563;
    font-size: 11px;
    font-weight: 800;
}

.live-detail-value {
    color: #111827;
    font-size: 13px;
    line-height: 1.4;
}

.live-location-section {
    margin-top: 0;
}

.live-location-heading {
    border-bottom: 0;
    padding-bottom: 8px;
}

.tracking-map {
    position: relative;
    width: 100%;
    height: 290px;
    min-height: 290px;
    overflow: hidden;
    background: #eef2f7;
    border: 1px solid #dfe3e8;
    border-radius: 8px;
}

    .tracking-map > div {
        border-radius: 8px;
    }


/* ============================================================
   PRODUCTS
   ============================================================ */

.product-section {
    margin-bottom: 12px;
}

.product-table-body {
    display: block;
}

.product-row {
    display: block;
    padding: 11px 12px;
    border-bottom: 1px solid #eceff2;
}

    .product-row:last-child {
        border-bottom: 0;
    }

.product-name {
    color: #1f2937;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
}


/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
    width: 100%;
    min-height: 48px;
    padding: 12px 16px;
    border: 0;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
}

.btn-accept {
    background: #d71920;
    color: #ffffff;
}

.btn-decline {
    background: #2f3135;
    color: #ffffff;
}

.btn-secondary {
    background: #eceff2;
    color: #1f2937;
}

.btn:disabled,
.btn.disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

.action-group {
    display: grid;
    gap: 8px;
}

#initialDateActions,
.calendar-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    width: 100%;
}


/* ============================================================
   CALENDAR
   ============================================================ */

.calendar-panel {
    margin-top: 0;
}

.available-dates-message {
    margin: 0 0 12px;
    color: #667085;
    font-size: 13px;
}

.calendar-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.calendar-month-label {
    flex: 1;
    color: #111827;
    font-size: 15px;
    font-weight: 800;
    text-align: center;
}

.calendar-nav-btn {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    color: #222222;
    border: 1px solid #d7dce1;
    border-radius: 8px;
    font-size: 17px;
    font-weight: 800;
    cursor: pointer;
}

    .calendar-nav-btn:disabled {
        opacity: 0.35;
        cursor: default;
    }

.calendar-weekdays,
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 4px;
}

.calendar-weekdays {
    margin-bottom: 5px;
}

    .calendar-weekdays div {
        padding: 3px 0;
        color: #667085;
        font-size: 10px;
        font-weight: 800;
        text-align: center;
    }

.calendar-day {
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: #f7f7f7;
    color: #a5a5a5;
    border: 1px solid #e8e8e8;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 700;
}

    .calendar-day.blank {
        background: transparent;
        border: 0;
    }

    .calendar-day.unavailable {
        background: #f5f5f5;
        color: #b9b9b9;
    }

    .calendar-day.available {
        background: #effaf1;
        color: #147326;
        border-color: #74c582;
        cursor: pointer;
    }

        .calendar-day.available:hover {
            background: #e4f8e8;
        }

    .calendar-day.selected {
        background: #d71920;
        color: #ffffff;
        border-color: #d71920;
    }

.selected-date-message {
    margin-top: 10px;
    padding: 10px 12px;
    background: #f6f7f8;
    color: #344054;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
}


/* ============================================================
   FOOTER
   ============================================================ */

.tracking-footer {
    margin-top: 20px;
    padding-top: 14px;
    border-top: 1px solid #eceff2;
    color: #667085;
    font-size: 12px;
    text-align: center;
}

    .tracking-footer p {
        margin: 0 0 7px;
    }


/* ============================================================
   LOADING
   ============================================================ */

.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.68);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #d2d2d2;
    border-top-color: #333333;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}


/* ============================================================
   MOBILE
   ============================================================ */

@media (max-width: 767px) {

    .tracking-card {
        padding: 14px 12px 190px;
    }

    .tracking-hero {
        gap: 10px;
    }

    .tracking-hero-logo {
        flex-basis: 64px;
    }

        .tracking-hero-logo img {
            width: 64px;
        }

    .tracking-hero-copy h1 {
        font-size: 18px;
    }

    .tracking-hero-copy p {
        font-size: 12px;
    }

    .live-summary-grid {
        grid-template-columns: 1fr;
    }

    .live-summary-item:first-child {
        border-right: 0;
        border-bottom: 1px solid #e5e7eb;
    }

    .tracking-map {
        height: 250px;
        min-height: 250px;
    }

    .delivery-info-box {
        gap: 10px;
        padding: 12px;
    }

    .delivery-info-icon {
        width: 28px;
        flex-basis: 28px;
        font-size: 25px;
    }

    .delivery-info-title {
        font-size: 12px;
    }

    .delivery-info-message {
        font-size: 11px;
    }

    #initialDateActions,
    .calendar-actions {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 9999;
        padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
        background: rgba(255, 255, 255, 0.98);
        border-top: 1px solid #e5e7eb;
        box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.08);
    }
}


/* ============================================================
   DESKTOP
   ============================================================ */

@media (min-width: 768px) {

    body.tracking-page {
        padding: 24px 16px;
    }

    .page-shell {
        min-height: calc(100vh - 48px);
    }

    .tracking-card {
        min-height: auto;
        padding: 24px 26px 24px;
        border-radius: 14px;
        box-shadow: 0 8px 28px rgba(15, 23, 42, 0.08);
    }

    .tracking-map {
        height: 320px;
        min-height: 320px;
    }

    #initialDateActions {
        position: static;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
        margin: 18px 0 0;
        padding: 0;
        background: transparent;
        border-top: 0;
        border-radius: 0;
        box-shadow: none;
        transform: none;
    }

    .tracking-footer {
        margin-top: 22px;
        padding-top: 16px;
        border-top: 1px solid #eceff2;
    }

    .calendar-actions {
        position: static;
        grid-template-columns: minmax(0, 1fr) minmax(0, 0.7fr) minmax(0, 1.4fr);
        width: 100%;
        margin-top: 16px;
        padding: 12px 0 0;
        background: transparent;
        border-top: 1px solid #e5e7eb;
        box-shadow: none;
        transform: none;
    }
}


/* ============================================================
   FOCUSED DATE SELECTION MODE
   ============================================================ */

body.date-selection-mode #statusMessageSection,
body.date-selection-mode #liveTrackingCard,
body.date-selection-mode .info-panel:not(#availableDatesSection),
body.date-selection-mode #productSection,
body.date-selection-mode .tracking-footer,
body.date-selection-mode #initialDateActions {
    display: none !important;
}

body.date-selection-mode #availableDatesSection {
    display: block !important;
    margin: 0;
}

body.date-selection-mode .page-shell {
    min-height: 100vh;
}


/* Header deliberately remains visible in focused mode */

@media (max-width: 767px) {

    body.date-selection-mode .tracking-card {
        padding: 14px 12px 190px;
    }
}

@media (min-width: 768px) {

    body.date-selection-mode .tracking-card {
        padding: 24px 26px 24px;
    }

    body.date-selection-mode #availableDatesSection {
        margin-bottom: 0;
    }
}


/* ============================================================
   HOME PAGE
   ============================================================ */

body.home-page {
    margin: 0;
    min-height: 100vh;
    padding: 0;
    background: #f4f5f7;
    color: #1f2937;
}

.home-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.home-card {
    width: 100%;
    max-width: 620px;
    padding: 32px;
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.08);
}

.home-header {
    margin-bottom: 28px;
    text-align: center;
}

.home-logo {
    margin-bottom: 22px;
    text-align: center;
}

    .home-logo img {
        display: block;
        width: auto;
        max-width: 180px;
        max-height: 120px;
        margin: 0 auto;
        object-fit: contain;
    }

.home-header h1 {
    margin: 0 0 8px;
    color: #172b4d;
    font-size: 28px;
    font-weight: 800;
    line-height: 1.15;
}

.home-header p {
    margin: 0;
    color: #667085;
    font-size: 16px;
    line-height: 1.4;
}


/* ============================================================
   HOME FORM
   ============================================================ */

.home-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.home-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

    .home-field label {
        color: #52627a;
        font-size: 13px;
        font-weight: 700;
    }

.home-textbox {
    width: 100%;
    min-height: 52px;
    padding: 12px 14px;
    background: #ffffff;
    color: #111827;
    border: 1px solid #d7dce1;
    border-radius: 8px;
    font-size: 16px;
    outline: none;
}

    .home-textbox:focus {
        border-color: #d71920;
        box-shadow: 0 0 0 3px rgba(215, 25, 32, 0.10);
    }

.home-track-button {
    width: 100%;
    min-height: 52px;
    margin-top: 4px;
    padding: 13px 18px;
    background: #d71920;
    color: #ffffff;
    border: 0;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
}

    .home-track-button:hover {
        opacity: 0.95;
    }

    .home-track-button:active {
        transform: translateY(1px);
    }


/* ============================================================
   HOME FOOTER
   ============================================================ */

.home-footer {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid #eceff2;
    color: #667085;
    font-size: 14px;
    text-align: center;
}

    .home-footer p {
        margin: 0;
    }

    .home-footer a {
        color: #d71920;
        font-weight: 700;
        text-decoration: none;
    }

        .home-footer a:hover {
            text-decoration: underline;
        }


/* ============================================================
   HOME MOBILE
   ============================================================ */

@media (max-width: 767px) {

    .home-shell {
        min-height: 100vh;
        padding: 0;
        align-items: stretch;
    }

    .home-card {
        min-height: 100vh;
        padding: 28px 18px;
        border-radius: 0;
        box-shadow: none;
    }

    .home-logo img {
        max-width: 150px;
        max-height: 100px;
    }

    .home-header {
        margin-bottom: 24px;
    }

        .home-header h1 {
            font-size: 25px;
        }

        .home-header p {
            font-size: 15px;
        }
}


/* ============================================================
   HOME SMALL MOBILE
   ============================================================ */

@media (max-width: 430px) {

    .home-card {
        padding: 24px 16px;
    }

    .home-logo img {
        max-width: 135px;
        max-height: 90px;
    }

    .home-header h1 {
        font-size: 23px;
    }
}