@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600;700&display=swap');

:root {
    /* Colour */
    --ink: #101826;
    --ink-soft: #1c2740;
    --rail-blue: #1f5299;
    --rail-blue-dark: #163c73;
    --signal-amber: #d97f1e;
    --signal-amber-bg: #fdf1e0;
    --track-green: #226b4c;
    --track-green-bg: #e5f4ec;
    --alert-red: #b8392f;
    --alert-red-bg: #fbe8e6;
    --paper: #f5f3ee;
    --surface: #ffffff;
    --line: #e3ddce;
    --line-strong: #cfc7b2;
    --ash: #5b6472;
    --ash-light: #8c93a0;

    /* Type */
    --font-display: 'Space Grotesk', 'Segoe UI', sans-serif;
    --font-mono: 'IBM Plex Mono', 'Consolas', monospace;

    /* Shape & motion */
    --radius-s: 8px;
    --radius-m: 14px;
    --radius-l: 22px;
    --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
    --shadow-card: 0 1px 2px rgba(16, 24, 38, 0.04), 0 8px 24px -12px rgba(16, 24, 38, 0.18);
    --shadow-lift: 0 14px 32px -14px rgba(16, 24, 38, 0.28);
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}

/* ==========================================================================
   Reset & base
   ========================================================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    background:
        radial-gradient(1200px 500px at 50% -120px, rgba(31, 82, 153, 0.08), transparent 60%),
        var(--paper);
    color: var(--ink);
    font-family: var(--font-display);
    font-size: 15.5px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    padding: 28px 16px 0;
    min-height: 100vh;
}

a { color: inherit; }

button, input {
    font-family: inherit;
}

::selection {
    background: var(--rail-blue);
    color: #fff;
}

:focus-visible {
    outline: 2.5px solid var(--rail-blue);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ==========================================================================
   Shell
   ========================================================================== */

.container {
    max-width: 880px;
    margin: 0 auto;
    background: var(--surface);
    padding: 0 0 8px;
    border-radius: var(--radius-l);
    box-shadow: var(--shadow-lift);
    border: 1px solid var(--line);
    overflow: hidden;
}

@media (max-width: 480px) {
    body { padding: 0; }
    .container {
        border-radius: 0;
        border: none;
        box-shadow: none;
        min-height: 100vh;
    }
}

/* ---- Header / masthead --------------------------------------------------- */

h1 {
    background: linear-gradient(150deg, var(--ink) 0%, var(--ink-soft) 100%);
    color: #fff;
    margin: 0;
    padding: 26px 24px 22px;
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 10px;
    font-weight: 600;
    letter-spacing: 0.2px;
    position: relative;
}

h1::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 4px;
    background: linear-gradient(90deg, #ff9933 0 33.33%, #f7f7f7 33.33% 66.66%, #128a3e 66.66% 100%);
}

.brand {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.2px;
}

.flag-text {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1.5px;
    color: rgba(255, 255, 255, 0.55);
    align-self: center;
}

/* ==========================================================================
   Tabs — platform indicator strip
   ========================================================================== */

.tabs-wrapper {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    background: var(--ink);
    scrollbar-width: none;
}

.tabs-wrapper::-webkit-scrollbar { display: none; }

.tabs {
    display: flex;
    min-width: min-content;
    padding: 0 8px;
}

.tab-button {
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 14px 18px 12px;
    cursor: pointer;
    font-family: var(--font-display);
    font-size: 14.5px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.55);
    white-space: nowrap;
    flex-shrink: 0;
    transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.tab-button:hover {
    color: rgba(255, 255, 255, 0.85);
}

.tab-button.active {
    color: #fff;
    border-bottom-color: var(--signal-amber);
}

.tab-content {
    display: none;
    padding: 22px 20px 8px;
}

.tab-content.active {
    display: block;
    animation: riseIn 0.35s var(--ease);
}

@keyframes riseIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Search / form controls
   ========================================================================== */

.search-box {
    padding-top:20px;
    position: relative;
    max-width: 600px;
    width: 100%;
    margin: 0 auto 22px;
    display: flex;
    gap: 10px;
    z-index: 40;
}

input[type="text"],
input[type="number"],
input[type="date"] {
    font-family: var(--font-mono);
    font-size: 15px;
    letter-spacing: 0.2px;
    flex: 1 1 0%;
    padding: 13px 16px;
    border: 1.5px solid var(--line-strong);
    border-radius: var(--radius-s);
    background: var(--surface);
    color: var(--ink);
    transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
    -webkit-appearance: none;
    appearance: none;
}

