/* ==========================================================================
   ShipCartExpress Tracking Portal - shared styles
   Brand colors, typography, public tracking page, and components shared
   between the public portal and the admin panel.
   ========================================================================== */

:root {
    --sce-navy: #063B8C;
    --sce-deep-blue: #062C68;
    --sce-electric: #009FE3;
    --sce-orange: #FF6B00;
    --sce-gold: #FFB000;
    --sce-white: #FFFFFF;
    --sce-bg: #F6F8FB;
    --sce-text: #101828;
    --sce-text-muted: #667085;
    --sce-border: #E4E9F2;
    --sce-radius: 10px;
    --sce-shadow: 0 2px 10px rgba(6, 44, 104, 0.06);
    --sce-shadow-md: 0 8px 24px rgba(6, 44, 104, 0.08);
}

* { box-sizing: border-box; }

html, body {
    background: var(--sce-white);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--sce-text);
    font-size: 16px;
    line-height: 1.55;
}

a { color: var(--sce-electric); text-decoration: none; }
a:hover { color: var(--sce-navy); }

h1, h2, h3, h4 {
    color: var(--sce-navy);
    font-weight: 700;
    letter-spacing: -0.01em;
}

.mono {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    letter-spacing: 0.02em;
    word-break: break-word;
}

.container { max-width: 1140px; }

/* ---------------- Buttons ---------------- */
.btn { border-radius: 8px; font-weight: 600; padding: 0.6rem 1.25rem; transition: all 0.15s ease; }
.btn:focus { box-shadow: none; }

.btn-primary-orange {
    background: var(--sce-orange);
    color: var(--sce-white);
    border: 1px solid var(--sce-orange);
}
.btn-primary-orange:hover {
    background: #e65f00;
    border-color: #e65f00;
    color: var(--sce-white);
}

.btn-outline-navy {
    background: var(--sce-white);
    color: var(--sce-navy);
    border: 1px solid var(--sce-navy);
}
.btn-outline-navy:hover { background: var(--sce-navy); color: var(--sce-white); }

.btn-outline-electric {
    background: var(--sce-white);
    color: var(--sce-electric);
    border: 1px solid var(--sce-electric);
}
.btn-outline-electric:hover { background: var(--sce-electric); color: var(--sce-white); }

