/* PCC Trolley Color Palette
   Green: #1B4332 (dark forest green - trolley body)
   Cream: #F5F1E3 (vintage cream - trim)
   Maroon: #722F37 (dark red - accents)
   Gold: #C9A227 (accent highlights)
*/

:root {
    --pcc-green-dark: #0D2818;
    --pcc-green: #1B4332;
    --pcc-green-light: #2D6A4F;
    --pcc-cream: #F5F1E3;
    --pcc-cream-dim: #D4CFC0;
    --pcc-maroon: #722F37;
    --pcc-maroon-light: #8B3A42;
    --pcc-gold: #C9A227;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, var(--pcc-green-dark) 0%, var(--pcc-green) 100%);
    min-height: 100vh;
    color: var(--pcc-cream);
}

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    text-align: center;
    padding: 15px 0 20px;
}

.logo {
    width: 120px;
    height: auto;
    margin-bottom: 10px;
    border-radius: 12px;
}

header h1 {
    font-size: 1.8rem;
    margin-bottom: 5px;
    color: var(--pcc-cream);
}

.subtitle {
    font-size: 1rem;
    color: var(--pcc-gold);
}

/* Status Bar */
.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.85rem;
    border: 1px solid rgba(245, 241, 227, 0.1);
}

.refresh-btn {
    background: var(--pcc-maroon);
    color: var(--pcc-cream);
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.refresh-btn:hover {
    background: var(--pcc-maroon-light);
}

.refresh-btn:disabled {
    background: #4a4a4a;
    cursor: not-allowed;
}

/* Live Dot */
.live-dot {
    width: 10px;
    height: 10px;
    background: #4CAF50;
    border-radius: 50%;
    display: inline-block;
    animation: glow-green 2s infinite;
}

@keyframes glow-green {
    0% { box-shadow: 0 0 4px 2px rgba(76, 175, 80, 0.6); }
    50% { box-shadow: 0 0 8px 4px rgba(76, 175, 80, 0.3); }
    100% { box-shadow: 0 0 4px 2px rgba(76, 175, 80, 0.6); }
}

/* No Trolleys State */
.no-trolleys {
    text-align: center;
    padding: 20px;
}

.no-trolleys-title {
    font-size: 0.95rem;
    font-weight: bold;
    color: var(--pcc-cream);
    margin-bottom: 8px;
}

.no-trolleys-subtitle {
    font-size: 0.9rem;
    color: var(--pcc-cream-dim);
}

/* Show Buses Toggle */
.show-buses-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--pcc-cream-dim);
    margin: 4px 0 16px 0;
    cursor: pointer;
}

.show-buses-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--pcc-gold);
}

.show-buses-label span {
    opacity: 0.8;
}

/* Cards */
.card {
    background: rgba(0, 0, 0, 0.25);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid rgba(245, 241, 227, 0.15);
}

.card h2 {
    font-size: 1.1rem;
    margin-bottom: 12px;
    color: var(--pcc-cream);
}

.section-title {
    font-size: 1rem;
    font-weight: 700;
    color: #1a1a1a !important;
    background-color: var(--pcc-gold);
    margin: -20px -20px 15px -20px;
    padding: 12px 20px;
    border-radius: 12px 12px 0 0;
}

.info-text {
    font-size: 0.85rem;
    color: var(--pcc-cream-dim);
    margin-bottom: 15px;
}

.realtime-note {
    color: var(--pcc-gold);
    font-weight: 500;
}

/* Loading */
.loading {
    color: var(--pcc-cream-dim);
    font-style: italic;
    text-align: center;
    padding: 15px;
}

