/* MSA Shipping Portal – Brand styles */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap');

/* ── CSS Variables ─────────────────────────────────────── */
:root {
    --brand-primary: #0f172a;
    --brand-accent:  #2563eb;
    --brand-blue:    #1e40af;
    --text-strong:   #0b162a;
    --muted:         #64748b;
    --card-border:   #e2e8f0;
    --card-surface:  #ffffff;
    --page-bg:       #f8fafc;
}

:root[data-theme="dark"] {
    --brand-primary: #60a5fa;
    --brand-accent:  #3b82f6;
    --text-strong:   #e2e8f0;
    --muted:         #94a3b8;
    --card-border:   #1f2a44;
    --card-surface:  #0f172a;
    --page-bg:       #0b1220;
}

/* ── Base ──────────────────────────────────────────────── */
body {
    font-family: 'Inter', sans-serif;
    background: var(--page-bg);
    color: var(--text-strong);
    transition: background .3s ease, color .3s ease;
}

/* ── Bootstrap color overrides ─────────────────────────── */
:root {
    --bs-primary:            #1e40af;
    --bs-primary-rgb:        30, 64, 175;
    --bs-link-color:         #1e40af;
    --bs-link-hover-color:   #1d4ed8;
}

.btn-outline-primary {
    --bs-btn-color:           #1e40af;
    --bs-btn-border-color:    #1e40af;
    --bs-btn-hover-bg:        #1e40af;
    --bs-btn-hover-border-color: #1e40af;
    --bs-btn-active-bg:       #1e3a8a;
}

/* ── Nav shell ─────────────────────────────────────────── */
.nav-shell {
    backdrop-filter: blur(16px);
    background: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid rgba(226, 232, 240, 0.9);
    position: sticky;
    top: 0;
    z-index: 1030;
    transition: border-color .3s ease, box-shadow .3s ease;
}

.nav-shell.scrolled {
    border-color: rgba(37, 99, 235, 0.25);
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.08);
}

:root[data-theme="dark"] .nav-shell {
    background: rgba(15, 23, 42, 0.92);
    border-color: rgba(31, 41, 55, 0.9);
}

:root[data-theme="dark"] .nav-shell.scrolled {
    border-color: rgba(96, 165, 250, 0.35);
}

.nav-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 68px;
}

/* ── Scrolling titles ──────────────────────────────────── */
.scrolling-container {
    position: relative;
    height: 2rem;
    width: 180px;
    overflow: hidden;
    display: flex;
    align-items: center;
}

.scrolling-text {
    position: absolute;
    width: 100%;
    font-size: 0.85rem;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: #041a4a;
    line-height: 1;
    opacity: 0;
    animation: scrollUp 8s infinite;
}