/* ---------------- Public header ---------------- */
.public-header {
    background: var(--sce-white);
    border-bottom: 1px solid var(--sce-border);
    padding: 18px 0;
}
.public-header-inner {
    display: flex;
    align-items: center;
    gap: 14px;
}
.brand-logo img { height: 40px; width: auto; display: block; }
.header-tagline {
    color: var(--sce-text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    padding-left: 14px;
    border-left: 1px solid var(--sce-border);
}

/* ---------------- Tracking hero ---------------- */
.tracking-hero {
    background: linear-gradient(180deg, #F6F8FB 0%, #FFFFFF 100%);
    padding: 64px 0 40px;
    text-align: center;
}
.tracking-hero-inner { max-width: 640px; margin: 0 auto; }
.tracking-hero-title {
    font-size: 2.25rem;
    margin-bottom: 12px;
}
.tracking-hero-sub {
    color: var(--sce-text-muted);
    font-size: 1.05rem;
    margin-bottom: 32px;
}

.tracking-form-row {
    display: flex;
    gap: 10px;
    background: var(--sce-white);
    padding: 8px;
    border-radius: 12px;
    box-shadow: var(--sce-shadow-md);
    border: 1px solid var(--sce-border);
}
.tracking-input {
    border: none;
    padding: 14px 16px;
    font-size: 1rem;
    flex: 1;
    border-radius: 8px;
}
.tracking-input:focus { box-shadow: none; outline: none; }

.tracking-submit-btn {
    background: var(--sce-orange);
    color: var(--sce-white);
    border: none;
    padding: 14px 28px;
    font-size: 1rem;
    white-space: nowrap;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.tracking-submit-btn:hover { background: #e65f00; color: var(--sce-white); }
.tracking-submit-btn:disabled { opacity: 0.7; cursor: not-allowed; }

.btn-spinner {
    width: 16px; height: 16px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: var(--sce-white);
    border-radius: 50%;
    animation: sce-spin 0.7s linear infinite;
    display: inline-block;
}
@keyframes sce-spin { to { transform: rotate(360deg); } }

.tracking-form-hint {
    margin-top: 14px;
    font-size: 0.85rem;
    color: var(--sce-text-muted);
}

/* ---------------- Empty / invalid states ---------------- */
.tracking-result-section { padding: 24px 0 72px; }

.empty-state, .invalid-state {
    text-align: center;
    padding: 56px 20px;
    max-width: 460px;
    margin: 0 auto;
    color: var(--sce-text-muted);
}
.empty-state-icon, .invalid-state-icon {
    font-size: 2.4rem;
    color: var(--sce-electric);
    margin-bottom: 14px;
}
.invalid-state-icon { color: var(--sce-orange); }
.invalid-state h2 { font-size: 1.3rem; margin-bottom: 8px; }

/* ---------------- Result card ---------------- */
.result-card {
    background: var(--sce-white);
    border: 1px solid var(--sce-border);
    border-radius: var(--sce-radius);
    box-shadow: var(--sce-shadow);
    padding: 28px;
    margin-bottom: 24px;
}

.result-top {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    border-bottom: 1px solid var(--sce-border);
    padding-bottom: 20px;
    margin-bottom: 20px;
}
.result-top-heading { font-size: 0.85rem; color: var(--sce-text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }
.result-tracking-id { font-size: 1.4rem; font-weight: 700; color: var(--sce-navy); }
.result-route {
    font-size: 1rem;
    color: var(--sce-text);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}
.result-expected { color: var(--sce-text-muted); font-size: 0.9rem; margin-top: 4px; }

/* ---------------- Status badges ---------------- */
.status-badge {
    display: inline-block;
    padding: 5px 14px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}
.badge-blue     { background: #E6F0FD; color: var(--sce-navy); }
.badge-electric { background: #E3F6FF; color: #007CB4; }
.badge-orange   { background: #FFEDE0; color: #C24E00; }
.badge-gold     { background: #FFF4DB; color: #966300; }
.badge-green    { background: #E4F7EA; color: #157A3E; }
.badge-red      { background: #FDE7E7; color: #B42318; }
.badge-gray     { background: #EEF1F5; color: #475467; }

/* ---------------- Progress steps ---------------- */
.progress-steps {
    display: flex;
    justify-content: space-between;
    position: relative;
    margin: 28px 0 8px;
}
.progress-steps::before {
    content: '';
    position: absolute;
    top: 11px;
    left: 20px;
    right: 20px;
    height: 2px;
    background: var(--sce-border);
    z-index: 0;
}
.progress-step {
    position: relative;
    z-index: 1;
    text-align: center;
    flex: 1;
    font-size: 0.72rem;
    color: var(--sce-text-muted);
    font-weight: 600;
}
.progress-step-dot {
    width: 22px; height: 22px;
    margin: 0 auto 8px;
    border-radius: 50%;
    background: var(--sce-white);
    border: 2px solid var(--sce-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: var(--sce-text-muted);
}
.progress-step.done .progress-step-dot { background: var(--sce-electric); border-color: var(--sce-electric); color: var(--sce-white); }
.progress-step.current .progress-step-dot { background: var(--sce-orange); border-color: var(--sce-orange); color: var(--sce-white); box-shadow: 0 0 0 4px rgba(255,107,0,0.15); }
.progress-step.done, .progress-step.current { color: var(--sce-navy); }

.exception-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #FFF4DB;
    border: 1px solid #FFE1A6;
    color: #7A4E00;
    padding: 12px 16px;
    border-radius: 8px;
    font-weight: 600;
    margin: 20px 0 8px;
}
.exception-banner.is-red { background: #FDE7E7; border-color: #F6C6C6; color: #92251E; }

/* ---------------- Detail grid ---------------- */
.result-section-title { font-size: 1.05rem; margin: 28px 0 14px; }
.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px 24px;
}
.detail-item { display: flex; flex-direction: column; gap: 2px; }
.detail-label { font-size: 0.78rem; color: var(--sce-text-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.detail-value { font-size: 0.98rem; font-weight: 600; color: var(--sce-text); }

/* ---------------- Public timeline ---------------- */
.timeline {
    position: relative;
    padding-left: 28px;
    margin-top: 10px;
}
.timeline-item {
    position: relative;
    padding-bottom: 26px;
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
    content: '';
    position: absolute;
    left: -22px;
    top: 4px;
    bottom: -4px;
    width: 2px;
    background: var(--sce-border);
}
.timeline-item:last-child::before { display: none; }
.timeline-dot {
    position: absolute;
    left: -28px;
    top: 2px;
    width: 12px; height: 12px;
    border-radius: 50%;
    background: var(--sce-electric);
    border: 2px solid var(--sce-white);
    box-shadow: 0 0 0 2px var(--sce-electric);
}
.timeline-status { font-weight: 700; color: var(--sce-navy); font-size: 0.98rem; }
.timeline-datetime { font-size: 0.82rem; color: var(--sce-text-muted); margin: 2px 0 4px; }
.timeline-desc { font-size: 0.92rem; color: var(--sce-text); }
.timeline-location { font-size: 0.85rem; color: var(--sce-text-muted); }

/* ---------------- Footer ---------------- */
.public-footer {
    background: var(--sce-deep-blue);
    color: #C7D4E8;
    padding: 40px 0 26px;
    margin-top: 40px;
}
.footer-inner { text-align: center; }
.footer-logo { height: 30px; filter: brightness(0) invert(1); margin-bottom: 10px; }
.footer-tagline { color: var(--sce-white); font-weight: 600; margin-bottom: 12px; }
.footer-note { max-width: 520px; margin: 0 auto 16px; font-size: 0.88rem; color: #A9BBD6; }
.footer-copyright { font-size: 0.8rem; color: #8CA1C4; }

/* ---------------- Responsive ---------------- */
@media (max-width: 767px) {
    .tracking-hero { padding: 40px 0 24px; }
    .tracking-hero-title { font-size: 1.6rem; }
    .tracking-form-row { flex-direction: column; }
    .tracking-submit-btn { width: 100%; }
    .detail-grid { grid-template-columns: 1fr; }
    .result-card { padding: 20px; }
    .progress-steps { display: none; }
    .result-top { flex-direction: column; }
}

@media (max-width: 400px) {
    .tracking-hero-title { font-size: 1.4rem; }
    .result-tracking-id { font-size: 1.15rem; }
}
