/* 
 * NYC Subway Alerts Pro - Stylesheet
 * Modern, accessible subway alert system with theming support
 */

/* ========== CSS RESET & ROOT VARIABLES ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Light theme colors */
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --accent-blue: #003087;
    --accent-yellow: #FFD320;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Dark theme */
[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border-color: #334155;
}

/* ========== BASE STYLES ========== */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 20px;
    transition: all 0.3s ease;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* ========== HEADER STYLES ========== */
.header {
    background: var(--bg-secondary);
    padding: 30px;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    margin-bottom: 24px;
    text-align: center;
    position: relative;
    border: 1px solid var(--border-color);
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--accent-yellow) 0%, var(--accent-blue) 50%, var(--accent-yellow) 100%);
    border-radius: 16px 16px 0 0;
}

.header-controls {
    position: absolute;
    top: 16px;
    right: 24px;
    display: flex;
    gap: 12px;
    align-items: center;
}

.header h1 {
    color: var(--text-primary);
    margin-bottom: 8px;
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.025em;
}

.header p {
    color: var(--text-secondary);
    font-size: 1.125rem;
    font-weight: 500;
}

/* ========== CONTROL STYLES ========== */
.language-selector,
.theme-toggle,
.font-size-btn {
    background: none;
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-primary);
    transition: all 0.2s ease;
    font-size: 0.875rem;
}

.language-selector {
    min-width: 100px;
}

.language-selector:hover,
.theme-toggle:hover,
.font-size-btn:hover {
    background: var(--bg-tertiary);
}

.top-controls {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 24px;
    margin-bottom: 24px;
}

.controls {
    background: var(--bg-secondary);
    padding: 24px;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    display: flex;
    gap: 24px;
    align-items: center;
    flex-wrap: wrap;
    border: 1px solid var(--border-color);
    position: relative;
}

.controls::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-blue) 0%, var(--accent-yellow) 100%);
    border-radius: 16px 16px 0 0;
}

.quick-actions {
    background: var(--bg-secondary);
    padding: 24px;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 200px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-group label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ========== FORM ELEMENTS ========== */
select, button {
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s ease;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

select:focus, button:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(0, 48, 135, 0.1);
}

select:hover {
    border-color: var(--text-muted);
}

.btn-primary {
    background: var(--accent-blue);
    color: white;
    border: 2px solid var(--accent-blue);
    cursor: pointer;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.875rem;
}

.btn-primary:hover {
    background: #001d3d;
    border-color: #001d3d;
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

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

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

/* ========== SOUND CONTROLS ========== */
.sound-section {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sound-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
}

.toggle-switch {
    width: 44px;
    height: 24px;
    background: var(--border-color);
    border-radius: 12px;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toggle-switch.active {
    background: var(--accent-blue);
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.toggle-switch.active::after {
    transform: translateX(20px);
}

/* ========== STATISTICS DASHBOARD ========== */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-secondary);
    padding: 24px;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    text-align: center;
    border: 1px solid var(--border-color);
    position: relative;
    transition: all 0.2s ease;
}

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

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    border-radius: 16px 16px 0 0;
}

/* Stat card color variants */
.stat-card:nth-child(1) {
    border: 2px solid #dc2626;
}

.stat-card:nth-child(1)::before { 
    background: #dc2626;
    box-shadow: 0 0 8px rgba(220, 38, 38, 0.4);
}

.stat-card:nth-child(2) {
    border: 2px solid #ea580c;
}

.stat-card:nth-child(2)::before { 
    background: #ea580c;
    box-shadow: 0 0 6px rgba(234, 88, 12, 0.3);
}

.stat-card:nth-child(3) {
    border: 2px solid var(--accent-blue);
}

.stat-card:nth-child(3)::before { 
    background: var(--accent-blue);
    box-shadow: 0 0 4px rgba(0, 48, 135, 0.2);
}

.stat-card:nth-child(4) {
    border: 2px solid #16a34a;
}

.stat-card:nth-child(4)::before { 
    background: #16a34a;
    box-shadow: 0 0 4px rgba(22, 163, 74, 0.2);
}

.stat-card:nth-child(5) {
    border: 2px solid #7c3aed;
}

.stat-card:nth-child(5)::before { 
    background: #7c3aed;
    box-shadow: 0 0 4px rgba(124, 58, 237, 0.2);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 8px;
    letter-spacing: -0.025em;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

/* Stat number colors */
.critical { color: #dc2626; }
.warning { color: #eab308; }
.info { color: var(--accent-blue); }
.good-service { color: #16a34a; }
.rush-hour { color: #7c3aed; }

#warningCount {
    color: #eab308 !important;
}

/* ========== ALERT CARDS ========== */
.alerts-container {
    display: grid;
    gap: 16px;
}

.alert-card {
    background: var(--bg-secondary);
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: all 0.2s ease;
    border: 3px solid var(--border-color);
    position: relative;
}

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

.alert-card::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    height: 8px;
    border-radius: 16px 16px 0 0;
}

/* Alert severity variants */
.alert-card.critical {
    border: 3px solid #dc2626;
    background: linear-gradient(to right, rgba(220, 38, 38, 0.05), var(--bg-secondary));
}

.alert-card.critical::before { 
    background: #dc2626;
    box-shadow: 0 0 12px rgba(220, 38, 38, 0.5);
}

.alert-card.critical .alert-header {
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.1), rgba(220, 38, 38, 0.05));
    border-left: none;
}

.alert-card.warning {
    border: 3px solid #eab308;
    background: linear-gradient(to right, rgba(234, 179, 8, 0.04), var(--bg-secondary));
}

.alert-card.warning::before { 
    background: #eab308;
    box-shadow: 0 0 10px rgba(234, 179, 8, 0.4);
}

.alert-card.warning .alert-header {
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.08), rgba(234, 179, 8, 0.03));
    border-left: none;
}