/* Station Selector */
.station-selector {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Mode Selector (Metro vs Regional Rail) */
.mode-selector {
    display: flex;
    gap: 8px;
}

.mode-btn {
    flex: 1;
    padding: 10px 16px;
    border: 2px solid transparent;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.mode-btn.metro {
    background: rgba(0, 0, 0, 0.3);
    color: white;
    border-color: rgba(255, 255, 255, 0.5);
}

.mode-btn.metro.active {
    background: #1a3a5c;
    color: white;
    border-color: white;
}

.mode-btn.regional {
    background: rgba(0, 0, 0, 0.3);
    color: #6D6E71;
    border-color: rgba(109, 110, 113, 0.3);
}

.mode-btn.regional.active {
    background: #4A4A4D;
    color: white;
    border-color: #4A4A4D;
}

/* Line Selector */
.line-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.line-btn {
    padding: 8px 14px;
    border: 2px solid transparent;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.line-btn .line-letter {
    font-weight: 700;
    font-size: 0.9rem;
}

/* SEPTA Metro Line Colors */
.line-btn.line-B {
    background: rgba(0, 0, 0, 0.3);
    color: #F37021;
    border-color: rgba(243, 112, 33, 0.4);
}
.line-btn.line-B.active {
    background: #F37021;
    color: white;
}

.line-btn.line-L {
    background: rgba(0, 0, 0, 0.3);
    color: #00A3E0;
    border-color: rgba(0, 163, 224, 0.4);
}
.line-btn.line-L.active {
    background: #00A3E0;
    color: white;
}

.line-btn.line-T {
    background: rgba(0, 0, 0, 0.3);
    color: #00A650;
    border-color: rgba(0, 166, 80, 0.4);
}
.line-btn.line-T.active {
    background: #00A650;
    color: white;
}

.line-btn.line-M {
    background: rgba(0, 0, 0, 0.3);
    color: #84329B;
    border-color: rgba(132, 50, 155, 0.4);
}
.line-btn.line-M.active {
    background: #84329B;
    color: white;
}

.line-btn.line-D {
    background: rgba(0, 0, 0, 0.3);
    color: #dc2e6b;
    border-color: rgba(220, 46, 107, 0.4);
}
.line-btn.line-D.active {
    background: #dc2e6b;
    color: white;
}

.line-btn.line-G {
    background: rgba(0, 0, 0, 0.3);
    color: #FFD200;
    border-color: rgba(255, 210, 0, 0.4);
}
.line-btn.line-G.active {
    background: #FFD200;
    color: #1a1a1a;
}

/* Regional Rail Line buttons */
.line-btn.line-RR {
    background: rgba(0, 0, 0, 0.3);
    color: #B0B0B0;
    border-color: rgba(109, 110, 113, 0.3);
    font-size: 0.75rem;
    padding: 6px 10px;
}
.line-btn.line-RR.active {
    background: #4A4A4D;
    color: white;
    border-color: #6D6E71;
}

/* Stop Selector */
.stop-selector select {
    width: 100%;
    padding: 10px 14px;
    font-size: 1rem;
    background: rgba(0, 0, 0, 0.3);
    color: var(--pcc-cream);
    border: 1px solid rgba(245, 241, 227, 0.2);
    border-radius: 8px;
    cursor: pointer;
    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='%23F5F1E3' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.stop-selector select:focus {
    outline: none;
    border-color: var(--pcc-gold);
}

.stop-selector select optgroup {
    background: #1B4332;
    color: var(--pcc-gold);
    font-weight: bold;
}

.stop-selector select option {
    background: #0D2818;
    color: var(--pcc-cream);
    padding: 8px;
}

/* Connection Cards */
.connections-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.connection-card {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    padding: 15px;
    border-left: 4px solid var(--pcc-cream-dim);
}

.connection-card.good {
    border-left-color: var(--pcc-green-light);
    background: rgba(45, 106, 79, 0.15);
}

.connection-card.okay {
    border-left-color: var(--pcc-gold);
    background: rgba(201, 162, 39, 0.1);
}

.connection-card.miss {
    border-left-color: var(--pcc-maroon);
    background: rgba(114, 47, 55, 0.1);
}

.connection-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.train-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.train-depart {
    font-weight: bold;
    font-size: 1.2rem;
    color: var(--pcc-cream);
}

.train-in {
    font-size: 0.85rem;
    color: var(--pcc-cream-dim);
}

.connection-verdict {
    text-align: right;
}

.verdict-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.85rem;
    font-weight: bold;
}

.verdict-badge.good {
    background: var(--pcc-green-light);
    color: var(--pcc-cream);
}

.verdict-badge.okay {
    background: var(--pcc-gold);
    color: #1a1a1a;
}

.verdict-badge.miss {
    background: rgba(114, 47, 55, 0.5);
    color: var(--pcc-cream);
}

.connection-details {
    font-size: 0.9rem;
    line-height: 1.6;
}

.connection-details .arrive-time {
    color: var(--pcc-gold);
    margin-bottom: 8px;
}

.trolley-wait {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    margin-top: 8px;
}

.trolley-wait .trolley-id {
    font-weight: 500;
    color: var(--pcc-cream);
}

.trolley-wait .direction-badge {
    font-size: 0.8rem;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(245, 241, 227, 0.1);
    margin-left: 8px;
}

.trolley-wait .direction-badge.east {
    background: rgba(45, 106, 79, 0.4);
    color: #8FBC8F;
}

.trolley-wait .direction-badge.west {
    background: rgba(201, 162, 39, 0.3);
    color: var(--pcc-gold);
}

.trolley-wait .wait-time {
    font-weight: bold;
}

.trolley-wait .wait-time.good {
    color: #8FBC8F;
}

.trolley-wait .wait-time.long {
    color: var(--pcc-gold);
}

.trolley-wait .wait-time.miss {
    color: #E88892;
}

.next-trolley-note {
    font-size: 0.85rem;
    color: var(--pcc-cream-dim);
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(245, 241, 227, 0.1);
}

/* Route Options (step-by-step layout) */
.route-option {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 12px;
    border-left: 4px solid var(--pcc-cream-dim);
}

.route-option.fastest {
    border-left-color: var(--pcc-gold);
    background: rgba(201, 162, 39, 0.1);
}

.option-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    background-color: #1a1a1a;
    margin: -15px -15px 12px -15px;
    padding: 10px 15px;
    border-radius: 8px 8px 0 0;
}

.option-number {
    font-weight: bold;
    font-size: 1rem;
    color: var(--pcc-cream);
}

.fastest-badge {
    background: var(--pcc-gold);
    color: #1a1a1a;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: bold;
}

.depart-info {
    font-size: 0.8rem;
    color: #4CAF50;
    background: rgba(76, 175, 80, 0.15);
    padding: 2px 8px;
    border-radius: 4px;
}

.total-time {
    margin-left: auto;
    font-size: 0.85rem;
    color: var(--pcc-cream-dim);
}

.route-steps {
    margin-bottom: 12px;
    display: grid;
    grid-template-columns: 75px 55px 1fr;
    gap: 8px 10px;
    align-items: center;
}

.route-step {
    display: contents;
}

.step-time-box {
    padding: 4px 8px;
    background: var(--pcc-gold);
    color: #1a1a1a;
    font-weight: bold;
    font-size: 0.75rem;
    border-radius: 4px;
    text-align: center;
    white-space: nowrap;
    min-width: fit-content;
}

.step-time-box.empty {
    visibility: hidden;
}

.step-number {
    font-size: 0.85rem;
    color: var(--pcc-cream-dim);
}

.step-content {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--pcc-cream);
    padding: 6px 0;
    border-bottom: 1px solid rgba(245, 241, 227, 0.1);
}

.step-content:last-child {
    border-bottom: none;
}

.line-badge {
    display: inline-block;
    min-width: 24px;
    height: 24px;
    padding: 0 6px;
    border-radius: 4px;
    text-align: center;
    line-height: 24px;
    font-weight: bold;
    font-size: 0.85rem;
    color: white;
}


.transfer-step .step-content {
    font-size: 0.8rem;
    font-style: italic;
    color: var(--pcc-cream-dim);
    border-bottom: none;
    padding: 2px 0;
}

/* Exit step - where to get off the train */
.exit-step .step-content {
    background-color: rgba(255, 210, 0, 0.1);
    border-left: 3px solid var(--pcc-gold);
    padding-left: 8px;
    font-weight: 600;
    color: var(--pcc-gold);
}

/* Delay info badge */
.delay-info {
    font-size: 0.75rem;
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.15);
    padding: 2px 6px;
    border-radius: 4px;
}

