/* Order Tracking — shared (modal, page, homepage) */

#trackModal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 12px;
    -webkit-overflow-scrolling: touch;
}

#trackModal.ot-modal-open {
    display: flex;
}

.ot-modal-panel {
    background: #fff;
    border-radius: 16px;
    padding: 24px 22px;
    max-width: 560px;
    width: 100%;
    position: relative;
    max-height: min(90vh, 900px);
    overflow: auto;
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.18);
}

.ot-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: #f1f5f9;
    color: #334155;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ot-modal-close:active {
    background: #e2e8f0;
}

.ot-modal-title {
    font-size: 1.15rem;
    font-weight: 800;
    margin-bottom: 4px;
    padding-right: 36px;
}

.ot-modal-subtitle {
    font-size: 13px;
    color: #64748b;
    margin-bottom: 16px;
}

.ot-track-tabs .nav-link {
    font-size: 13px;
    font-weight: 600;
    padding: 8px 14px;
}

.ot-track-tabs {
    display: flex;
    width: 100%;
    gap: 0;
}

.ot-track-tabs .nav-item {
    flex: 1;
}

.ot-track-tabs .nav-link {
    width: 100%;
    text-align: center;
}

.ot-search-hint {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 10px;
    line-height: 1.45;
}

.ot-search-row {
    display: flex;
    gap: 0;
}

.ot-search-row .form-control {
    min-height: 44px;
    font-size: 16px;
    border-radius: 10px 0 0 10px;
    border-color: #cbd5e1;
}

.ot-search-row .btn-success {
    min-height: 44px;
    font-weight: 700;
    padding-left: 18px;
    padding-right: 18px;
    border-radius: 0 10px 10px 0;
    white-space: nowrap;
}

.ot-track-result {
    margin-top: 16px;
}

/* Order card */
.order-track-card {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 12px;
    background: #fff;
}

.order-track-card--running {
    border-color: #22c55e;
    background: linear-gradient(180deg, #f0fdf4 0%, #fff 48px);
    box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.12);
}

.track-section .order-track-card,
#trackResult .order-track-card,
#trackPageResult .order-track-card,
#trackResultHome .order-track-card {
    text-align: left;
}

.ot-track-summary {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
}

.ot-track-invoice {
    font-size: 15px;
    line-height: 1.35;
}

.ot-track-amount {
    font-size: 18px;
    font-weight: 800;
    color: #16a34a;
    line-height: 1.2;
}

.ot-track-customer {
    font-size: 13px;
    color: #475569;
    margin-top: 8px;
}

.ot-courier-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
    font-size: 12px;
    margin-top: 8px;
    padding: 8px 10px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

/* Timeline */
.ot-timeline-section {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
}

.ot-timeline-label {
    font-size: 13px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ot-timeline-label::before {
    content: '';
    width: 4px;
    height: 14px;
    border-radius: 4px;
    background: #22c55e;
}

.ot-timeline {
    position: relative;
    padding-left: 4px;
}

.ot-timeline::before {
    content: '';
    position: absolute;
    left: 11px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: #e2e8f0;
}

.ot-timeline-item {
    position: relative;
    padding: 0 0 16px 32px;
}

.ot-timeline-item:last-child {
    padding-bottom: 0;
}

.ot-timeline-dot {
    position: absolute;
    left: 4px;
    top: 4px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid #94a3b8;
    z-index: 1;
}

.ot-timeline-item--latest .ot-timeline-dot {
    border-color: #22c55e;
    background: #dcfce7;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
}

.ot-timeline-meta {
    font-size: 11px;
    color: #64748b;
    margin-bottom: 5px;
}

.ot-timeline-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 5px;
    align-items: center;
}

.ot-performer {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 4px 9px;
    border-radius: 999px;
}

