/* ===================================
   Nico's Travelling - Dark Theme
   =================================== */

:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --bg-card: #1c2128;
    --border-color: #30363d;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --accent: #1E90FF;
    --accent-hover: #3aa0ff;
    --accent-dim: rgba(30, 144, 255, 0.15);
    --success: #3fb950;
    --warning: #d29922;
    --danger: #f85149;
    --info: #58a6ff;
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    --font-mono: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
    --radius: 8px;
    --radius-sm: 4px;
    --radius-lg: 12px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);
    --transition: 0.2s ease;
}

/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); }

img { max-width: 100%; height: auto; }

/* === Container === */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
}

.container-narrow {
    max-width: 600px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* === Navigation === */
.main-nav {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.nav-brand:hover { color: var(--accent); }
.nav-logo { font-size: 1.3rem; }

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    transition: var(--transition);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.nav-link {
    color: var(--text-secondary);
    padding: 0.4rem 0.7rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    transition: all var(--transition);
}

.nav-link:hover, .nav-link.active {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.nav-link.active { color: var(--accent); }

.nav-user {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: 0.75rem;
    padding-left: 0.75rem;
    border-left: 1px solid var(--border-color);
}

.nav-admin { color: var(--warning); }
.nav-admin:hover { color: var(--warning); background: rgba(210, 153, 34, 0.1); }
.nav-logout { color: var(--danger); }
.nav-logout:hover { color: var(--danger); background: rgba(248, 81, 73, 0.1); }

/* === Flash Messages === */
.flash {
    max-width: 1200px;
    margin: 1rem auto;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: flashIn 0.3s ease;
}

@keyframes flashIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

.flash-info { background: rgba(88, 166, 255, 0.15); border: 1px solid rgba(88, 166, 255, 0.3); color: var(--info); }
.flash-success { background: rgba(63, 185, 80, 0.15); border: 1px solid rgba(63, 185, 80, 0.3); color: var(--success); }
.flash-warning { background: rgba(210, 153, 34, 0.15); border: 1px solid rgba(210, 153, 34, 0.3); color: var(--warning); }
.flash-danger { background: rgba(248, 81, 73, 0.15); border: 1px solid rgba(248, 81, 73, 0.3); color: var(--danger); }

.flash-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0 0.25rem;
    opacity: 0.7;
}
.flash-close:hover { opacity: 1; }

/* === Cards === */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
}

/* === Forms === */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 0.6rem 0.75rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 0.9rem;
    transition: border-color var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.form-control::placeholder { color: var(--text-muted); }

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238b949e' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.product-filter {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.product-filter-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.product-filter-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
    flex-shrink: 0;
}

/* === Toggle Switch === */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 24px;
    flex-shrink: 0;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}
.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    transition: background var(--transition), border-color var(--transition);
}
.toggle-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 3px;
    top: 3px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: transform var(--transition), background var(--transition);
}
.toggle-switch input:checked + .toggle-slider {
    background: var(--accent);
    border-color: var(--accent);
}
.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(18px);
    background: #fff;
}

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 1.2rem;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-family: var(--font-family);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    line-height: 1.4;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); color: #fff; }

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--border-color);
}
.btn-secondary:hover { background: var(--border-color); color: var(--text-primary); }

.btn-danger {
    background: rgba(248, 81, 73, 0.15);
    color: var(--danger);
    border-color: rgba(248, 81, 73, 0.3);
}
.btn-danger:hover { background: rgba(248, 81, 73, 0.25); color: var(--danger); }

.btn-success {
    background: rgba(63, 185, 80, 0.15);
    color: var(--success);
    border-color: rgba(63, 185, 80, 0.3);
}
.btn-success:hover { background: rgba(63, 185, 80, 0.25); color: var(--success); }

.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
.btn-xs { padding: 0.2rem 0.5rem; font-size: 0.75rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; }
.btn-block { width: 100%; }

.btn-group { display: flex; gap: 0.5rem; }

/* === Page Headers === */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
}

/* === Stats Grid === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stats-grid-6 {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    text-align: center;
}

.record-card .record-detail {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

.record-card .record-detail a {
    color: var(--text-secondary);
}

.record-card .record-detail a:hover {
    color: var(--accent);
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--accent);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* === Journey Cards === */
.journey-card {
    display: block;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
    transition: all var(--transition);
    color: var(--text-primary);
}

