/* ── SKL Tracking — Modern logistics UI ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --brand: #0b60a9;
    --brand-dark: #08446d;
    --brand-light: #e8f2fb;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --surface: #ffffff;
    --page-bg: #f4f6f9;
    --success: #059669;
    --success-bg: #ecfdf5;
    --warning: #d97706;
    --warning-bg: #fffbeb;
    --info: #2563eb;
    --info-bg: #eff6ff;
    --danger: #dc2626;
    --danger-bg: #fef2f2;
    --radius: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.1);
}

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text-primary);
    background: var(--page-bg);
    -webkit-font-smoothing: antialiased;
}

/* ── Search section ── */
.trackbox {
    max-width: 1100px;
    margin: 32px auto 48px;
    padding: 0 20px;
}

.tracking-search-card {
    border: 0;
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-md);
    padding: 36px 40px;
    border: 1px solid var(--border-light);
}

.tracking-search-header h1 {
    margin: 0;
    text-align: center;
    color: var(--text-primary);
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.tracking-search-header p {
    margin: 8px 0 0;
    text-align: center;
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 400;
}

.tracking-search-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 24px;
}

.tracking-option {
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    transition: all 0.2s ease;
}

.tracking-option:has(input:checked) {
    border-color: var(--brand);
    background: var(--brand-light);
    color: var(--brand-dark);
    font-weight: 600;
}

.tracking-option input[type="radio"] {
    width: 14px;
    height: 14px;
    margin: 0;
    accent-color: var(--brand);
}

.tracking-search-row {
    margin-top: 20px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.tracking-input-wrap {
    flex: 1;
}

.tracking-input-wrap input {
    height: 52px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    font-size: 15px;
    padding: 0 16px;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--surface);
}

.tracking-input-wrap input:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(11, 96, 169, 0.12);
}

.tracking-btn {
    min-width: 160px;
    height: 52px;
    border-radius: var(--radius);
    border: 0;
    background: var(--brand-dark);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    letter-spacing: 0.01em;
    transition: background 0.2s, transform 0.15s;
    cursor: pointer;
}

.tracking-btn:hover {
    background: var(--brand);
}

.tracking-btn:active {
    transform: scale(0.98);
}

/* ── Results area ── */
.track-result {
    margin-top: 8px;
}

.tracking-data {
    margin-top: 28px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.tracking-data-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 4px 0 8px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.tracking-data-divider::before,
.tracking-data-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ── Shipment card (accordion) ── */
.shipment-card {
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--surface);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.25s ease;
}

.shipment-card.is-open {
    box-shadow: var(--shadow-md);
    border-color: #c7d9ec;
}

.accordion-header {
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    display: block;
}

.accordion-header .shipment-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 22px;
    transition: background 0.2s;
}

.accordion-header:hover .shipment-summary {
    background: #fafbfc;
}

.accordion-header.active .shipment-summary {
    background: var(--brand-light);
    border-bottom: 1px solid #c7d9ec;
}

