:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --secondary: #7c3aed;
    --success: #059669;
    --danger: #dc2626;
    --warning: #d97706;
    --info: #0891b2;
    --dark: #111827;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gradient: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
    --radius: 10px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
    --shadow: 0 4px 12px rgba(0,0,0,.1);
    --shadow-lg: 0 10px 30px rgba(0,0,0,.12);
    --transition: all .25s ease;
}

*,*::before,*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--dark);
    line-height: 1.65;
    background: #fff;
    -webkit-font-smoothing: antialiased;
}

/* ── Top Bar ── */
.top-bar {
    background: var(--dark);
    color: rgba(255,255,255,.6);
    padding: 6px 0;
    font-size: .8rem;
}

/* ── Navbar ── */
#mainNav {
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    z-index: 1040;
}
#mainNav.scrolled { box-shadow: var(--shadow); }

.navbar-brand { font-size: 1.35rem; color: var(--primary) !important; }
.navbar-brand i { color: var(--primary); }

.nav-link {
    font-weight: 500;
    font-size: .92rem;
    color: var(--gray-600) !important;
    padding: .5rem .85rem !important;
    transition: var(--transition);
}
.nav-link:hover, .nav-link.active { color: var(--primary) !important; }

.dropdown-menu {
    border-radius: var(--radius);
    padding: .5rem 0;
    max-height: 400px;
    overflow-y: auto;
}
.dropdown-item { font-size: .9rem; padding: .45rem 1.2rem; }
.dropdown-item:hover { background: var(--primary-light); color: var(--primary); }

/* ── Hero ── */
.hero {
    background: var(--gradient);
    color: #fff;
    padding: 3.5rem 0;
    position: relative;
    overflow: hidden;
}
.hero::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(circle at 20% 80%, rgba(255,255,255,.06) 0%, transparent 50%);
    pointer-events: none;
}
.hero h1 { font-weight: 800; line-height: 1.15; }
.hero .lead { opacity: .9; }

/* ── Search Box ── */
.search-box {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 1.5rem;
    position: relative;
    z-index: 2;
}
.search-box .form-control,
.search-box .form-select {
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    padding: .7rem 1rem;
    font-size: .95rem;
}
.search-box .form-control:focus,
.search-box .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}

.suggestions-dropdown {
    position: absolute;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-top: none;
    border-radius: 0 0 8px 8px;
    z-index: 1060;
    max-height: 220px;
    overflow-y: auto;
    width: calc(100% - 2rem);
    box-shadow: var(--shadow);
}
.suggestion-item {
    padding: .6rem 1rem;
    cursor: pointer;
    font-size: .9rem;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    gap: .5rem;
}
.suggestion-item:hover { background: var(--primary-light); color: var(--primary); }
.suggestion-item .line-badge {
    font-size: .7rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--gray-100);
    color: var(--gray-600);
    white-space: nowrap;
}

/* ── Cards ── */
.card {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    transition: var(--transition);
}
.card-hover:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

.stat-card {
    text-align: center;
    padding: 1.5rem 1rem;
    border-radius: var(--radius);
    background: #fff;
    border: 1px solid var(--gray-200);
}
.stat-card .stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
}
.stat-card .stat-label {
    font-size: .82rem;
    color: var(--gray-500);
    margin-top: .3rem;
}

/* ── Info Metric ── */
.info-metric {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 1rem;
    transition: var(--transition);
}
.info-metric:hover { border-color: var(--primary-light); }
.info-metric .metric-label { font-size: .78rem; color: var(--gray-500); margin-bottom: .25rem; }
.info-metric .metric-value { font-size: 1.25rem; font-weight: 700; color: var(--primary); }

/* ── Route Timeline ── */
.route-timeline { position: relative; padding-left: 34px; }
.route-stop { position: relative; padding-bottom: 1.25rem; }
.route-stop:last-child { padding-bottom: 0; }
.route-stop::before {
    content: '';
    position: absolute;
    left: -20px; top: 22px; bottom: -4px;
    width: 2px;
    background: var(--gray-200);
}
.route-stop:last-child::before { display: none; }
.route-stop .stop-dot {
    position: absolute;
    left: -28px; top: 4px;
    width: 18px; height: 18px;
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 0 0 2px var(--gray-300);
}
.route-stop:first-child .stop-dot { box-shadow: 0 0 0 3px var(--success); background: var(--success); }
.route-stop:last-child .stop-dot  { box-shadow: 0 0 0 3px var(--danger); background: var(--danger); }
.route-stop .stop-name { font-weight: 600; font-size: .95rem; }
.route-stop .stop-meta { font-size: .8rem; color: var(--gray-500); }
.route-stop .interchange-badge {
    display: inline-block;
    font-size: .72rem;
    padding: 2px 8px;
    border-radius: 4px;
    background: #fef3c7;
    color: #92400e;
    font-weight: 600;
}