.journey-card:hover {
    border-color: var(--accent);
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.journey-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.journey-line {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    background: var(--accent-dim);
    color: var(--accent);
}

.journey-line.nationalExpress, .journey-line.national { background: rgba(255, 255, 255, 0.1); color: #fff; }
.journey-line.regionalExpress, .journey-line.regional { background: rgba(220, 50, 50, 0.15); color: #ef4444; }
.journey-line.suburban { background: rgba(34, 197, 94, 0.15); color: #22c55e; }

.journey-date { font-size: 0.8rem; color: var(--text-secondary); }

.journey-status {
    margin-left: auto;
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-sm);
}
.status-active { background: rgba(30, 144, 255, 0.15); color: var(--accent); }
.status-completed { background: rgba(63, 185, 80, 0.15); color: var(--success); }
.status-cancelled { background: rgba(248, 81, 73, 0.15); color: var(--danger); }

.journey-card-body {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.journey-station { display: flex; align-items: baseline; gap: 0.4rem; }
.journey-time { font-weight: 600; font-size: 1rem; }
.journey-delay { color: var(--danger); font-size: 0.8rem; font-weight: 500; }
.journey-name { color: var(--text-secondary); font-size: 0.9rem; }
.journey-arrow { color: var(--text-muted); font-size: 1.2rem; }

.journey-card-footer {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* === Journey Group Cards === */
.journey-group-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
    border-left: 3px solid var(--accent);
}

.journey-group-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.journey-group-lines {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
    flex: 1;
}

.journey-group-overview {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0.5rem;
}

.journey-group-legs {
    padding: 0.25rem 0;
}

.journey-group-leg {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.5rem;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.85rem;
    transition: background var(--transition);
}

.journey-group-leg:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.journey-group-leg .journey-line.small {
    font-size: 0.7rem;
    padding: 0.1rem 0.35rem;
}

.journey-group-leg .journey-name {
    font-size: 0.8rem;
}

.journey-group-leg .journey-time {
    font-size: 0.85rem;
}

.journey-group-leg .journey-arrow {
    font-size: 0.9rem;
}

.journey-group-transfer {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.15rem 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.transfer-icon {
    color: var(--warning, #f59e0b);
}

.transfer-station {
    color: var(--text-secondary);
}

.transfer-wait {
    color: var(--text-muted);
    font-style: italic;
}

.transfer-count {
    color: var(--accent);
    font-weight: 500;
}

.journey-group-leg.current {
    background: var(--accent-dim);
    border-radius: var(--radius-sm);
}

/* === Station Picker === */
.station-picker { position: relative; }

.station-picker-wrapper { position: relative; }

.station-input {
    width: 100%;
    padding: 0.6rem 0.75rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 0.9rem;
}

.station-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.station-suggestions {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    margin-top: 4px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: var(--shadow-lg);
}

.station-suggestions.active { display: block; }

.station-suggestion {
    padding: 0.6rem 0.75rem;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background var(--transition);
    border-bottom: 1px solid var(--border-color);
}

.station-suggestion:last-child { border-bottom: none; }
.station-suggestion:hover { background: var(--bg-tertiary); }

.station-suggestion .station-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* === Tables === */
.table-wrapper { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 0.65rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

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

/* === Login Page === */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.login-box {
    width: 100%;
    max-width: 400px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
}

.login-title {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.login-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.login-logo {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.login-remember {
    margin-bottom: 1rem;
}

.login-remember label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.login-remember input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
    flex-shrink: 0;
}

/* === Departures Board === */
.departure-row {
    display: grid;
    grid-template-columns: 70px 100px 1fr auto;
    gap: 1rem;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    transition: background var(--transition);
}

.departure-row:hover { background: var(--bg-tertiary); }

.departure-time {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.departure-delay { color: var(--danger); font-size: 0.85rem; }

.departure-platform {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* === Search Results === */
.connection-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 0.75rem;
}

.connection-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.connection-legs { margin-bottom: 0.75rem; }

.connection-leg {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.connection-leg:last-child { border-bottom: none; }

/* === Timeline (Journey Detail) === */
.timeline { position: relative; padding-left: 2rem; }

.timeline::before { display: none; }

.timeline-item {
    position: relative;
    padding-bottom: 1.5rem;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -2rem;
    top: 3px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--bg-primary);
    z-index: 1;
}

.timeline-item::after {
    content: '';
    position: absolute;
    left: calc(-2rem + 5px);
    top: 3px;
    bottom: calc(-1.5rem + 9px);
    width: 2px;
    background: var(--border-color);
}

.timeline-item:last-child::after {
    display: none;
}

.timeline-item:first-child::before { background: var(--success); }
.timeline-item:last-child::before { background: var(--danger); }

.timeline-time {
    font-weight: 600;
    font-size: 0.95rem;
}

.timeline-station { color: var(--text-secondary); font-size: 0.9rem; }
.timeline-platform { font-size: 0.8rem; color: var(--text-muted); }

/* === Rail Network Overlay === */
.rail-network-overlay {
    filter: saturate(0) brightness(0.5);
}

/* === Map === */
.map-fullscreen {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 500;
}

.map-filters {
    position: fixed;
    top: 68px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 600;
    display: flex;
    gap: 0.25rem;
    padding: 0.35rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.map-filter {
    padding: 0.3rem 0.7rem;
    font-size: 0.8rem;
    font-family: var(--font-family);
    font-weight: 500;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    background: transparent;
    color: var(--text-muted);
}

.map-filter:hover {
    color: var(--text-secondary);
    background: var(--bg-tertiary);
}

.map-filter.active {
    background: var(--accent-dim);
    color: var(--accent);
    border-color: rgba(30, 144, 255, 0.3);
}

@media (max-width: 768px) {
    .map-filters {
        left: 0.5rem;
        right: 0.5rem;
        transform: none;
        overflow-x: auto;
        justify-content: center;
    }

    .map-filter {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
        white-space: nowrap;
    }
}

.map-container {
    height: 400px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.map-mini {
    height: 250px;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

/* === Charts === */
.chart-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1rem;
}

/* === Friends === */
.friend-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
}

.friend-info { display: flex; align-items: center; gap: 0.75rem; }

.friend-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--accent);
}

/* === Settings === */
.settings-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
}

.settings-section h3 {
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

/* === Checkin Flow === */
.stopover-list { list-style: none; }

.stopover-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background var(--transition);
}

.stopover-item:hover { background: var(--bg-tertiary); }

.stopover-item.selected { background: var(--accent-dim); border-color: var(--accent); }

.stopover-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border-color);
    flex-shrink: 0;
}

.stopover-item.selected .stopover-dot { background: var(--accent); }
.stopover-item.in-range { background: var(--accent-dim); }
.stopover-item.origin { background: rgba(63, 185, 80, 0.1); border-color: var(--success); }
.stopover-item.dest { background: rgba(248, 81, 73, 0.1); border-color: var(--danger); }

/* === Pagination === */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.25rem;
    margin-top: 1.5rem;
}

.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    transition: all var(--transition);
}

.pagination a:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.pagination .active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* === Filter Bar === */
.filter-bar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    align-items: flex-end;
}

.filter-bar .form-group { margin-bottom: 0; }

/* === Badges === */
.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-admin { background: rgba(210, 153, 34, 0.15); color: var(--warning); }
.badge-user { background: rgba(88, 166, 255, 0.15); color: var(--info); }

/* === Empty State === */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-state-icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state-text { font-size: 1.1rem; margin-bottom: 0.5rem; }
.empty-state-sub { font-size: 0.9rem; }

/* === Loading Spinner === */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

.loading-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    gap: 0.75rem;
    color: var(--text-secondary);
}

/* === Tabs === */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
    gap: 0.25rem;
}