.ot-performer-customer { background: #dbeafe; color: #1d4ed8; }
.ot-performer-admin { background: #fff; color: #111827; border: 1px solid #d1d5db; }
.ot-performer-courier { background: #0d9488; color: #fff; }
.ot-performer-system { background: #f3f4f6; color: #6b7280; border: 1px solid #e5e7eb; }

.ot-courier-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 999px;
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #bbf7d0;
}

.ot-timeline-msg {
    font-size: 13px;
    color: #334155;
    line-height: 1.5;
}

.ot-timeline-empty {
    font-size: 13px;
    color: #94a3b8;
    padding: 16px 8px;
    text-align: center;
    background: #f8fafc;
    border-radius: 8px;
}

/* Standalone tracking page */
.ot-page-wrap {
    max-width: 720px;
    margin: 0 auto;
    padding: 16px 16px 32px;
    min-height: 100vh;
}

.ot-page-card {
    border: none;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(15, 23, 42, 0.08);
    overflow: hidden;
}

.ot-page-header {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #fff;
    padding: 24px 20px;
    text-align: center;
}

.ot-page-header h4 {
    font-size: 1.25rem;
    font-weight: 800;
    margin-bottom: 4px;
}

.ot-page-body {
    padding: 20px 16px;
}

.ot-page-search .form-control,
.ot-page-search .btn {
    min-height: 46px;
}

/* Homepage track section mobile */
.track-section .track-form {
    max-width: 520px;
}

.track-section .track-form input {
    font-size: 16px;
    min-height: 44px;
}

.track-section .track-form button {
    min-height: 44px;
    min-width: 88px;
}

.track-section .nav-pills .nav-link {
    font-size: 13px;
    padding: 8px 16px;
}

#trackResultHome {
    max-width: 560px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}

/* ── Mobile ── */
@media (max-width: 575.98px) {
    #trackModal {
        align-items: flex-end;
        padding: 0;
    }

    .ot-modal-panel {
        max-height: 94vh;
        border-radius: 18px 18px 0 0;
        padding: 18px 14px calc(14px + env(safe-area-inset-bottom, 0px));
        animation: otSlideUp 0.25s ease-out;
    }

    @keyframes otSlideUp {
        from { transform: translateY(100%); opacity: 0.6; }
        to { transform: translateY(0); opacity: 1; }
    }

    .ot-modal-title {
        font-size: 1.05rem;
    }

    .ot-track-tabs {
        display: flex;
        width: 100%;
    }

    .ot-track-tabs .nav-item {
        flex: 1;
    }

    .ot-track-tabs .nav-link {
        width: 100%;
        text-align: center;
        padding: 10px 8px;
    }

    .ot-search-row {
        flex-direction: column;
        gap: 8px;
    }

    .ot-search-row .form-control,
    .ot-search-row .btn-success {
        width: 100%;
        border-radius: 10px !important;
    }

    .ot-search-row .btn-success {
        font-size: 15px;
    }

    .ot-track-summary {
        flex-direction: column;
    }

    .ot-track-summary .ot-track-price-col {
        width: 100%;
        text-align: left !important;
        margin-top: 4px;
        padding-top: 10px;
        border-top: 1px dashed #e2e8f0;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
    }

    .ot-track-amount {
        font-size: 17px;
    }

    .order-track-card {
        padding: 12px;
        border-radius: 10px;
    }

    .ot-timeline-msg {
        font-size: 12.5px;
    }

    .ot-page-wrap {
        padding: 12px 12px 24px;
    }

    .ot-page-header {
        padding: 20px 16px;
    }

    .ot-page-header h4 {
        font-size: 1.1rem;
    }

    .ot-page-body {
        padding: 16px 12px;
    }

    .ot-page-search {
        flex-direction: column;
        gap: 8px;
    }

    .ot-page-search .form-control,
    .ot-page-search .btn {
        width: 100%;
        border-radius: 10px !important;
    }

    .track-section {
        padding: 32px 0 !important;
    }

    .track-section h3 {
        font-size: 1.15rem !important;
        padding: 0 12px;
    }

    .track-section .track-form {
        flex-direction: column;
        gap: 8px;
        margin-left: 12px;
        margin-right: 12px;
    }

    .track-section .track-form input,
    .track-section .track-form button {
        width: 100%;
        border-radius: 10px !important;
        border-right: 1.5px solid var(--primary, #22c55e) !important;
    }

    .track-section .nav-pills {
        padding: 0 8px;
    }

    .track-section .nav-pills .nav-item {
        flex: 1;
    }

    .track-section .nav-pills .nav-link {
        width: 100%;
    }

    #trackResultHome {
        margin-left: 12px;
        margin-right: 12px;
    }
}