.alert-card.info {
    border: 3px solid var(--accent-blue);
    background: linear-gradient(to right, rgba(0, 48, 135, 0.02), var(--bg-secondary));
}

.alert-card.info::before { 
    background: var(--accent-blue);
    box-shadow: 0 0 8px rgba(0, 48, 135, 0.3);
}

.alert-card.info .alert-header {
    background: linear-gradient(135deg, rgba(0, 48, 135, 0.06), rgba(0, 48, 135, 0.02));
    border-left: none;
}

/* ========== ALERT CARD CONTENT ========== */
.alert-header {
    padding: 20px 24px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.alert-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.alert-lines {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.line-badge {
    padding: 6px 12px;
    border-radius: 12px;
    color: white;
    font-weight: 700;
    font-size: 0.875rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.severity-badge {
    padding: 6px 12px;
    border-radius: 12px;
    color: white;
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.severity-badge.critical { background: #dc2626; }
.severity-badge.warning { background: #ea580c; }
.severity-badge.info { background: var(--accent-blue); }

.rush-hour-badge {
    background: #7c3aed;
    color: white;
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
}

.alert-actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    background: none;
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

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

.alert-content {
    padding: 24px;
}

.alert-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 12px;
    line-height: 1.4;
    position: relative;
    padding-left: 24px;
}

.critical .alert-title {
    color: #dc2626;
}

.critical .alert-title::before {
    content: '🚨';
    position: absolute;
    left: 0;
    top: 0;
    font-size: 1.1rem;
}

.warning .alert-title {
    color: #ea580c;
}

.warning .alert-title::before {
    content: '⚠️';
    position: absolute;
    left: 0;
    top: 0;
    font-size: 1.1rem;
}

.info .alert-title {
    color: var(--accent-blue);
}

.info .alert-title::before {
    content: 'ℹ️';
    position: absolute;
    left: 0;
    top: 0;
    font-size: 1.1rem;
}

.alert-description {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 20px;
    font-weight: 400;
}

.alert-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 16px 0;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    font-size: 0.875rem;
}

.alert-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    font-weight: 500;
}

.location-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--accent-blue);
    font-weight: 600;
}

/* ========== LOADING & NOTIFICATIONS ========== */
.loading {
    text-align: center;
    padding: 48px 24px;
    background: var(--bg-secondary);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
}

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

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--accent-blue);
    color: white;
    padding: 12px 20px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.875rem;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
}

.notification.success { background: #16a34a; }
.notification.warning { background: #ea580c; }
.notification.error { background: #dc2626; }

/* ========== EXPORT SECTION ========== */
.export-section {
    margin-top: 24px;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.export-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* ========== FONT SIZE VARIANTS ========== */
.font-small { font-size: 0.875rem; }
.font-normal { font-size: 1rem; }
.font-large { font-size: 1.125rem; }

/* ========== RESPONSIVE DESIGN ========== */
@media (max-width: 1024px) {
    .top-controls {
        grid-template-columns: 1fr;
    }
    
    .alert-details {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    body {
        padding: 15px;
    }
    
    .controls {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }
    
    .header-controls {
        position: static;
        justify-content: center;
        margin-bottom: 16px;
    }
    
    .header h1 {
        font-size: 1.875rem;
    }
    
    .alert-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .export-buttons {
        justify-content: center;
    }
}

/* ========== PRINT STYLES ========== */
@media print {
    body { 
        background: white; 
        color: black; 
    }
    .header-controls, 
    .controls, 
    .export-section { 
        display: none; 
    }
    .alert-card {
        break-inside: avoid; 
        margin-bottom: 20px; 
    }
}