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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 30px;
    max-width: 600px;
    margin: 0 auto;
}

.header {
    text-align: center;
    margin-bottom: 16px;
}

.app-title {
    font-size: 28px;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 16px;
    color: #666;
}

/* Route Badge Colors */
.route-badge {
    display: inline-block;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    color: white;
    font-size: 14px;
    font-weight: bold;
    line-height: 28px;
    text-align: center;
    margin-right: 5px;
}

.route-badge.large {
    width: 34px;
    height: 34px;
    font-size: 17px;
    line-height: 34px;
}

.route-1, .route-2, .route-3 { background: #EE352E; }
.route-4, .route-5, .route-6, .route-6X { background: #00933C; }
.route-7, .route-7X { background: #B933AD; }
.route-A, .route-C, .route-E { background: #0039A6; }
.route-B, .route-D, .route-F, .route-FX, .route-M { background: #FF6319; }
.route-G { background: #6CBE45; }
.route-J, .route-Z { background: #996633; }
.route-L { background: #A7A9AC; }
.route-N, .route-Q, .route-R, .route-W { background: #FCCC0A; color: #333; }
.route-S, .route-GS { background: #808183; }
.route-SI { background: #0039A6; }

/* Views */
.view {
    display: none;
}

.view.active {
    display: block;
}

/* Station Selection View */
.loading {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 18px;
    animation: pulse 1.5s ease-in-out infinite;
}

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

.error {
    text-align: center;
    padding: 40px;
    color: #ee352e;
    font-size: 16px;
}

.station-list {
    margin-top: 20px;
}

.station-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 16px 0;
    border-bottom: 1px solid #eee;
    transition: background 0.2s;
}

.station-info {
    flex: 1;
    min-width: 0;
}

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

.station-name {
    font-size: 20px;
    font-weight: bold;
    color: #333;
    margin-bottom: 8px;
}

.station-distance {
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
}

.station-routes {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 10px;
}

.direction-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.direction-btn {
    padding: 10px 18px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    min-width: 115px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
}

.direction-btn.already-selected {
    background: #e0e0e0;
    color: #999;
    box-shadow: none;
    cursor: default;
}

.direction-btn.already-selected:hover {
    background: #e0e0e0;
}

.direction-btn:hover {
    background: #5568d3;
}

.station-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

/* Train Times View */
.train-view-header {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.header-btn {
    padding: 10px 18px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.header-btn-secondary {
    background: white;
    color: #555;
    border: 1.5px solid #ddd;
}

.header-btn-secondary:hover {
    background: #f5f5f5;
    border-color: #bbb;
    color: #333;
}

.header-btn-primary {
    background: #667eea;
    color: white;
    border: 1.5px solid #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    margin-left: auto;
}

.header-btn-primary:hover {
    background: #5568d3;
    border-color: #5568d3;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    transform: translateY(-1px);
}

.direction-section {
    margin-bottom: 30px;
}

.direction-title {
    font-size: 20px;
    font-weight: bold;
    color: #333;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #eee;
}

.train-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 13px 20px;
    border-bottom: 1px solid #eee;
    transition: background 0.2s;
}

.train-item:hover {
    background: #f8f9fa;
}

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

.train-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.countdown-section {
    text-align: center;
}

.minutes-away {
    font-size: 26px;
    font-weight: bold;
    color: #ee352e;
}

.minutes-label {
    font-size: 12px;
    color: #666;
    margin-top: 2px;
}

.arrival-time {
    font-size: 17px;
    color: #333;
    white-space: nowrap;
    flex-shrink: 0;
}

.no-trains {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 18px;
}

.last-updated {
    text-align: center;
    margin-top: 30px;
    font-size: 14px;
    color: #999;
}

/* Refresh button */
.refresh-button {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.9);
    color: #666;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.refresh-button:hover {
    background: white;
    border-color: #2196F3;
    color: #2196F3;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Station cards (multi-station view) */
.station-card {
    border: 1px solid #eee;
    border-radius: 12px;
    margin-bottom: 20px;
    overflow: hidden;
}

.station-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 2px solid #eee;
}

.station-card-name {
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

.station-card-direction {
    font-size: 14px;
    color: #666;
    margin-top: 2px;
}

.remove-card-btn {
    background: none;
    border: 1px solid #ddd;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    font-size: 18px;
    cursor: pointer;
    color: #999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.remove-card-btn:hover {
    background: #fee;
    border-color: #ee352e;
    color: #ee352e;
}


/* Mobile responsiveness */
@media (max-width: 480px) {
    body {
        padding: 0;
        background: white;
    }

    .container {
        padding: 18px;
        padding-top: 10px;
        border-radius: 0;
        box-shadow: none;
        min-height: 100vh;
    }

    .header {
        margin-bottom: 10px;
    }

    .app-title {
        font-size: 22px;
    }

    .train-left {
        gap: 10px;
    }

    .minutes-away {
        font-size: 24px;
    }

    .arrival-time {
        font-size: 15px;
    }

    .train-item {
        padding: 11px 14px;
    }

    .station-card-header {
        padding: 10px 14px;
    }

    .station-card-name {
        font-size: 16px;
    }

    .no-trains {
        padding: 20px;
        font-size: 15px;
    }

    .train-view-header {
        margin-bottom: 14px;
    }

    .station-name {
        font-size: 17px;
        margin-bottom: 5px;
    }

    .station-list {
        margin-top: 10px;
    }
}