input[type="text"]::placeholder,
input[type="number"]::placeholder {
    font-family: var(--font-display);
    color: var(--ash-light);
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="date"]:focus {
    outline: none;
    border-color: var(--rail-blue);
    box-shadow: 0 0 0 3px rgba(31, 82, 153, 0.15);
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

.input-error,
#pnrNumber.shake {
    animation: shake 0.4s var(--ease);
    border-color: var(--alert-red) !important;
    background-color: var(--alert-red-bg) !important;
}

button {
    background: var(--rail-blue);
    color: #fff;
    border: none;
    padding: 13px 22px;
    border-radius: var(--radius-s);
    cursor: pointer;
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 600;
    transition: background-color 0.2s var(--ease), transform 0.2s var(--ease);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 100px;
}

button:hover { background: var(--rail-blue-dark); }
button:active { transform: scale(0.98); }

button.loading {
    pointer-events: none;
    opacity: 0.85;
}

.spinner {
    display: none;
    width: 15px;
    height: 15px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.8s linear infinite;
}

button.loading .spinner { display: inline-block; }

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

.button-text { transition: opacity 0.2s; }
button.loading .button-text { opacity: 0.75; }

/* ---- Autocomplete suggestions ---- */

.suggestions-container {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 300px;
    overflow-y: auto;
    background: var(--surface);
    border: 1.5px solid var(--line-strong);
    border-top: none;
    border-radius: 0 0 var(--radius-s) var(--radius-s);
    box-shadow: var(--shadow-card);
    z-index: 45;
    display: none;
    margin-top: -1px;
}

.suggestion-item {
    padding: 10px 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--line);
    transition: background-color 0.15s;
}

.suggestion-item:last-child { border-bottom: none; }

.suggestion-item:hover,
.suggestion-item.selected {
    background-color: var(--paper);
}

.suggestion-item .train-number,
.train-number-badge {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--rail-blue-dark);
    background: rgba(31, 82, 153, 0.09);
    padding: 3px 9px;
    border-radius: 6px;
    margin-right: 10px;
    font-size: 13px;
}

.suggestion-item .train-name {
    color: var(--ash);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==========================================================================
   Between-stations panel
   ========================================================================== */

.btw-search-container {
    max-width: 620px;
    margin: 0 auto 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 22px;
    background: var(--paper);
    border-radius: var(--radius-m);
    border: 1px solid var(--line);
}

.btw-stations-container {
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

.btw-stations-container .station-input-group { flex: 1; }

.station-input-group {
    display: flex;
    flex-direction: column;
    gap: 7px;
    position: relative;
}

.station-input-group label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ash);
}

.station-input-group input { width: 100%; }

#swapStationsBtn {
    background: var(--surface);
    color: var(--rail-blue-dark);
    border: 1.5px solid var(--line-strong);
    font-size: 13px;
    padding: 12px 14px;
    min-width: 0;
    flex-shrink: 0;
    margin-bottom: 1px;
}

#swapStationsBtn:hover {
    background: var(--paper);
    color: var(--rail-blue-dark);
}

.btw-search-button { margin-top: 4px; }

@media (max-width: 640px) {
    .btw-stations-container {
        flex-direction: column;
        align-items: stretch;
    }

    #swapStationsBtn {
        align-self: center;
        margin: -2px 0;
    }
}

.btw-result { margin-top: 20px; }

.error,
.error-message {
    color: var(--alert-red);
    background: var(--alert-red-bg);
    padding: 13px 16px;
    border-radius: var(--radius-s);
    border-left: 4px solid var(--alert-red);
    font-size: 14px;
}

.loading {
    text-align: center;
    color: var(--ash);
    padding: 20px;
    font-style: normal;
}

/* ==========================================================================
   Ticket-stub card — the signature element
   Used for train summary headers, station cards and PNR summaries.
   A soft die-cut notch on either edge gives it a rail-ticket identity.
   ========================================================================== */

.train-header,
.station-card,
.pnr-status-card,
.train-card,
.train-info-header,
.current-status-card,
.train-status-card,
.station-info-container,
.info-card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-m);
    box-shadow: var(--shadow-card);
    padding: 20px;
    margin-bottom: 16px;
}

.train-header::before,
.train-header::after,
.pnr-status-card::before,
.pnr-status-card::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 18px;
    height: 18px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 50%;
    transform: translateY(-50%);
}