:root[data-theme="dark"] .scrolling-text { color: #cbd5ff; }

.title-1 { animation-delay: 0s; }
.title-2 { animation-delay: 2s; }
.title-3 { animation-delay: 4s; }
.title-4 { animation-delay: 6s; }

@keyframes scrollUp {
    0%   { transform: translateY(100%);  opacity: 0; }
    10%  { transform: translateY(0);     opacity: 1; }
    20%  { transform: translateY(0);     opacity: 1; }
    25%  { transform: translateY(-100%); opacity: 0; }
    100% { transform: translateY(-100%); opacity: 0; }
}

/* ── Desktop nav links ─────────────────────────────────── */
.nav-links {
    display: none;
    align-items: center;
    gap: 1.75rem;
}

@media (min-width: 768px) { .nav-links { display: flex; } }

.nav-link {
    position: relative;
    padding-bottom: 6px;
    font-weight: 600;
    font-size: 0.875rem;
    color: #1f2937;
    text-decoration: none;
    transition: color .2s ease;
}

:root[data-theme="dark"] .nav-link { color: #e2e8f0; }

.nav-link::after {
    content: '';
    position: absolute;
    left: 0; bottom: 0;
    width: 100%; height: 2px;
    background: linear-gradient(90deg, #1e40af, #3b82f6);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .25s ease;
}

.nav-link:hover,
.nav-link.active        { color: #1e40af; }

:root[data-theme="dark"] .nav-link:hover,
:root[data-theme="dark"] .nav-link.active { color: #60a5fa; }

.nav-link:hover::after,
.nav-link.active::after { transform: scaleX(1); }

/* ── Theme toggle ──────────────────────────────────────── */
.theme-toggle {
    width: 40px; height: 40px;
    border-radius: 999px;
    border: 1px solid rgba(226, 232, 240, 0.9);
    background: rgba(255, 255, 255, 0.7);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #1e40af;
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.theme-toggle:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.12);
}

.theme-toggle.is-dark {
    border-color: rgba(96, 165, 250, 0.55);
    background: rgba(37, 99, 235, 0.16);
    color: #60a5fa;
}

.theme-toggle.compact { width: 36px; height: 36px; }

/* ── Mobile menu button ────────────────────────────────── */
.mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px; height: 40px;
    border: none; background: none;
    color: #4b5563;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0;
}

:root[data-theme="dark"] .mobile-menu-btn { color: #e2e8f0; }
@media (min-width: 768px) { .mobile-menu-btn { display: none; } }

.mobile-nav-extras {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
@media (min-width: 768px) { .mobile-nav-extras { display: none; } }

/* ── Mobile panel ──────────────────────────────────────── */
.mobile-panel {
    display: none;
    background: #ffffff;
    border-top: 1px solid rgba(226, 232, 240, 0.9);
    padding: 0.5rem 1rem 1rem;
}

.mobile-panel.open { display: block; }

:root[data-theme="dark"] .mobile-panel {
    background: rgba(15, 23, 42, 0.96);
    border-color: rgba(96, 165, 250, 0.22);
}

.mobile-panel a {
    display: block;
    padding: 0.65rem 0;
    font-weight: 600;
    font-size: 0.9rem;
    color: #1f2937;
    text-decoration: none;
    border-bottom: 1px solid rgba(226, 232, 240, 0.5);
}

.mobile-panel a:last-child { border-bottom: none; }

:root[data-theme="dark"] .mobile-panel a {
    color: #e2e8f0;
    border-color: rgba(96, 165, 250, 0.1);
}

.mobile-panel a.active,
.mobile-panel a:hover { color: #1e40af; }

:root[data-theme="dark"] .mobile-panel a.active,
:root[data-theme="dark"] .mobile-panel a:hover { color: #60a5fa; }

/* ── Scroll-to-top ─────────────────────────────────────── */
.scroll-top {
    position: fixed;
    right: 1rem; bottom: 1rem;
    z-index: 1050;
    width: 48px; height: 48px;
    border-radius: 999px;
    border: 1px solid rgba(226, 232, 240, 0.9);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1e40af;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease, transform .25s ease, box-shadow .2s ease;
    cursor: pointer;
}

.scroll-top.visible { opacity: 1; pointer-events: auto; }

.scroll-top:hover {
    transform: translateY(-2px);
    box-shadow: 0 22px 50px rgba(15, 23, 42, 0.16);
}

:root[data-theme="dark"] .scroll-top {
    background: rgba(15, 23, 42, 0.92);
    border-color: rgba(96, 165, 250, 0.28);
    color: #e2e8f0;
}

/* ── Dark mode: Bootstrap component overrides ──────────── */
:root[data-theme="dark"] .table {
    --bs-table-bg:          #1a2540;
    --bs-table-striped-bg:  #243560;
    --bs-table-hover-bg:    #223057;
    --bs-table-border-color: #1f2a44;
    color: #e2e8f0;
}

:root[data-theme="dark"] .table thead th {
    background: #0f172a;
    color: #94a3b8;
}

:root[data-theme="dark"] .alert-warning {
    background-color: #2a1f00;
    border-color: #7c5800;
    color: #fbbf24;
}

:root[data-theme="dark"] .spinner-border { color: #60a5fa; }

:root[data-theme="dark"] .container-fluid { color: #e2e8f0; }

/* ── Result branch header (matches brand) ──────────────── */
.result-branch-header {
    background: #1e40af;
    color: #fff;
    font-weight: 600;
    padding: 0.35rem 0.75rem;
    margin-bottom: 0.75rem;
    border-radius: 4px;
    font-size: 0.9rem;
}

/* ── Footer ────────────────────────────────────────────── */
.portal-footer {
    background: #0f172a;
    color: #94a3b8;
    padding: 2.5rem 1rem 1rem;
    margin-top: 3rem;
    font-size: 0.875rem;
}

.portal-footer .footer-inner {
    max-width: 1280px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 640px)  { .portal-footer .footer-inner { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1024px) { .portal-footer .footer-inner { grid-template-columns: 2fr 1fr 1fr; } }

.portal-footer h4 {
    color: #fff;
    font-weight: 600;
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
}

.portal-footer a {
    color: #94a3b8;
    text-decoration: none;
    transition: color .2s;
}

.portal-footer a:hover { color: #fff; }

.portal-footer ul {
    list-style: none;
    padding: 0; margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.portal-footer .footer-bottom {
    max-width: 1280px;
    margin: 1.5rem auto 0;
    padding-top: 1.25rem;
    border-top: 1px solid #1f2937;
    text-align: center;
    font-size: 0.8rem;
}

.portal-footer .social-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px; height: 34px;
    border-radius: 999px;
    background: #1f2937;
    color: #94a3b8;
    margin-right: 0.4rem;
    transition: background .2s, color .2s;
    text-decoration: none;
}

.portal-footer .social-btn:hover {
    background: #1e40af;
    color: #fff;
}