.tab {
    padding: 0.6rem 1rem;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition);
}

.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* === QR Code (2FA) === */
.qr-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background: #fff;
    border-radius: var(--radius);
    width: fit-content;
    margin: 0 auto;
}

/* === Profile === */
.profile-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--accent-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
}

.profile-info h1 { font-size: 1.5rem; margin-bottom: 0.25rem; }
.profile-info p { color: var(--text-secondary); }

/* === Responsive === */
@media (max-width: 768px) {
    .nav-toggle { display: flex; }

    .nav-links {
        display: none;
        position: absolute;
        top: 56px;
        left: 0;
        right: 0;
        background: var(--bg-secondary);
        border-bottom: 1px solid var(--border-color);
        flex-direction: column;
        padding: 0.5rem;
        box-shadow: var(--shadow-lg);
    }

    .nav-links.active { display: flex; }

    .nav-user {
        margin-left: 0;
        padding-left: 0;
        border-left: none;
        border-top: 1px solid var(--border-color);
        margin-top: 0.5rem;
        padding-top: 0.5rem;
        flex-wrap: wrap;
    }

    .form-row { grid-template-columns: 1fr; }
    .chart-grid { grid-template-columns: 1fr; }

    .departure-row {
        grid-template-columns: 55px 70px 1fr auto;
        font-size: 0.85rem;
    }

    .journey-card-body { flex-direction: column; gap: 0.25rem; }
    .journey-group-overview { flex-direction: column; gap: 0.25rem; }
    .journey-group-overview .journey-arrow { transform: rotate(90deg); }
    .journey-group-leg { flex-wrap: wrap; }
    .journey-arrow { transform: rotate(90deg); }

    .container { padding: 1rem; }
    .page-header { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .stat-card { padding: 0.75rem; }
    .stat-value { font-size: 1.3rem; }
}

/* === Scrollbar === */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* === Train Search (Zugsuche) === */
.train-result-card {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all var(--transition);
}

.train-result-card:hover {
    border-color: var(--accent);
    background: var(--bg-tertiary);
}

.train-result-card.selected {
    border-color: var(--accent);
    background: var(--accent-dim);
}

.train-result-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    flex-wrap: wrap;
}