.train-header::before,
.pnr-status-card::before { left: -10px; }
.train-header::after,
.pnr-status-card::after { right: -10px; }

@media (max-width: 480px) {
    .train-header::before, .train-header::after,
    .pnr-status-card::before, .pnr-status-card::after {
        display: none;
    }
}

.train-header h2 {
    font-size: 21px;
    color: var(--ink);
    text-align: center;
    margin-bottom: 14px;
    font-weight: 600;
}

.train-title-section { margin-bottom: 22px; }

.train-header-top { display: flex; flex-direction: column; gap: 14px; }

.route-segment {
    flex: 1;
    min-width: 160px;
    background: var(--paper);
    padding: 14px 16px;
    border-radius: var(--radius-s);
    border: 1px solid var(--line);
}

.train-route,
.train-route-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.station-code {
    display: inline-block;
    font-family: var(--font-mono);
    background: var(--ink);
    color: #fff;
    padding: 3px 8px;
    border-radius: 5px;
    font-size: 12.5px;
    font-weight: 600;
    margin-right: 6px;
    letter-spacing: 0.4px;
}

.station-name {
    font-weight: 600;
    color: var(--ink);
}

.station-time {
    display: block;
    font-family: var(--font-mono);
    font-size: 17px;
    font-weight: 600;
    color: var(--ink);
    margin-top: 8px;
}

.route-arrow {
    font-size: 20px;
    color: var(--ash-light);
    flex-shrink: 0;
}

.train-details,
.train-details-grid {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px 22px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px dashed var(--line-strong);
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13.5px;
    color: var(--ash);
}

.detail-item span:last-child,
.detail-value {
    font-family: var(--font-mono);
    color: var(--ink);
    font-weight: 600;
}

.detail-label { font-weight: 500; color: var(--ash); }

/* ==========================================================================
   Route timeline (route tab)
   ========================================================================== */

.stations-container { display: flex; flex-direction: column; gap: 0; }

.station-card {
    display: flex;
    gap: 14px;
    padding: 16px 16px 16px 6px;
    border: none;
    box-shadow: none;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    margin-bottom: 0;
    animation: none;
    opacity: 1;
}

.station-card::before,
.station-card::after { display: none; }

.station-card:last-child { border-bottom: none; }

.station-timeline {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 14px;
    flex-shrink: 0;
}

.timeline-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--surface);
    border: 2.5px solid var(--rail-blue);
    margin-top: 5px;
    flex-shrink: 0;
}

.timeline-line {
    width: 2px;
    flex: 1;
    background: var(--line-strong);
    margin-top: 3px;
}

.station-card .station-details {
    background: none;
    border: none;
    box-shadow: none;
    padding: 0;
    flex: 1;
}

.station-card .station-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 8px;
}

.station-card .station-header h3.station-name {
    font-size: 15.5px;
    font-weight: 600;
    color: var(--ink);
}

.station-distance {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--ash);
    background: var(--paper);
    padding: 2px 8px;
    border-radius: 10px;
    flex-shrink: 0;
}

.station-times {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.time-block { min-width: 70px; }

.time-label {
    display: block;
    font-size: 11px;
    color: var(--ash-light);
    font-weight: 600;
    letter-spacing: 0.3px;
    margin-bottom: 2px;
}

.time {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--ink);
    font-size: 14.5px;
}

.day-separator {
    display: flex;
    align-items: center;
    margin: 14px 0;
    color: var(--ash);
    font-size: 12.5px;
    font-weight: 600;
}

.day-separator::before,
.day-separator::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--line);
}

.day-text {
    background: var(--paper);
    padding: 3px 12px;
    border-radius: 10px;
    border: 1px solid var(--line);
    margin: 0 10px;
    white-space: nowrap;
    font-family: var(--font-mono);
}

/* ==========================================================================
   Live tracking
   ========================================================================== */

.date-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin: 0 auto 22px;
    padding: 14px 18px;
    max-width: 600px;
    background: var(--paper);
    border-radius: var(--radius-m);
    border: 1px solid var(--line);
}

.date-selector label {
    font-size: 14px;
    font-weight: 600;
    color: var(--ash);
    white-space: nowrap;
}

.date-selector input[type="date"] { min-width: 190px; }

.train-info-header .train-title h2 {
    font-size: 20px;
    margin-bottom: 6px;
}

.train-info-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.train-info-header .train-title { flex: 1; min-width: 200px; }