/* Stops indicator - shows route with dots */
.stops-indicator {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 4px 0 8px 0;
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 4px;
    font-size: 0.7rem;
    box-sizing: border-box;
}

.stops-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 1;
    height: 2px;
    background: linear-gradient(to right, var(--pcc-cream-dim), var(--pcc-cream-dim));
    position: relative;
    margin: 0 2px;
    min-width: 80px;
}

.stop-dot {
    width: 8px;
    height: 8px;
    background: var(--pcc-cream-dim);
    border-radius: 50%;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.stop-dot.origin,
.stop-dot.destination {
    width: 10px;
    height: 10px;
    background: var(--pcc-cream);
}

.stop-label {
    color: var(--pcc-cream);
    white-space: nowrap;
    font-size: 0.7rem;
}

.stop-label.start {
    text-align: right;
}

.stop-label.end {
    text-align: left;
}

.stops-count {
    color: var(--pcc-cream-dim);
    font-style: italic;
    white-space: nowrap;
}

.stop-more {
    color: var(--pcc-cream);
    font-size: 0.65rem;
    background: var(--pcc-green-dark);
    padding: 1px 4px;
    border-radius: 8px;
    position: relative;
    z-index: 2;
    white-space: nowrap;
    border: 1px solid var(--pcc-cream-dim);
}

/* Live indicator for real-time data */
.live-indicator {
    color: #4CAF50;
    font-size: 0.9rem;
    animation: pulse-live 1.5s ease-in-out infinite;
}

/* Schedule indicator for schedule API data (not real-time GPS but actual SEPTA schedules) */
.schedule-indicator {
    color: #8BC34A;  /* Lighter green - schedule data, not live GPS */
    font-size: 0.9rem;
    animation: pulse-schedule 2s ease-in-out infinite;
}

@keyframes pulse-live {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

@keyframes pulse-schedule {
    0%, 100% { opacity: 0.9; }
    50% { opacity: 0.5; }
}

.route-step.delayed .step-content {
    border-left: 3px solid #ff9800;
    padding-left: 8px;
    color: #ff9800;
}

/* Late/early badges for real-time transit */
.late-badge {
    font-size: 0.7rem;
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.2);
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: 6px;
    font-weight: 600;
}

.early-badge {
    font-size: 0.7rem;
    color: #4ecdc4;
    background: rgba(78, 205, 196, 0.2);
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: 6px;
    font-weight: 600;
}

.destination-info {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    padding: 10px;
}

.destination-pickup {
    display: flex;
    gap: 8px;
    margin-bottom: 6px;
}

.destination-label {
    font-size: 0.85rem;
    color: var(--pcc-cream-dim);
}

.pickup-name {
    font-size: 0.95rem;
    color: var(--pcc-gold);
    font-weight: 500;
}

.trolley-arrival {
    font-size: 0.85rem;
    color: #8FBC8F;
}

.trolley-arrivals {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.trolley-arrival-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: #8FBC8F;
    flex-wrap: wrap;
}

.trolley-arrival-item .trolley-id {
    font-weight: 600;
    color: var(--pcc-cream);
}

.trolley-arrival-item .trolley-dir {
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.trolley-arrival-item .trolley-dir.east {
    background: rgba(45, 106, 79, 0.4);
    color: #8FBC8F;
}

.trolley-arrival-item .trolley-dir.west {
    background: rgba(201, 162, 39, 0.3);
    color: var(--pcc-gold);
}

.trolley-arrival-item .trolley-eta {
    color: #8FBC8F;
}

.trolley-arrival-item .trolley-time {
    color: var(--pcc-cream-dim);
}

/* New larger direction badges for Route Options */
.trolley-arrival-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(245, 241, 227, 0.1);
}

.trolley-arrival-row:last-child {
    border-bottom: none;
}

.trolley-arrival-row.no-trolleys {
    color: #ff9800;
    font-style: italic;
    padding: 8px 12px;
    background: rgba(255, 152, 0, 0.1);
    border-radius: 4px;
    border-left: 3px solid #ff9800;
}

.trolley-arrival-row.wrong-direction {
    color: #64b5f6;
    padding: 8px 12px;
    background: rgba(100, 181, 246, 0.1);
    border-radius: 4px;
    border-left: 3px solid #64b5f6;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.loop-eta {
    font-size: 0.9em;
    color: #90caf9;
    font-weight: 500;
    margin-top: 4px;
    width: 100%;
}

.wrong-dir-icon {
    font-size: 1.2rem;
}

.trolley-dir-badge {
    padding: 8px 12px;
    border-radius: 6px;
    font-weight: bold;
    font-size: 0.9rem;
    min-width: 90px;
    text-align: center;
    color: #FFFFFF;
}

.trolley-dir-badge.east {
    background: rgba(45, 106, 79, 0.6);
}

.trolley-dir-badge.west {
    background: rgba(201, 162, 39, 0.5);
}

.trolley-details {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.trolley-details .trolley-id {
    font-weight: 600;
    font-size: 1rem;
    color: var(--pcc-cream);
}

.trolley-details .trolley-eta {
    font-size: 0.9rem;
    color: #8FBC8F;
}

.trolley-details .trolley-time {
    font-size: 0.85rem;
    color: var(--pcc-cream-dim);
}

.schedule-source {
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: auto;
}

.schedule-source.real {
    background: rgba(76, 175, 80, 0.2);
    color: #81c784;
    border: 1px solid rgba(76, 175, 80, 0.4);
}

.schedule-source.estimate {
    background: rgba(255, 152, 0, 0.15);
    color: #ffb74d;
    border: 1px solid rgba(255, 152, 0, 0.3);
    font-style: italic;
}

/* Compact trolley arrival row - fits on one line */
.trolley-arrival-row.compact {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
}

.trolley-dir-badge-sm {
    font-size: 0.65rem;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 3px;
    color: #FFFFFF;
    min-width: 22px;
    text-align: center;
    flex-shrink: 0;
}

.trolley-dir-badge-sm.east {
    background: rgba(45, 106, 79, 0.7);
}

.trolley-dir-badge-sm.west {
    background: rgba(201, 162, 39, 0.6);
}

.trolley-info-line {
    font-size: 0.8rem;
    color: var(--pcc-cream);
    white-space: nowrap;
}

.trolley-arrival-row.compact.loop .trolley-info-line {
    color: #90caf9;
    font-style: italic;
}

/* Trolley List (detailed positions) */
.trolley-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.trolley-item {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    overflow: hidden;
}

.trolley-item.east {
    border-left: none;
}

.trolley-item.west {
    border-left: none;
}

/* Box layout with direction header on left */
.trolley-box-layout {
    display: flex;
    flex-direction: row;
}

.direction-header {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px 10px;
    font-size: 1.1rem;
    font-weight: bold;
    letter-spacing: 1px;
    color: #FFFFFF;
    min-width: 40px;
}

.direction-header.east {
    background: rgba(45, 106, 79, 0.5);
}

.direction-header.west {
    background: rgba(201, 162, 39, 0.4);
}

.trolley-content {
    flex: 1;
    padding: 15px;
}

.trolley-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.trolley-number {
    font-weight: bold;
    font-size: 1.2rem;
    color: var(--pcc-cream);
}

/* Current/Next stop info */
.trolley-stop-info {
    margin-bottom: 15px;
}

.current-stop,
.next-stop {
    display: flex;
    gap: 8px;
    margin-bottom: 6px;
}

.stop-label {
    font-size: 0.85rem;
    color: var(--pcc-cream-dim);
    min-width: 85px;
}

.stop-value {
    font-size: 0.95rem;
    color: var(--pcc-cream);
    font-weight: 500;
}

/* 5-stop timeline */
.trolley-timeline {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 4px;
    padding: 10px 5px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    overflow: visible;
}

.timeline-stop {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 50px;
    position: relative;
}

.timeline-stop.empty {
    min-width: 50px;
}

.stop-top {
    height: 24px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.stop-bottom {
    min-height: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 3px;
}

.timeline-stop .stop-name {
    font-size: 0.7rem;
    color: var(--pcc-cream-dim);
    white-space: nowrap;
    text-align: center;
}

.timeline-stop.current .stop-name {
    color: var(--pcc-gold);
    font-weight: bold;
    font-size: 0.75rem;
}

.timeline-stop.transfer .stop-name {
    color: #8FBC8F;
}

.trolley-icon {
    font-size: 1.2rem;
    margin-bottom: 0;
    line-height: 1;
}

.trolley-icon img {
    display: block;
    margin: 0 auto;
    width: 28px;
    height: auto;
}

.direction-arrow {
    display: block;
    font-size: 1rem;
    margin-top: 2px;
    animation: pulse 2s infinite;
}

.direction-arrow.east {
    color: #8FBC8F;
}

.direction-arrow.west {
    color: var(--pcc-gold);
}

/* Immediate next stop pulsing yellow */
.timeline-stop.next-immediate .stop-name {
    color: var(--pcc-gold);
    animation: pulse-yellow 2s infinite;
}

@keyframes pulse-yellow {
    0% { opacity: 1; color: var(--pcc-gold); }
    50% { opacity: 0.5; color: #FFE066; }
    100% { opacity: 1; color: var(--pcc-gold); }
}

.timeline-connector {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--pcc-cream-dim);
    opacity: 0.4;
    margin-top: 28px;
    flex-shrink: 0;
}

/* Terminal stops at ends of timeline */
.timeline-terminal {
    font-size: 0.65rem;
    color: var(--pcc-cream-dim);
    opacity: 0.7;
    white-space: nowrap;
    padding: 0 4px;
    flex-shrink: 0;
    margin-top: 26px;
}

.timeline-divider {
    width: 1px;
    height: 16px;
    background: var(--pcc-cream-dim);
    opacity: 0.4;
    margin: 0 6px;
    margin-top: 26px;
}

/* Transfer line badges */
.transfer-badges {
    display: flex;
    gap: 2px;
    justify-content: center;
}

/* Non-current transfer stops: badge aligns with where arrow would be */
.timeline-stop:not(.current) .transfer-badges {
    margin-top: 0;
}

.transfer-badge {
    font-size: 0.5rem;
    font-weight: bold;
    color: white;
    padding: 1px 3px;
    border-radius: 2px;
    line-height: 1;
}

.transfer-badge.badge-T {
    background: #4CAF50; /* Green for T line */
}

.transfer-badge.badge-B {
    background: #F37021; /* Orange for B line */
}

.transfer-badge.badge-L {
    background: #00A3E0; /* Light blue for L line */
}

/* Legacy styles (kept for backwards compatibility) */
.trolley-direction {
    font-size: 0.85rem;
    padding: 3px 10px;
    border-radius: 12px;
    font-weight: 500;
    margin-left: auto;
}

.trolley-direction.east {
    background: rgba(45, 106, 79, 0.4);
    color: #8FBC8F;
}

.trolley-direction.west {
    background: rgba(201, 162, 39, 0.3);
    color: var(--pcc-gold);
}

.trolley-location {
    font-size: 0.95rem;
    margin-bottom: 6px;
    color: var(--pcc-cream);
}

.trolley-eta {
    font-size: 0.95rem;
    color: #8FBC8F;
}

.trolley-eta.passed {
    color: #E88892;
}

.trolley-destination {
    font-size: 0.85rem;
    color: var(--pcc-cream-dim);
    margin-top: 8px;
}

/* Error State */
.error-message {
    background: rgba(114, 47, 55, 0.3);
    border: 1px solid var(--pcc-maroon);
    padding: 15px;
    border-radius: 8px;
    color: #E88892;
}

/* Intro Card */
.intro-card {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--pcc-cream-dim);
}

.intro-card p {
    margin-bottom: 10px;
}

.intro-card p:last-child {
    margin-bottom: 0;
}

/* Footer */
footer {
    text-align: center;
    padding: 25px 0 15px;
    color: rgba(245, 241, 227, 0.4);
    font-size: 0.8rem;
}

footer p {
    margin-bottom: 5px;
}

.support-section {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    color: var(--pcc-cream-dim);
    font-size: 0.85rem;
    line-height: 1.5;
}

.support-section p {
    margin-bottom: 8px;
}

.support-section p:last-child {
    margin-bottom: 0;
}

.support-section a {
    color: var(--pcc-gold);
    text-decoration: none;
    font-weight: 500;
}

.support-section a:hover {
    text-decoration: underline;
}

.support-section .made-by {
    margin-top: 10px;
    font-style: italic;
    color: var(--pcc-cream-dim);
}

.pcc-info {
    color: rgba(245, 241, 227, 0.5);
}

/* Auto-refresh indicator */
.auto-refresh {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--pcc-cream-dim);
}

.pulse {
    width: 8px;
    height: 8px;
    background: var(--pcc-green-light);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.4; }
    100% { opacity: 1; }
}