/* ── Line Colors ── */
.line-dot {
    display: inline-block;
    width: 12px; height: 12px;
    border-radius: 50%;
    margin-right: 6px;
    flex-shrink: 0;
}
.line-strip {
    height: 6px;
    border-radius: 3px;
}

/* ── Badges ── */
.badge-line {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: .75rem;
    font-weight: 600;
}

/* ── Station Grid ── */
.station-link {
    display: flex;
    align-items: center;
    padding: .65rem .85rem;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    text-decoration: none;
    color: var(--dark);
    font-size: .9rem;
    transition: var(--transition);
}
.station-link:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
    transform: translateX(3px);
}
.station-link i { color: var(--gray-400); margin-left: auto; font-size: .7rem; }

/* ── City Card ── */
.city-card {
    display: block;
    text-decoration: none;
    color: var(--dark);
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    padding: 1.25rem;
    transition: var(--transition);
    height: 100%;
}
.city-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
    color: var(--dark);
}
.city-card .city-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
    margin-bottom: .75rem;
}

/* ── Section Headings ── */
.section-heading {
    font-weight: 700;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    position: relative;
    padding-bottom: .75rem;
}
.section-heading::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0;
    width: 50px; height: 3px;
    background: var(--primary);
    border-radius: 2px;
}
.section-heading.text-center::after { left: 50%; transform: translateX(-50%); }

/* ── FAQ ── */
.accordion-button { font-weight: 600; font-size: .95rem; }
.accordion-button:not(.collapsed) { background: var(--primary-light); color: var(--primary); }
.accordion-body { font-size: .9rem; line-height: 1.7; color: var(--gray-600); }

/* ── Footer ── */
.footer { font-size: .88rem; }
.footer h5, .footer h6 { letter-spacing: .02em; }
.footer-links li { margin-bottom: .4rem; }
.footer-links a {
    color: rgba(255,255,255,.5);
    text-decoration: none;
    transition: var(--transition);
    font-size: .85rem;
}
.footer-links a:hover { color: #fff; padding-left: 3px; }

/* ── Ad Container ── */
.ad-container {
    margin: 1.5rem 0;
    text-align: center;
    min-height: 90px;
    overflow: hidden;
}

/* ── Back to Top ── */
#backToTop {
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}
#backToTop.show { opacity: 1; visibility: visible; }

/* ── Swap Button ── */
.swap-btn {
    width: 36px; height: 36px;
    border-radius: 50%;
    border: 2px solid var(--gray-200);
    background: #fff;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    color: var(--gray-500);
}
.swap-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

/* ── Content Article ── */
.content-article { font-size: .95rem; line-height: 1.8; color: var(--gray-700); }
.content-article h2 { font-size: 1.3rem; font-weight: 700; margin: 1.5rem 0 .75rem; color: var(--dark); }
.content-article h3 { font-size: 1.1rem; font-weight: 600; margin: 1.25rem 0 .5rem; color: var(--dark); }
.content-article p { margin-bottom: 1rem; }
.content-article ul, .content-article ol { margin-bottom: 1rem; padding-left: 1.25rem; }
.content-article li { margin-bottom: .35rem; }
.content-article table { width: 100%; margin-bottom: 1rem; border-collapse: collapse; }
.content-article table th,
.content-article table td { padding: .6rem .75rem; border: 1px solid var(--gray-200); font-size: .88rem; }
.content-article table th { background: var(--gray-50); font-weight: 600; }
.content-article table tr:hover { background: var(--gray-50); }

/* ── Table of Contents ── */
.toc {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
}
.toc h6 { font-weight: 700; margin-bottom: .5rem; }
.toc ul { list-style: none; padding: 0; margin: 0; }
.toc li { margin-bottom: .35rem; }
.toc a { color: var(--primary); text-decoration: none; font-size: .88rem; }
.toc a:hover { text-decoration: underline; }

/* ── Responsive ── */
@media (max-width: 991.98px) {
    .hero { padding: 2.5rem 0; }
    .hero h1 { font-size: 1.75rem; }
    .search-box { padding: 1rem; }
    .section-heading { font-size: 1.25rem; }
    .dropdown-menu { max-height: 300px; }
}

@media (max-width: 767.98px) {
    .hero { padding: 2rem 0; }
    .hero h1 { font-size: 1.5rem; }
    .hero .lead { font-size: .95rem; }
    .stat-card .stat-value { font-size: 1.4rem; }
    .info-metric .metric-value { font-size: 1.1rem; }
    .content-article { font-size: .9rem; }
    .ad-container { min-height: 50px; }
}

@media (max-width: 575.98px) {
    .container { padding-left: 1rem; padding-right: 1rem; }
    .search-box { padding: .85rem; }
    .hero h1 { font-size: 1.3rem; }
}

/* ── Print ── */
@media print {
    nav, footer, .ad-container, #backToTop, .top-bar { display: none !important; }
    .hero { background: #fff !important; color: #000 !important; padding: 1rem 0; }
}

/* ── Accessibility ── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}

:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

/* ── Skeleton Loading ── */
.skeleton {
    background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 6px;
}
@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