.train-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 12px;
    width: 100%;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px dashed var(--line-strong);
}

.meta-item { display: flex; flex-direction: column; gap: 2px; }

.meta-label {
    font-size: 11px;
    color: var(--ash-light);
    font-weight: 600;
    text-transform: none;
}

.meta-item span:last-child {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--ink);
}

.refresh-button {
    background: var(--ink);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 17px;
    width: 42px;
    height: 42px;
    min-width: 0;
    padding: 0;
    border-radius: 50%;
    transition: transform 0.2s var(--ease), background 0.2s var(--ease);
}

.refresh-button:hover { background: var(--rail-blue-dark); transform: rotate(45deg); }
.refresh-button.refreshing .refresh-icon { animation: spin 0.8s linear infinite; }

.current-status-card h3,
.station-header-controls h3,
.info-card h3,
.coach-position h4,
.booking-details h4,
.passenger-list h4,
.train-info h4 {
    font-size: 15px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 12px;
}

.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
}

.status-item { display: flex; flex-direction: column; gap: 3px; }

.status-label {
    font-size: 12px;
    color: var(--ash-light);
}

.status-value {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--ink);
}

.train-status-card {
    border-left: 4px solid var(--rail-blue);
}

.status-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    gap: 10px;
}

.status-header h3 { margin: 0; font-size: 16px; }

.status-badge,
.total-train-badge,
.train-number-badge,
.day-badge,
.arrived-badge,
.station-status,
.coach {
    display: inline-block;
}

.status-badge {
    padding: 4px 11px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.status-badge::before {
    content: '● ';
    font-size: 8px;
}

.status-badge.on-time,
.status-badge.cnf {
    background: var(--track-green-bg);
    color: var(--track-green);
}

.status-badge.delayed,
.status-badge.wl {
    background: var(--signal-amber-bg);
    color: var(--signal-amber);
}

.status-badge.cancelled {
    background: var(--alert-red-bg);
    color: var(--alert-red);
}

.status-badge.rac {
    background: #eef1fb;
    color: var(--rail-blue-dark);
}

.status-content p { color: var(--ash); margin-bottom: 12px; }

.status-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

.status-details .detail { display: flex; flex-direction: column; gap: 2px; }
.status-details .label { font-size: 12px; color: var(--ash-light); }
.status-details .value { font-family: var(--font-mono); font-weight: 600; color: var(--ink); }

.live-train-info { display: flex; flex-wrap: wrap; gap: 16px; }

.info-card { flex: 1; min-width: 280px; }
.info-card h3 { padding-bottom: 10px; border-bottom: 1px solid var(--line); }

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

.info-item { margin-bottom: 6px; }
.info-label { display: block; font-size: 12px; color: var(--ash-light); margin-bottom: 2px; }
.info-value { font-family: var(--font-mono); font-weight: 600; color: var(--ink); font-size: 14.5px; }

/* ---- station info container (route + non-stop toggle) ---- */

.station-header-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
}

.toggle-switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.toggle-switch input { display: none; }

.toggle-slider {
    position: relative;
    width: 38px;
    height: 20px;
    background: var(--line-strong);
    border-radius: 20px;
    transition: 0.25s;
    flex-shrink: 0;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 15px;
    width: 15px;
    left: 2px;
    top: 2px;
    background: #fff;
    border-radius: 50%;
    transition: 0.25s;
}

.toggle-switch input:checked + .toggle-slider { background: var(--rail-blue); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px); }
.toggle-label { font-size: 13px; color: var(--ash); }

.progress-container { margin-bottom: 20px; }

.progress-bar {
    height: 6px;
    background: var(--line);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
    position: relative;
}

.progress {
    position: absolute;
    inset: 0 auto 0 0;
    height: 100%;
    background: linear-gradient(90deg, var(--rail-blue), var(--track-green));
    width: 0;
    transition: width 0.5s var(--ease);
}

.progress-text {
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: var(--ash);
    text-align: right;
}

.station-list { max-height: 520px; overflow-y: auto; padding-right: 4px; }

.station-list::-webkit-scrollbar { width: 6px; }
.station-list::-webkit-scrollbar-track { background: var(--paper); border-radius: 3px; }
.station-list::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 3px; }

.station-item {
    display: flex;
    gap: 12px;
    padding: 12px 4px;
    border-bottom: 1px solid var(--line);
    transition: background 0.15s;
}