.shipment-summary-left {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.shipment-summary-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: var(--brand-light);
    color: var(--brand);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.shipment-summary-text h2 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.shipment-summary-text .sub-id {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 400;
    margin-top: 2px;
}

.shipment-summary-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.accordion-toggle {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 12px;
    transition: transform 0.25s;
}

.accordion-header.active .accordion-toggle {
    transform: rotate(180deg);
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

.accordion-body {
    display: none;
    padding: 0;
    border: none;
    background: transparent;
    margin: 0;
}

.accordion-body.active {
    display: block;
}

/* ── Carrier badges ── */
.carrier-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 6px;
    font-size: 11px;
    padding: 3px 8px;
    color: #fff;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.carrier-amazon { background: #232f3e; }
.carrier-flipkart { background: #2874f0; }
.carrier-fedex { background: #4d148c; }
.carrier-dhl { background: #d40511; }
.carrier-default { background: var(--brand-dark); }

/* ── Status pills ── */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.status-pill::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

.status-delivered {
    background: var(--success-bg);
    color: var(--success);
}

.status-in-transit {
    background: var(--info-bg);
    color: var(--info);
}

.status-out-for-delivery {
    background: var(--warning-bg);
    color: var(--warning);
}

.status-booked,
.status-pending {
    background: #f1f5f9;
    color: #475569;
}

.status-exception {
    background: var(--danger-bg);
    color: var(--danger);
}

/* ── Shipment hero (inside expanded card) ── */
.shipment-body {
    padding: 24px 22px 28px;
}

.shipment-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 24px;
}

.shipment-hero-left .hero-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.shipment-hero-left .hero-awb {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.shipment-hero-left .hero-meta {
    margin-top: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.shipment-hero-left .hero-meta span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.shipment-hero-right {
    text-align: right;
    flex-shrink: 0;
}

.shipment-hero-right .hero-status-text {
    margin: 8px 0 0;
    font-size: 13px;
    color: var(--text-secondary);
}

.copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--surface);
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
    vertical-align: middle;
}

.copy-btn:hover {
    border-color: var(--brand);
    color: var(--brand);
    background: var(--brand-light);
}

.copy-btn.copied {
    border-color: var(--success);
    color: var(--success);
    background: var(--success-bg);
}

/* ── Progress stepper (Amazon / FedEx style) ── */
.progress-tracker {
    margin-bottom: 28px;
}

.progress-steps {
    display: flex;
    justify-content: space-between;
    position: relative;
    list-style: none;
    margin: 0;
    padding: 0;
}

.progress-steps::before {
    content: '';
    position: absolute;
    top: 18px;
    left: 10%;
    right: 10%;
    height: 3px;
    background: var(--border);
    border-radius: 2px;
    z-index: 0;
}

.progress-steps .progress-fill {
    position: absolute;
    top: 18px;
    left: 10%;
    height: 3px;
    background: var(--brand);
    border-radius: 2px;
    z-index: 1;
    transition: width 0.5s ease;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 1;
    position: relative;
    z-index: 2;
}

.progress-step .step-dot {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--surface);
    border: 3px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: var(--text-muted);
    transition: all 0.3s ease;
}

.progress-step.done .step-dot {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

.progress-step.active .step-dot {
    background: var(--surface);
    border-color: var(--brand);
    color: var(--brand);
    box-shadow: 0 0 0 4px rgba(11, 96, 169, 0.15);
}

.progress-step .step-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-align: center;
    max-width: 90px;
    line-height: 1.3;
}

.progress-step.done .step-label,
.progress-step.active .step-label {
    color: var(--text-primary);
}

/* ── Split layout: details + timeline ── */
.result-split-layout {
    display: grid;
    grid-template-columns: 1fr 1.15fr;
    gap: 20px;
}

.awb-detail-box,
.timeline-box {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    overflow: hidden;
}

.detail-box-title,
.timeline-box-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.01em;
}

.detail-box-title i,
.timeline-box-title i {
    color: var(--brand);
    font-size: 14px;
}

/* Detail grid (Flipkart-style key-value) */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}

.detail-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
}

.detail-item:nth-child(odd) {
    border-right: 1px solid var(--border-light);
}

.detail-item.full-width {
    grid-column: 1 / -1;
    border-right: none;
}

.detail-item .detail-key {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 3px;
}

.detail-item .detail-value {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    word-break: break-word;
}

.detail-item .detail-value a {
    color: var(--brand);
    text-decoration: none;
    font-weight: 600;
}

.detail-item .detail-value a:hover {
    text-decoration: underline;
}

/* Legacy table fallback */
.awb-table {
    width: 100%;
    margin: 0;
    border-collapse: collapse;
    font-size: 13px;
}

.awb-table th,
.awb-table td {
    border-bottom: 1px solid var(--border-light);
    padding: 10px 16px;
    vertical-align: top;
}

.awb-table tr:last-child th,
.awb-table tr:last-child td {
    border-bottom: none;
}

