/* ============================================
   CSS Variables & Reset - Theme Compatible
   ============================================ */
   :root {
    /* Theme variables will be overridden by ThemeManager */
    --theme-primary: #1f5068;
    --theme-primary-dark: #1a3a4f;
    --theme-primary-light: #2a5a74;
    --theme-accent: #ff9f4a;
    --theme-accent-dark: #e8802a;
    --theme-bg-primary: #ffffff;
    --theme-bg-secondary: #f5f8fc;
    --theme-bg-tertiary: #eef2f8;
    --theme-bg-card: #ffffff;
    --theme-bg-control: #fafcfd;
    --theme-text-primary: #1a3a4f;
    --theme-text-secondary: #6c8eaa;
    --theme-text-light: #8e9aaf;
    --theme-text-inverse: #ffffff;
    --theme-success: #44ff44;
    --theme-warning: #ffaa44;
    --theme-danger: #ff4444;
    --theme-info: #4dabf7;
    --theme-chart-power: #ff9f4a;
    --theme-chart-heartrate: #ff6b6b;
    --theme-chart-altitude: #4dabf7;
    --theme-chart-speed: #69db7e;
    --theme-border-light: #e2edf2;
    --theme-border-medium: #c8d6e5;
    --theme-border-dark: #a0b8cc;
    --theme-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    --theme-shadow-large: 0 8px 24px rgba(0, 0, 0, 0.15);
    --theme-zone1: #44ff44;
    --theme-zone2: #ffaa44;
    --theme-zone3: #ff8844;
    --theme-zone4: #ff6644;
    --theme-zone5: #ff4444;
    
    /* Legacy variables for backward compatibility */
    --primary-dark: var(--theme-primary-dark);
    --primary: var(--theme-primary);
    --primary-light: var(--theme-primary-light);
    --accent: var(--theme-accent);
    --accent-dark: var(--theme-accent-dark);
    --success: var(--theme-success);
    --warning: var(--theme-warning);
    --danger: var(--theme-danger);
    --text-dark: var(--theme-text-primary);
    --text-light: var(--theme-text-secondary);
    --bg-light: var(--theme-bg-secondary);
    --bg-white: var(--theme-bg-primary);
    --shadow: var(--theme-shadow-large);
    --shadow-sm: var(--theme-shadow);
    --transition: all 0.2s ease;
    --border-radius: 2rem;
}

/* Theme transition smoothness */
* {
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

/* Theme-specific adjustments */
[data-theme="cyber"] .dashboard,
[data-theme="cyber"] .reenactment-controls,
[data-theme="cyber"] .compact-metrics,
[data-theme="cyber"] .zone-visualizer {
    backdrop-filter: blur(2px);
}

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

body {
    background: linear-gradient(135deg, var(--theme-bg-secondary, #f0f4fc), var(--theme-bg-tertiary, #e2eaf5));
    font-family: 'Inter', sans-serif;
    padding: 1rem;
    min-height: 100vh;
}

.dashboard {
    max-width: 1600px;
    margin: 0 auto;
    background: var(--theme-bg-primary, rgba(255,255,255,0.96));
    border-radius: var(--border-radius, 2rem);
    box-shadow: var(--theme-shadow-large, 0 25px 50px -12px rgba(0,0,0,0.3));
    overflow: hidden;
}

/* Header */
.dashboard-header {
    background: linear-gradient(130deg, var(--theme-primary-dark, #1a3a4f), var(--theme-primary, #1f5068));
    color: var(--theme-text-inverse, --theme-text-primary);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.logo h1 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--theme-text-inverse, --theme-text-primary);
}

.logo h1 i {
    margin-right: 8px;
    color: var(--theme-accent, #ff9f4a);
}

.header-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.lang-selector {
    background: var(--theme-primary-light, #2a5a74);
    border-radius: 2rem;
    padding: 0.2rem 0.3rem;
    display: flex;
    gap: 0.3rem;
}

.lang-btn {
    background: transparent;
    border: none;
    color: var(--theme-text-inverse, --theme-text-primary);
    padding: 0.3rem 0.8rem;
    border-radius: 2rem;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition, all 0.2s ease);
}

.lang-btn.active {
    background: var(--theme-accent, #ff9f4a);
    color: var(--theme-primary-dark, #1a3a4f);
}

.lang-btn:hover:not(.active) {
    background: rgba(255, 159, 74, 0.3);
}

.upload-area {
    display: flex;
    gap: 0.8rem;
    align-items: center;
    background: var(--theme-primary-light, #2a5a74);
    padding: 0.3rem 1rem;
    border-radius: 3rem;
}

.file-label {
    background: var(--theme-accent, #ff9f4a);
    color: var(--theme-primary-dark, #1a3a4f);
    padding: 0.4rem 1.2rem;
    border-radius: 2rem;
    font-weight: 700;
    font-size: 0.75rem;
    cursor: pointer;
    transition: var(--transition, all 0.2s ease);
}

.file-label:hover {
    background: var(--theme-accent-dark, #ffb86b);
}

#fileName {
    font-size: 0.7rem;
    color: var(--theme-text-inverse, rgba(255,255,255,0.9));
}

/* Main Content */
.tab-content {
    display: none;
    padding: 0.2rem 0.1rem;
    animation: fadeIn 0.3s ease;
    min-height: 500px;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Footer */
footer {
    text-align: center;
    padding: 0.8rem;
    font-size: 0.65rem;
    color: var(--theme-text-secondary, #6c8eaa);
    border-top: 1px solid var(--theme-border-light, #e2edf2);
    background: var(--theme-bg-control, #fafcfd);
}

/* Utility Classes */
.text-accent { color: var(--theme-accent, #ff9f4a); }
.text-success { color: var(--theme-success, #44ff44); }
.text-warning { color: var(--theme-warning, #ffaa44); }
.text-danger { color: var(--theme-danger, #ff4444); }

/* Loading State */
.tab-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
    color: var(--theme-text-secondary, #6c8eaa);
    font-size: 0.9rem;
}

.tab-loading i {
    margin-right: 8px;
    animation: spin 1s linear infinite;
}

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

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(5px);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: var(--theme-primaryDark, #0f2027);
    border-radius: 2rem;
    width: 90%;
    max-width: 850px;
    animation: fadeInUp 0.25s ease;
    border: 1px solid var(--theme-accent, #ff9f4a);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--theme-accent, #ff9f4a);
    padding: 1rem 1.5rem;
}

.modal-header h3 {
    color: var(--theme-accent, #ff9f4a);
    font-weight: 800;
    font-size: 1.3rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: var(--theme-accent, #ff9f4a);
    transition: var(--transition, all 0.2s ease);
}

.modal-close:hover {
    color: var(--theme-text-inverse, --theme-text-primary);
    transform: scale(1.1);
}

.modal-body {
    padding: 1.5rem;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (max-width: 768px) {
    .dashboard-header {
        flex-direction: column;
        text-align: center;
    }
    
    .tab-content {
        padding: 1rem;
    }
}