.station-item:hover { background: var(--paper); }
.station-item:last-child { border-bottom: none; }

.station-item .station-timeline { padding-top: 4px; }

.timeline-dot.major { border-color: var(--rail-blue); }
.timeline-dot.minor { border-color: var(--ash-light); width: 8px; height: 8px; }

.station-item.current .timeline-dot { background: var(--rail-blue); }
.station-item.passed .timeline-dot { background: var(--track-green); border-color: var(--track-green); }

.station-title {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}

.station-badges { flex-shrink: 0; }

.station-status {
    font-size: 11.5px;
    padding: 2px 9px;
    border-radius: 10px;
    font-weight: 600;
    background: var(--paper);
    border: 1px solid var(--line);
    color: var(--ash);
    white-space: nowrap;
}

.station-status.current,
.station-item.current .station-status {
    background: rgba(31, 82, 153, 0.1);
    border-color: transparent;
    color: var(--rail-blue-dark);
}

.station-status.departed,
.station-item.passed .station-status {
    background: var(--track-green-bg);
    border-color: transparent;
    color: var(--track-green);
}

.station-status.non-stop {
    background: transparent;
    border-color: var(--line);
    color: var(--ash-light);
}

.station-meta {
    display: flex;
    gap: 14px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.platform-info, .distance-info {
    display: flex;
    align-items: baseline;
    gap: 5px;
    font-size: 12.5px;
}

.platform-label, .distance-label {
    color: var(--ash-light);
}

.platform-number, .distance-value {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--ink);
}

.arrived-badge {
    font-size: 11px;
    font-weight: 600;
    color: var(--track-green);
    background: var(--track-green-bg);
    padding: 2px 8px;
    border-radius: 10px;
}

.non-stop-info { margin-top: 4px; }
.distance-only { font-size: 12.5px; color: var(--ash-light); display: flex; gap: 5px; }
.distance-marker { color: var(--ash-light); }

.pass-through-station { opacity: 0.75; }

/* map card */

#mapContainer { padding: 14px; }
#mapContainer .station-header-controls { margin-bottom: 10px; }
.map-wrapper { border: 1px solid var(--line); }

/* ==========================================================================
   Coach position
   ========================================================================== */

.coach-position {
    margin: 14px 0;
    padding: 14px;
    background: var(--paper);
    border-radius: var(--radius-s);
    border: 1px solid var(--line);
}

.coach-sequence {
    display: flex;
    gap: 7px;
    align-items: center;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    padding-bottom: 6px;
    font-family: var(--font-mono);
}

.coach-sequence::-webkit-scrollbar { height: 6px; }
.coach-sequence::-webkit-scrollbar-track { background: var(--line); border-radius: 4px; }
.coach-sequence::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 4px; }

.coach {
    padding: 5px 11px;
    border-radius: 6px;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    color: var(--ash);
    font-size: 13px;
    font-weight: 600;
}

.coach.allocated {
    background: var(--track-green);
    border-color: var(--track-green);
    color: #fff;
}

.coach.allocated::after { content: ' ✓'; }

/* ==========================================================================
   Between-stations results
   ========================================================================== */

.route-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding-bottom: 18px;
    text-align: center;
}

.route-header h3 { font-size: 17px; color: var(--ink); }

.total-train-badge {
    background: var(--track-green-bg);
    color: var(--track-green);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12.5px;
    font-weight: 600;
}

.trains-container { display: flex; flex-direction: column; gap: 14px; }

.train-card {
    border-left: 4px solid var(--rail-blue);
    transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.train-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lift);
}

.train-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}

.train-primary-info h3 { font-size: 16px; color: var(--ink); margin-bottom: 4px; }

.train-route-info { margin: 14px 0; }

.route-station { flex: 1; min-width: 130px; }
.route-station-name { font-weight: 600; color: var(--ink); font-size: 14.5px; }
.station-timing { margin-top: 3px; }
.station-timing .time { font-size: 13.5px; }

.journey-info { text-align: center; flex-shrink: 0; }
.journey-line { display: none; }

.train-details-grid { text-align: left; justify-content: flex-start; }

.detail-box { display: flex; flex-direction: column; gap: 4px; }
.detail-box-label { font-size: 11px; color: var(--ash-light); font-weight: 600; }
.route-endpoints { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--ink); }

.running-days { display: flex; flex-direction: column; gap: 6px; }
.days-list { display: flex; gap: 4px; }