.train-result-direction {
    flex: 1;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.train-result-time {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.train-result-platform {
    font-size: 0.85rem;
    color: var(--text-secondary);
    min-width: 60px;
    text-align: right;
}

/* Train Detail */
.train-detail-card {
    margin-top: 1rem;
}

.train-detail-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.train-detail-direction {
    font-size: 1.1rem;
    font-weight: 600;
    flex: 1;
}

.train-detail-operator {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.train-baureihe {
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.15rem 0.5rem;
    white-space: nowrap;
}

/* Remarks */
.train-remarks {
    margin-bottom: 1rem;
}

.train-remark {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    margin-bottom: 0.35rem;
}

.remark-icon {
    flex-shrink: 0;
    font-size: 1rem;
}

.remark-warning, .train-stop-remark.remark-warning {
    background: rgba(210, 153, 34, 0.12);
    color: var(--warning);
}

.remark-status, .train-stop-remark.remark-status {
    background: rgba(88, 166, 255, 0.1);
    color: var(--info);
}

.remark-hint, .train-stop-remark.remark-hint {
    background: rgba(88, 166, 255, 0.1);
    color: var(--info);
}

/* Train Timeline */
.train-timeline {
    padding: 0.5rem 0;
}

.train-stop {
    display: flex;
    gap: 0.75rem;
    min-height: 48px;
}

.train-stop:first-child,
.train-stop:last-child {
    min-height: 28px;
}

.train-stop:last-child .train-stop-content {
    padding-bottom: 0;
}

.train-stop.stop-cancelled {
    opacity: 0.6;
}

.train-stop-line {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 16px;
    flex-shrink: 0;
}

.train-stop-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--text-muted);
    border: 2px solid var(--bg-card);
    flex-shrink: 0;
    z-index: 1;
}

.train-stop-dot.dot-first {
    background: var(--success);
}

.train-stop-dot.dot-last {
    background: var(--danger);
}

.train-stop-connector {
    width: 2px;
    flex: 1;
    background: var(--border-color);
    min-height: 20px;
}

.train-stop-content {
    flex: 1;
    padding-bottom: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.25rem 0.75rem;
}

.train-stop-times {
    display: flex;
    align-items: baseline;
    gap: 0.25rem;
    min-width: 80px;
    font-variant-numeric: tabular-nums;
}

.train-stop-time {
    font-weight: 600;
    font-size: 0.9rem;
}

.train-stop-time-sep {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.train-early {
    color: var(--success);
    font-size: 0.8rem;
    font-weight: 500;
}

.train-stop-station {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    flex: 1;
}

.train-stop-name {
    font-size: 0.9rem;
    color: var(--text-primary);
}

.train-stop-name.cancelled-text {
    text-decoration: line-through;
    color: var(--text-muted);
}

.train-stop-platform {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.platform-changed {
    color: var(--danger);
    font-weight: 600;
}

.train-stop-remark {
    width: 100%;
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    margin-top: 0.15rem;
}

.train-detail-footer {
    display: flex;
    gap: 1.5rem;
    padding-top: 0.75rem;
    margin-top: 0.5rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

@media (max-width: 768px) {
    .train-result-header {
        flex-wrap: wrap;
        gap: 0.4rem;
    }

    .train-result-direction {
        order: 2;
        flex-basis: 100%;
    }

    .train-stop-content {
        flex-direction: column;
        gap: 0.15rem;
    }

    .train-stop-station {
        flex-direction: column;
        gap: 0.15rem;
    }
}

/* === Product type colors for map polylines === */
.product-national { color: #fff; }
.product-nationalExpress { color: #fff; }
.product-regional { color: #ef4444; }
.product-regionalExpress { color: #ef4444; }
.product-suburban { color: #22c55e; }
.product-subway { color: #3b82f6; }
.product-tram { color: #a855f7; }
.product-bus { color: #eab308; }
.product-ferry { color: #06b6d4; }