.awb-table th {
    width: 38%;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: transparent;
}

.awb-table td {
    color: var(--text-primary);
    font-weight: 500;
}

/* ── Timeline (FedEx vertical tracker) ── */
.timeline-container {
    padding: 16px;
    max-height: 520px;
    overflow-y: auto;
}

.timeline-container::-webkit-scrollbar {
    width: 4px;
}

.timeline-container::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.timeline-step {
    display: flex;
    gap: 14px;
    position: relative;
    padding-bottom: 0;
}

.timeline-step:not(:last-child) {
    padding-bottom: 20px;
}

.timeline-marker {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 28px;
}

.timeline-step .circle {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--border);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    flex-shrink: 0;
    transition: all 0.2s;
    border: 2px solid var(--surface);
    box-shadow: 0 0 0 2px var(--border);
}

.timeline-step.is-latest .circle {
    background: var(--brand);
    color: #fff;
    box-shadow: 0 0 0 3px rgba(11, 96, 169, 0.2);
}

.timeline-step.is-delivered .circle {
    background: var(--success);
    color: #fff;
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.2);
}

.timeline-step .line {
    width: 2px;
    flex: 1;
    background: var(--border);
    margin-top: 6px;
    min-height: 16px;
}

.timeline-step.is-latest .line {
    background: linear-gradient(to bottom, var(--brand), var(--border));
}

.timeline-content {
    flex: 1;
    padding-top: 2px;
}

.timeline-content .label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
}

.timeline-step.is-latest .label {
    color: var(--brand-dark);
}

.timeline-content .sub-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 3px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.timeline-content .date-time {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 5px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

.timeline-content .remarks {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
    padding: 6px 10px;
    background: #f8fafc;
    border-radius: 6px;
    border-left: 3px solid var(--border);
    font-style: normal;
}

.timeline-empty {
    padding: 32px 16px;
    font-size: 14px;
    color: var(--text-muted);
    text-align: center;
}

.timeline-empty i {
    display: block;
    font-size: 28px;
    margin-bottom: 8px;
    opacity: 0.4;
}

/* ── Loading & error states ── */
.tracking-loading {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-secondary);
}

.tracking-loading .spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin: 0 auto 14px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.invalid-record {
    border: 1px solid #fecaca;
    background: var(--danger-bg);
    border-radius: var(--radius);
    padding: 16px 20px;
    text-align: center;
}

.invalid-record h5 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--danger);
}

.no-results-card {
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    padding: 40px 20px;
    text-align: center;
    color: var(--text-secondary);
}

.no-results-card i {
    font-size: 36px;
    color: var(--text-muted);
    margin-bottom: 12px;
    display: block;
}

.no-results-card h4 {
    margin: 0 0 6px;
    font-size: 16px;
    color: var(--text-primary);
}

.no-results-card p {
    margin: 0;
    font-size: 14px;
}

/* ── Responsive ── */
@media (max-width: 992px) {
    .tracking-search-card {
        padding: 24px 20px;
    }

    .tracking-search-header h1 {
        font-size: 24px;
    }

    .tracking-search-row {
        flex-direction: column;
    }

    .tracking-btn {
        width: 100%;
        min-width: 100%;
    }

    .result-split-layout {
        grid-template-columns: 1fr;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .detail-item:nth-child(odd) {
        border-right: none;
    }

    .shipment-hero {
        flex-direction: column;
    }

    .shipment-hero-right {
        text-align: left;
    }

    .progress-step .step-label {
        font-size: 10px;
        max-width: 70px;
    }

    .progress-step .step-dot {
        width: 30px;
        height: 30px;
        font-size: 11px;
    }

    .shipment-summary {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .tracking-search-options {
        flex-direction: column;
        align-items: stretch;
    }

    .tracking-option {
        justify-content: center;
    }

    .progress-steps::before,
    .progress-steps .progress-fill {
        left: 8%;
        right: 8%;
    }
}