.day-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 6px;
    border-radius: 5px;
    background: var(--paper);
    color: var(--ash-light);
}

.day-badge.active { background: var(--track-green-bg); color: var(--track-green); }

/* ==========================================================================
   PNR status
   ========================================================================== */

.pnr-status-card { max-width: 100%; margin: 0 0 16px; }

.pnr-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px dashed var(--line-strong);
}

.pnr-header h3 {
    font-family: var(--font-mono);
    font-size: 17px;
    color: var(--ink);
    font-weight: 600;
}

.train-info h4 { font-size: 16px; }

.journey-details {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    color: var(--ash);
    font-size: 13.5px;
    margin-bottom: 14px;
}

.route {
    display: flex;
    align-items: stretch;
    gap: 10px;
    margin: 14px 0;
}

.route .station {
    flex: 1;
    padding: 14px;
    background: var(--paper);
    border-radius: var(--radius-s);
    border: 1px solid var(--line);
}

.route .coach {
    align-self: center;
    background: none;
    border: none;
    color: var(--ash-light);
    font-size: 12px;
    text-align: center;
    min-width: 60px;
}

.boarding-info,
.coach-position,
.booking-details {
    background: var(--paper);
    padding: 14px;
    border-radius: var(--radius-s);
    border: 1px solid var(--line);
    margin-top: 14px;
    font-size: 13.5px;
    color: var(--ash);
}

.boarding-info div { display: flex; gap: 6px; margin: 4px 0; }

.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}

.detail-item { display: flex; flex-direction: column; gap: 2px; }
.detail-label { font-size: 12px; color: var(--ash-light); }
.detail-value { font-family: var(--font-mono); font-size: 14px; color: var(--ink); }

.passenger-list { margin-top: 20px; }
.passenger-list h4 { padding-bottom: 10px; border-bottom: 1px solid var(--line); }

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 13.5px;
}

th, td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--line);
}

th {
    background: var(--paper);
    font-weight: 600;
    color: var(--ash);
    font-size: 11.5px;
    letter-spacing: 0.3px;
}

tr:hover td { background: var(--paper); }

@media (max-width: 768px) {
    table { display: block; overflow-x: auto; }
    .route { flex-direction: column; }
    .route .coach { transform: none; }
}

/* ==========================================================================
   Track button (live location CTA)
   ========================================================================== */

.track-button {
    background: var(--signal-amber);
    color: #fff;
    border: none;
    padding: 9px 16px;
    border-radius: var(--radius-s);
    cursor: pointer;
    font-weight: 600;
    font-size: 13.5px;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.track-button:hover { background: #c06f16; }

.track-button::before { content: '📍'; font-size: 12px; }

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
    margin: 20px 20px 0;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding-bottom: 20px;
}

.footer-left p { margin: 0; font-size: 13.5px; color: var(--ash); }

.footer-left .brand-line:first-child {
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--ink);
    font-size: 14.5px;
    margin-bottom: 3px;
}

.footer-left .brand-line a {
    color: var(--rail-blue-dark);
    font-weight: 600;
    text-decoration: none;
}

.footer-left .brand-line a:hover { text-decoration: underline; }

.footer-right { display: flex; gap: 14px; align-items: center; }

.social-link svg {
    width: 19px;
    height: 19px;
    fill: var(--ash-light);
    transition: fill 0.15s, transform 0.15s;
}

.social-link:hover svg { fill: var(--rail-blue); transform: translateY(-2px); }
.social-link.instagram:hover svg { fill: #c23a7e; }

@media (max-width: 560px) {
    .footer-inner { flex-direction: column; text-align: center; }
}

.copyright-footer {
    text-align: center;
    padding: 14px 0;
    color: var(--ash-light);
    font-size: 12.5px;
    border-top: 1px solid var(--line);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 768px) {
    .search-box { flex-direction: column; }
    .train-route { flex-direction: column; align-items: stretch; }
    .route-arrow { align-self: center; transform: rotate(90deg); }
    .train-route-info { flex-direction: column; align-items: stretch; }
    .journey-line { display: none; }
}

@media (max-width: 480px) {
    h1 { padding: 22px 16px 18px; flex-wrap: wrap; }
    .brand { font-size: 22px; }
    .tab-content { padding: 18px 14px 8px; }
    .train-header, .station-card, .pnr-status-card, .train-card,
    .train-info-header, .current-status-card, .train-status-card,
    .station-info-container, .info-card {
        padding: 16px;
    }
}