/* Responsive */
@media (max-width: 500px) {
    .container {
        padding: 10px;
    }

    header h1 {
        font-size: 1.4rem;
    }

    .card {
        padding: 12px;
    }

    .section-title {
        font-size: 0.9rem;
        padding: 10px 12px;
        margin: -12px -12px 12px -12px;
    }

    /* Mode and line selectors - more compact on mobile */
    .mode-selector {
        gap: 6px;
    }

    .mode-btn {
        padding: 8px 12px;
        font-size: 0.8rem;
    }

    .line-selector {
        gap: 5px;
        justify-content: center;
    }

    .line-btn {
        padding: 5px 8px;
        font-size: 0.7rem;
        border-radius: 14px;
        flex: 0 1 calc(33% - 5px);
        justify-content: center;
    }

    .line-btn .line-letter {
        font-size: 0.75rem;
    }

    .line-btn .line-name {
        text-align: center;
        line-height: 1.1;
    }

    /* Trolley info - more compact */
    .trolley-header {
        gap: 6px;
        margin-bottom: 8px;
    }

    .trolley-number {
        font-size: 1rem;
    }

    .trolley-stop-info {
        margin-bottom: 10px;
    }

    .current-stop,
    .next-stop {
        gap: 4px;
        margin-bottom: 4px;
    }

    .stop-label {
        font-size: 0.75rem;
        min-width: 70px;
    }

    .stop-value {
        font-size: 0.85rem;
    }

    /* Direction header - smaller on mobile */
    .direction-header {
        padding: 10px 6px;
        font-size: 0.85rem;
        min-width: 30px;
        letter-spacing: 0.5px;
    }

    .trolley-content {
        padding: 10px;
    }

    /* Trolley timeline - more compact on mobile */
    .trolley-timeline {
        gap: 1px;
        padding: 6px 4px;
    }

    .timeline-stop {
        min-width: 32px;
        flex-shrink: 1;
    }

    .timeline-stop .stop-name {
        font-size: 0.55rem;
    }

    .timeline-terminal {
        font-size: 0.5rem;
        padding: 0 2px;
        flex-shrink: 0;
        white-space: nowrap;
        margin-top: 24px;
    }

    .timeline-divider {
        margin: 0 3px;
        height: 14px;
        margin-top: 24px;
    }

    .timeline-connector {
        width: 4px;
        height: 4px;
        margin-top: 24px;
    }

    .stop-top {
        height: 22px;
    }

    .stop-bottom {
        min-height: 22px;
        gap: 2px;
    }

    .timeline-stop:not(.current) .transfer-badges {
        margin-top: 0;
    }

    .trolley-icon {
        margin-bottom: 0;
        line-height: 1;
    }

    .trolley-icon img, img.trolley-icon {
        width: 24px;
        height: auto;
    }

    .direction-arrow {
        font-size: 0.6rem;
        margin-top: 0;
    }

    .timeline-stop.current {
        gap: 0;
    }

    .timeline-stop .stop-name {
        font-size: 0.6rem;
    }

    .timeline-stop.current .stop-name {
        font-size: 0.65rem;
    }

    .transfer-badges {
        gap: 1px;
        margin-top: 0;
    }

    .transfer-badge {
        font-size: 0.45rem;
        padding: 1px 3px;
    }

    /* Route option cards - more compact */
    .route-option {
        padding: 10px;
        margin-bottom: 8px;
    }

    .option-header {
        margin: -10px -10px 8px -10px;
        padding: 6px 10px;
        gap: 6px;
    }

    .option-number {
        font-size: 0.85rem;
    }

    .fastest-badge {
        font-size: 0.65rem;
        padding: 2px 6px;
    }

    .depart-info {
        font-size: 0.7rem;
        padding: 2px 6px;
    }

    .total-time {
        font-size: 0.75rem;
    }

    /* Route steps - compact single-line layout */
    .route-steps {
        grid-template-columns: 48px 34px 1fr;
        gap: 2px 3px;
        margin-bottom: 8px;
    }

    .step-time-box {
        padding: 2px 2px;
        font-size: 0.55rem;
        border-radius: 3px;
        white-space: nowrap;
    }

    .step-number {
        font-size: 0.6rem;
    }

    .step-content {
        font-size: 0.7rem;
        gap: 3px;
        padding: 3px 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .line-badge {
        min-width: 18px;
        height: 18px;
        padding: 0 3px;
        line-height: 18px;
        font-size: 0.65rem;
        flex-shrink: 0;
    }

    .transfer-step .step-content {
        font-size: 0.6rem;
    }

    .exit-step .step-content {
        padding-left: 6px;
    }

    /* Stops indicator - more compact */
    .stops-indicator {
        padding: 4px 6px;
        margin: 2px 0 6px 0;
        gap: 3px;
        font-size: 0.6rem;
    }

    .stops-line {
        min-width: 50px;
    }

    .stop-dot {
        width: 6px;
        height: 6px;
    }

    .stop-dot.origin,
    .stop-dot.destination {
        width: 8px;
        height: 8px;
    }

    .stop-label {
        font-size: 0.6rem;
    }

    /* Destination info - compact */
    .destination-info {
        padding: 6px;
    }

    .destination-pickup {
        flex-wrap: nowrap;
        gap: 3px;
        margin-bottom: 4px;
    }

    .destination-label {
        font-size: 0.6rem;
    }

    .pickup-name {
        font-size: 0.7rem;
    }

    /* Trolley arrival rows - more compact */
    .trolley-arrival-row {
        gap: 6px;
        padding: 5px 0;
        flex-wrap: wrap;
    }

    .trolley-dir-badge {
        padding: 3px 5px;
        font-size: 0.6rem;
        min-width: 55px;
    }

    .trolley-details {
        gap: 3px;
        font-size: 0.65rem;
        flex-wrap: wrap;
        flex: 1;
    }

    .trolley-details .trolley-id {
        font-size: 0.7rem;
    }

    .trolley-details .trolley-eta {
        font-size: 0.65rem;
    }

    .trolley-details .trolley-time {
        font-size: 0.6rem;
    }

    .schedule-source {
        font-size: 0.6rem;
        padding: 1px 4px;
    }

    .trolley-arrival-row.no-trolleys,
    .trolley-arrival-row.wrong-direction {
        padding: 6px 8px;
        font-size: 0.7rem;
    }

    .loop-eta {
        font-size: 0.65rem;
        margin-top: 2px;
    }

    /* Live/schedule indicators */
    .live-indicator,
    .schedule-indicator {
        font-size: 0.7rem;
    }

    .delay-info {
        font-size: 0.6rem;
        padding: 1px 4px;
    }

    .route-summary {
        font-size: 0.7rem;
        gap: 8px;
    }

    .connection-header {
        flex-direction: column;
        gap: 8px;
    }

    .connection-verdict {
        text-align: left;
    }

    .trolley-stop-info {
        font-size: 0.85rem;
    }

    .trolley-number {
        font-size: 0.9rem;
    }
}

@media (max-width: 360px) {
    .route-steps {
        grid-template-columns: 46px 32px 1fr;
        gap: 1px 3px;
    }

    .step-time-box {
        font-size: 0.6rem;
        padding: 2px 2px;
    }

    .step-number {
        font-size: 0.6rem;
    }

    .step-content {
        font-size: 0.65rem;
        gap: 2px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .line-badge {
        min-width: 16px;
        height: 16px;
        line-height: 16px;
        font-size: 0.6rem;
        padding: 0 2px;
        flex-shrink: 0;
    }

    .trolley-dir-badge {
        padding: 3px 5px;
        font-size: 0.6rem;
        min-width: 60px;
    }

    .timeline-stop {
        min-width: 32px;
    }

    .timeline-stop .stop-name {
        font-size: 0.55rem;
    }

    .stops-indicator {
        padding: 3px 4px;
    }

    .stop-label {
        font-size: 0.55rem;
    }
}
