:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-card: #ffffff;
    --text-primary: #1a1a1a;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --border-color: #e5e7eb;
    --accent-primary: #3b82f6;
    --accent-hover: #2563eb;
    --accent-light: #dbeafe;
    --accent-gradient: linear-gradient(135deg, #3b82f6, #8b5cf6);
    --card-gradient: linear-gradient(135deg, rgba(59,130,246,0.04), rgba(139,92,246,0.04));
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

body.dark-mode,
[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --accent-primary: #60a5fa;
    --accent-hover: #3b82f6;
    --accent-light: #1e3a8a;
    --accent-gradient: linear-gradient(135deg, #60a5fa, #a78bfa);
    --card-gradient: linear-gradient(135deg, rgba(96,165,250,0.06), rgba(167,139,250,0.06));
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg-primary: #0f172a;
        --bg-secondary: #1e293b;
        --bg-card: #1e293b;
        --text-primary: #f1f5f9;
        --text-secondary: #cbd5e1;
        --text-muted: #94a3b8;
        --border-color: #334155;
        --accent-primary: #60a5fa;
        --accent-hover: #3b82f6;
        --accent-light: #1e3a8a;
        --accent-gradient: linear-gradient(135deg, #60a5fa, #a78bfa);
        --card-gradient: linear-gradient(135deg, rgba(96,165,250,0.06), rgba(167,139,250,0.06));
        --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
        --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
        --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    }
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: var(--transition);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

header {
    text-align: center;
    padding: 2rem 0 1.5rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

.header-content {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    position: relative;
}

.logo {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-icon {
    font-size: 2rem;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.tagline {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-top: 0.5rem;
}

.theme-toggle {
    position: absolute;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1.5rem;
}

.theme-toggle:hover {
    background: var(--bg-secondary);
    transform: rotate(15deg);
}

.theme-icon {
    transition: var(--transition);
}

.location-section {
    background: var(--bg-card);
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.current-location {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    flex: 1;
}

.location-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.location-info {
    flex: 1;
}

.location-text {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.cross-streets {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.btn-refresh {
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.btn-refresh:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
}

.refresh-icon {
    font-size: 1.25rem;
    display: inline-block;
}

.btn-refresh:hover .refresh-icon {
    animation: spin 0.5s ease;
}

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

.status-message {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    display: none;
}

.status-message.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid var(--danger);
    display: block;
}

.status-message.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid var(--success);
    display: block;
}

.status-message.info {
    background: var(--accent-light);
    color: var(--accent-primary);
    border: 1px solid var(--accent-primary);
    display: block;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

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

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

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

.stops-container,
.favorites-container,
.arrivals-container {
    margin-bottom: 2rem;
}

.stops-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.stop-card {
    background: var(--card-gradient), var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1.25rem;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    position: relative;
}

.stop-card:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stop-card.selected {
    border-color: var(--accent-primary);
    border-width: 2px;
    background: var(--accent-light);
}

.favorite-btn {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: transparent;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
    opacity: 0.5;
    transition: var(--transition);
}

.favorite-btn:hover {
    opacity: 1;
    transform: scale(1.2);
}

.favorite-btn.active {
    opacity: 1;
}

.stop-name {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.stop-id {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.stop-distance {
    font-size: 0.875rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.distance-badge {
    background: var(--accent-light);
    color: var(--accent-primary);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-weight: 500;
    font-size: 0.75rem;
}

.arrivals-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.arrival-card {
    background: var(--card-gradient), var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.arrival-card:hover {
    box-shadow: var(--shadow-md);
}

.arrival-info {
    flex: 1;
}

.route-badge {
    display: inline-block;
    background: var(--accent-gradient);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.destination {
    font-size: 1rem;
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.stop-info {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.arrival-time {
    text-align: right;
}

.time-badge {
    background: var(--success);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 1.125rem;
    font-variant-numeric: tabular-nums;
    display: inline-block;
    margin-bottom: 0.25rem;
    min-width: 5rem;
    text-align: center;
}

.time-badge.soon {
    background: var(--warning);
}

.time-badge.now {
    background: var(--danger);
}

.actual-time {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.loading {
    text-align: center;
    padding: 3rem 1rem;
}

.spinner {
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--accent-primary);
    border-radius: 50%;
    width: 3rem;
    height: 3rem;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

.empty-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
}

.stop-type-badge {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.stop-lines {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent-primary);
}

.walk-time {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.35rem;
}

footer {
    text-align: center;
    padding: 2rem 0;
    border-top: 1px solid var(--border-color);
    margin-top: 3rem;
    color: var(--text-secondary);
}

.footer-note {
    font-size: 0.875rem;
    margin-top: 0.5rem;
    color: var(--text-muted);
}

@media (max-width: 768px) {
    .container {
        padding: 0.5rem;
    }

    .logo {
        font-size: 2rem;
    }

    .location-section {
        flex-direction: column;
        align-items: stretch;
    }

    .stops-list {
        grid-template-columns: 1fr;
    }

    .arrival-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .arrival-time {
        text-align: left;
        width: 100%;
    }

    .theme-toggle {
        position: static;
    }

    .header-content {
        flex-direction: column;
    }
}
