/* ==========================================================================
   BILLARD FOKUS PRO - CORE STYLESHEET
   Version: 2.2.0
   Build: 2025
   Author: AI Dev Team
   
   TABLE OF CONTENTS:
   1.0 - ROOT VARIABLES & THEMING
   2.0 - CSS RESET & NORMALIZATION
   3.0 - TYPOGRAPHY SYSTEM
   4.0 - LAYOUT UTILITIES
   5.0 - COMPONENT: BUTTONS
   6.0 - COMPONENT: INPUTS & FORMS
   7.0 - COMPONENT: CARDS & GLASSMORPHISM
   8.0 - COMPONENT: NAVIGATION (HEADER/FOOTER)
   9.0 - COMPONENT: TIMER & DASHBOARD
   10.0 - COMPONENT: PROGRESS & STATS
   11.0 - COMPONENT: HISTORY LIST
   12.0 - COMPONENT: AUTHENTICATION
   13.0 - COMPONENT: ALERTS & FEEDBACK
   14.0 - COMPONENT: LOADERS
   15.0 - ANIMATIONS & KEYFRAMES
   16.0 - MEDIA QUERIES & RESPONSIVENESS
   17.0 - PRINT STYLES
   ========================================================================== */

/* ==========================================================================
   1.0 - ROOT VARIABLES & THEMING
   ========================================================================== */

:root {
    /* --- COLOR PALETTE: CORE --- */
    --color-primary-50:  #ecfdf5;
    --color-primary-100: #d1fae5;
    --color-primary-200: #a7f3d0;
    --color-primary-300: #6ee7b7;
    --color-primary-400: #34d399;
    --color-primary-500: #10b981; /* Base Primary */
    --color-primary-600: #059669;
    --color-primary-700: #047857;
    --color-primary-800: #065f46;
    --color-primary-900: #064e3b;
    
    /* Functional mappings */
    --color-primary: var(--color-primary-500);
    --color-primary-hover: var(--color-primary-600);
    --color-primary-active: var(--color-primary-700);
    --color-primary-glow: rgba(16, 185, 129, 0.4);
    --color-primary-glow-strong: rgba(16, 185, 129, 0.6);

    /* --- COLOR PALETTE: STATE --- */
    --color-secondary: #3B82F6; /* Blue-500 */
    --color-secondary-hover: #2563EB;
    
    --color-warning: #F59E0B;   /* Amber-500 */
    --color-warning-hover: #D97706;
    
    --color-danger: #EF4444;    /* Red-500 */
    --color-danger-hover: #DC2626;
    --color-danger-bg: rgba(239, 68, 68, 0.1);
    
    --color-success: #10B981;
    --color-info: #0EA5E9;

    /* --- THEME: DARK (DEFAULT) --- */
    --color-bg-main: #020617;     /* Slate-950 */
    --color-bg-surface: #0f172a;  /* Slate-900 */
    --color-bg-card: #1e293b;     /* Slate-800 */
    --color-bg-card-hover: #334155; /* Slate-700 */
    --color-bg-card-transparent: rgba(30, 41, 59, 0.7);
    --color-bg-overlay: rgba(2, 6, 23, 0.85);

    --color-text-main: #F8FAFC;   /* Slate-50 */
    --color-text-secondary: #CBD5E1; /* Slate-300 */
    --color-text-muted: #94A3B8;  /* Slate-400 */
    --color-text-disabled: #475569; /* Slate-600 */

    --color-border: #334155;      /* Slate-700 */
    --color-border-hover: #475569;
    --color-divider: rgba(255, 255, 255, 0.05);

    /* --- SPACING SCALE --- */
    --spacing-2xs: 2px;
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-2xl: 48px;
    --spacing-3xl: 64px;

    /* --- LAYOUT --- */
    --header-height: 64px;
    --nav-height: 80px;
    --max-app-width: 480px;
    
    /* --- BORDER RADIUS --- */
    --radius-xs: 4px;
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;
    --radius-full: 9999px;

    /* --- SHADOWS --- */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.15);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 20px rgba(16, 185, 129, 0.15);
    --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);

    /* --- TRANSITIONS --- */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);

    /* --- Z-INDEX LAYERS --- */
    --z-negative: -1;
    --z-normal: 1;
    --z-header: 50;
    --z-nav: 60;
    --z-modal: 100;
    --z-overlay: 90;
    --z-toast: 110;
}

/* --- THEME: LIGHT OVERRIDES --- */
[data-theme="light"] {
    /* Backgrounds */
    --color-bg-main: #F1F5F9;     /* Slate-100 */
    --color-bg-surface: #FFFFFF;  /* White */
    --color-bg-card: #FFFFFF;     /* White */
    --color-bg-card-hover: #F8FAFC; /* Slate-50 */
    --color-bg-card-transparent: rgba(255, 255, 255, 0.85);
    --color-bg-overlay: rgba(255, 255, 255, 0.9);

    /* Typography */
    --color-text-main: #0F172A;   /* Slate-900 */
    --color-text-secondary: #475569; /* Slate-600 */
    --color-text-muted: #64748B;  /* Slate-500 */
    --color-text-disabled: #94A3B8; /* Slate-400 */

    /* Borders */
    --color-border: #E2E8F0;      /* Slate-200 */
    --color-border-hover: #CBD5E1; /* Slate-300 */
    --color-divider: rgba(0, 0, 0, 0.05);

    /* Shadows Modified for Light Mode */
    --shadow-soft: 0 4px 10px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);
    --shadow-glow: 0 0 15px rgba(16, 185, 129, 0.25);
}

/* ==========================================================================
   2.0 - CSS RESET & NORMALIZATION
   ========================================================================== */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none; /* Prevent iOS callout */
}

html {
    font-size: 16px;
    height: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: var(--color-bg-main);
    color: var(--color-text-main);
    height: 100dvh; /* Dynamic viewport height for mobile browsers */
    width: 100vw;
    overflow: hidden; /* Prevent body scroll, handle inside containers */
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* Form element resets */
input, button, textarea, select {
    font: inherit;
    color: inherit;
    border: none;
    background: transparent;
}

button {
    cursor: pointer;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Image resets */
img, picture, video, canvas, svg {
    display: block;
    max-width: 100%;
}

/* Selection color */
::selection {
    background-color: var(--color-primary-glow);
    color: var(--color-primary);
}

/* Scrollbar Customization */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-muted);
}

/* ==========================================================================
   3.0 - TYPOGRAPHY SYSTEM
   ========================================================================== */

h1, h2, h3, h4, h5, h6 {
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.2;
    color: var(--color-text-main);
}

h1 { font-size: 2rem; margin-bottom: var(--spacing-sm); }
h2 { font-size: 1.5rem; margin-bottom: var(--spacing-xs); }
h3 { font-size: 1.25rem; }

p {
    margin-bottom: var(--spacing-md);
    color: var(--color-text-secondary);
}

.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }

.font-mono { font-family: 'Courier Prime', 'Courier New', monospace; }
.font-bold { font-weight: 700; }
.font-extrabold { font-weight: 800; }

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.text-muted { color: var(--color-text-muted) !important; }
.text-primary { color: var(--color-primary) !important; }
.text-warning { color: var(--color-warning) !important; }
.text-danger { color: var(--color-danger) !important; }
.text-success { color: var(--color-success) !important; }

.uppercase { text-transform: uppercase; letter-spacing: 0.05em; }
.truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==========================================================================
   4.0 - LAYOUT UTILITIES
   ========================================================================== */

/* Main App Container - Smartphone Frame */
.app-container {
    max-width: var(--max-app-width);
    margin: 0 auto;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--color-bg-main);
    position: relative;
    box-shadow: 0 0 80px rgba(0,0,0,0.2);
    border-left: 1px solid var(--color-border);
    border-right: 1px solid var(--color-border);
}

/* Screen Wrapper */
.screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
    position: relative;
    z-index: var(--z-normal);
}

/* Utility: Flexbox */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-sm { gap: var(--spacing-sm); }
.gap-md { gap: var(--spacing-md); }
.gap-lg { gap: var(--spacing-lg); }

/* Layout Types */
.content-flex-layout {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: var(--spacing-md);
    overflow: hidden; 
    gap: var(--spacing-sm);
    position: relative;
}

.content-scrollable {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: var(--spacing-lg);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
    /* Safe Area for Bottom Nav */
    padding-bottom: calc(var(--nav-height) + var(--spacing-lg)); 
}

/* Utility: Visibility */
.hidden {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.invisible {
    visibility: hidden;
}

/* ==========================================================================
   5.0 - COMPONENT: BUTTONS
   ========================================================================== */

.btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    
    width: 100%;
    padding: var(--spacing-md);
    
    font-weight: 600;
    font-size: 1rem;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    overflow: hidden;
    
    transition: all var(--transition-fast);
    user-select: none;
}

/* Button Variants */
.btn-primary {
    background: var(--color-primary);
    color: white;
    box-shadow: 0 4px 15px var(--color-primary-glow);
}
.btn-primary:hover:not(:disabled) {
    background: var(--color-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px var(--color-primary-glow);
}
.btn-primary:active:not(:disabled) {
    transform: translateY(1px);
    box-shadow: 0 2px 10px var(--color-primary-glow);
}

.btn-secondary {
    background: var(--color-bg-card);
    color: var(--color-text-main);
    border: 1px solid var(--color-border);
}
.btn-secondary:hover:not(:disabled) {
    background: var(--color-border);
    border-color: var(--color-text-muted);
}

.btn-outline-danger {
    background: transparent;
    border: 1px solid var(--color-danger);
    color: var(--color-danger);
    padding: var(--spacing-md);
}
.btn-outline-danger:hover {
    background: var(--color-danger-bg);
}

.btn-ghost {
    background: transparent;
    color: var(--color-text-secondary);
}
.btn-ghost:hover {
    color: var(--color-text-main);
    background: rgba(255, 255, 255, 0.05);
}

/* Icon Button (Round) */
.icon-btn {
    background: transparent;
    border: none;
    color: var(--color-text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    width: 44px; /* Sufficient Touch Target */
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}
.icon-btn:hover {
    background: var(--color-border);
    color: var(--color-text-main);
    transform: rotate(15deg);
}
.icon-btn:active {
    transform: scale(0.9);
}

/* Disabled State */
.btn:disabled, .btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(0.8);
    transform: none !important;
    box-shadow: none !important;
}

/* ==========================================================================
   6.0 - COMPONENT: INPUTS & FORMS
   ========================================================================== */

.input-group {
    position: relative;
    margin-bottom: var(--spacing-md);
    width: 100%;
}

.input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    pointer-events: none;
    transition: color var(--transition-fast);
    z-index: 2;
}

.form-input {
    width: 100%;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 16px 16px 16px 48px; /* Left padding for icon */
    color: var(--color-text-main);
    font-size: 1rem;
    transition: all var(--transition-fast);
}

.form-input::placeholder {
    color: var(--color-text-disabled);
}

.form-input:hover {
    border-color: var(--color-text-muted);
}

.form-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-glow);
    background: var(--color-bg-card-hover);
}

.form-input:focus + .input-icon {
    color: var(--color-primary);
}

/* Range Slider Styling - Custom */
input[type=range] {
    -webkit-appearance: none;
    width: 100%;
    background: transparent;
    margin: var(--spacing-sm) 0;
}

input[type=range]:focus {
    outline: none;
}

/* Slider Track */
input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 6px;
    cursor: pointer;
    background: var(--color-border);
    border-radius: var(--radius-full);
    transition: background var(--transition-fast);
}
input[type=range]:hover::-webkit-slider-runnable-track {
    background: var(--color-text-muted);
}

/* Slider Thumb */
input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 24px;
    width: 24px;
    border-radius: 50%;
    background: var(--color-primary);
    cursor: pointer;
    margin-top: -9px; /* Centers thumb on track */
    box-shadow: 0 0 10px rgba(0,0,0,0.2);
    border: 2px solid var(--color-bg-main);
    transition: transform var(--transition-fast), background var(--transition-fast);
}

input[type=range]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    background: var(--color-primary-hover);
}
input[type=range]:active::-webkit-slider-thumb {
    transform: scale(1.2);
    cursor: grabbing;
}

/* Toggle Switch Component */
.toggle-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-xs) 0;
}

.toggle-switch {
    position: relative;
    width: 52px;
    height: 32px;
    flex-shrink: 0;
}

.toggle-input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--color-border);
    transition: .4s;
    border-radius: 34px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 24px;
    width: 24px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.toggle-input:checked + .toggle-slider {
    background-color: var(--color-primary);
}

.toggle-input:focus + .toggle-slider {
    box-shadow: 0 0 1px var(--color-primary);
}

.toggle-input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

/* ==========================================================================
   7.0 - COMPONENT: CARDS & GLASSMORPHISM
   ========================================================================== */

.card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    position: relative;
    overflow: hidden;
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

/* Glassmorphism Variant */
.card-glass {
    background: var(--color-bg-card-transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.08);
}

/* Hover Effect for Interactive Cards */
.card.interactive:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--color-border-hover);
}

/* Inner Divider for Cards */
.card-divider {
    height: 1px;
    background: var(--color-border);
    margin: var(--spacing-md) -var(--spacing-md);
}

/* ==========================================================================
   8.0 - COMPONENT: NAVIGATION (HEADER/FOOTER)
   ========================================================================== */

/* Top Header */
.header-bar {
    height: var(--header-height);
    padding: 0 var(--spacing-md);
    background: var(--color-bg-card-transparent);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    z-index: var(--z-header);
    position: relative;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

/* Streak Badge in Header */
.streak-badge {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-md);
    background: rgba(0,0,0,0.05);
    transition: background var(--transition-fast);
}

.streak-badge:hover {
    background: rgba(0,0,0,0.1);
}

.streak-icon-box {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-warning);
    font-size: 1rem;
}

.streak-info {
    display: flex;
    flex-direction: column;
}

/* Bottom Navigation */
.bottom-nav {
    flex-shrink: 0;
    height: var(--nav-height);
    background: var(--color-bg-card-transparent);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--color-border);
    
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    
    padding: var(--spacing-xs);
    padding-bottom: max(var(--spacing-xs), env(safe-area-inset-bottom));
    
    z-index: var(--z-nav);
    position: relative;
}

.nav-item {
    background: none;
    border: none;
    color: var(--color-text-muted);
    padding: var(--spacing-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    position: relative;
}

.nav-item i { 
    font-size: 1.4rem; 
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.nav-item span { 
    font-size: 0.7rem; 
    font-weight: 600; 
    letter-spacing: 0.02em;
}

/* Nav Item Active State */
.nav-item.active {
    color: var(--color-primary);
}

.nav-item.active i {
    transform: translateY(-2px);
    text-shadow: 0 4px 12px var(--color-primary-glow);
}

/* Active Indicator Line */
.nav-item.active::after {
    content: '';
    position: absolute;
    top: 0;
    width: 40px;
    height: 3px;
    background: var(--color-primary);
    border-radius: 0 0 4px 4px;
    box-shadow: 0 2px 8px var(--color-primary-glow);
}

/* ==========================================================================
   9.0 - COMPONENT: TIMER & DASHBOARD
   ========================================================================== */

.dashboard-top {
    flex-shrink: 0;
    animation: slideInDown 0.5s ease-out;
}

/* Main Timer Display Section */
.main-timer-section {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    min-height: 200px;
    position: relative;
}

.timer-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* The Big Timer Digits */
.timer-digits {
    font-size: clamp(3.5rem, 14vw, 5.5rem); /* Responsive fluid typography */
    font-weight: 700;
    font-family: 'Courier New', 'Courier Prime', monospace;
    letter-spacing: -0.05em;
    line-height: 1;
    color: var(--color-text-main);
    text-shadow: 0 0 30px rgba(0,0,0,0.1);
    
    /* Subtle gradient text */
    background: linear-gradient(180deg, var(--color-text-main) 20%, var(--color-text-muted) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Small Reset Button next to timer */
.reset-btn {
    position: absolute;
    right: -48px;
    top: 50%;
    transform: translateY(-50%) scale(0.8);
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: var(--color-text-muted);
    cursor: pointer;
    opacity: 0;
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    box-shadow: var(--shadow-sm);
}

/* Only show reset button when class is removed */
.reset-btn:not(.hidden) {
    opacity: 1;
    transform: translateY(-50%) scale(1);
    pointer-events: auto;
}

.reset-btn:hover {
    color: var(--color-danger);
    border-color: var(--color-danger);
    transform: translateY(-50%) rotate(-90deg);
}

.timer-state-label {
    margin-top: var(--spacing-sm);
    display: inline-block;
    padding: 6px 16px;
    border-radius: var(--radius-full);
    background: var(--color-bg-card-transparent);
    border: 1px solid var(--color-border);
    
    text-transform: uppercase;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--color-text-secondary);
}

/* Controls Section */
.dashboard-controls {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
    padding-bottom: var(--spacing-xs);
    animation: slideInUp 0.5s ease-out;
}

/* Mode Selection Grid */
.mode-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-md);
}

.mode-card {
    background: var(--color-bg-card-transparent);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--spacing-md) var(--spacing-xs);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-xs);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

/* Mode Card Content */
.mode-card i { font-size: 1.5rem; margin-bottom: 2px; transition: transform var(--transition-fast); }
.mode-card.warmup i { color: var(--color-warning); }
.mode-card.training i { color: var(--color-primary); }
.mode-card.pause i { color: var(--color-secondary); }

.mode-card span.label {
    font-size: 0.65rem;
    text-transform: uppercase;
    font-weight: 800;
    color: var(--color-text-muted);
    letter-spacing: 0.05em;
}

.mode-card span.value {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text-main);
}

/* Mode Card Active State */
.mode-card.active {
    background: var(--color-bg-card);
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}
.mode-card.active.warmup { border-color: var(--color-warning); }
.mode-card.active.training { border-color: var(--color-primary); }
.mode-card.active.pause { border-color: var(--color-secondary); }

.mode-card:hover:not(.active) {
    background: var(--color-bg-card-hover);
    transform: translateY(-1px);
}

/* Start/Stop Action Button */
.action-btn {
    padding: 20px;
    font-size: 1.2rem;
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 30px -5px rgba(0,0,0,0.3);
}

.action-btn.running {
    background: transparent;
    border: 2px solid var(--color-border);
    color: var(--color-text-main);
    box-shadow: none;
}
.action-btn.running:hover {
    border-color: var(--color-danger);
    color: var(--color-danger);
    background: var(--color-danger-bg);
}

/* ==========================================================================
   10.0 - COMPONENT: PROGRESS & STATS
   ========================================================================== */

.progress-card {
    padding: var(--spacing-md) var(--spacing-lg);
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: var(--spacing-sm);
}

.label-xs {
    text-transform: uppercase; 
    font-size: 0.7rem; 
    font-weight: 700; 
    color: var(--color-text-muted); 
    letter-spacing: 1.5px; 
    margin-bottom: 6px;
}

.goal-text {
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1;
    color: var(--color-text-main);
    font-feature-settings: "tnum";
    font-variant-numeric: tabular-nums;
}

.goal-sub {
    font-size: 1rem;
    color: var(--color-text-muted);
    font-weight: 400;
    margin-left: 4px;
}

.status-icon {
    font-size: 1.5rem; 
    color: var(--color-text-muted);
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.progress-track {
    height: 10px;
    background: var(--color-bg-main);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-top: var(--spacing-sm);
    border: 1px solid rgba(255,255,255,0.05);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), #34D399);
    width: 0%;
    border-radius: var(--radius-full);
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 10px var(--color-primary-glow);
}

/* ==========================================================================
   11.0 - COMPONENT: HISTORY LIST
   ========================================================================== */

.history-list-container {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.view-header {
    margin-bottom: var(--spacing-sm);
}

.history-item {
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    padding: var(--spacing-md);
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: transform var(--transition-fast);
}

.history-item:hover {
    background: var(--color-bg-card-hover);
    transform: translateX(4px);
}

.history-date {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    font-weight: 600;
    margin-bottom: 2px;
}

.history-time {
    font-family: 'Courier New', monospace;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--color-text-main);
}

.tag { 
    display: inline-block;
    padding: 4px 8px; 
    border-radius: 6px; 
    font-size: 0.65rem; 
    font-weight: 800; 
    text-transform: uppercase;
    letter-spacing: 0.05em;
    min-width: 80px;
    text-align: center;
}

.tag-success { 
    background: rgba(16, 185, 129, 0.15); 
    color: var(--color-primary); 
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.tag-fail { 
    background: rgba(148, 163, 184, 0.15); 
    color: var(--color-text-muted); 
    border: 1px solid var(--color-border);
}

/* ==========================================================================
   12.0 - COMPONENT: AUTHENTICATION
   ========================================================================== */

.auth-content-center {
    display: flex; 
    flex-direction: column; 
    justify-content: center; 
    height: 100%;
    padding: var(--spacing-xl);
    max-width: 400px;
    margin: 0 auto;
}

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

.logo-container {
    width: 100px; 
    height: 100px; 
    margin: 0 auto 24px;
    background: var(--color-bg-card);
    border-radius: 32px;
    display: flex; 
    align-items: center; 
    justify-content: center;
    border: 1px solid var(--color-border);
    box-shadow: 0 20px 40px -10px rgba(0,0,0,0.3);
    position: relative;
    overflow: hidden;
}

/* Shine effect on logo */
.logo-container::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(to bottom right, rgba(255,255,255,0) 40%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0) 60%);
    transform: rotate(45deg);
    animation: shine 6s infinite;
}

.logo-icon { 
    font-size: 3rem; 
    color: var(--color-primary);
    filter: drop-shadow(0 0 10px var(--color-primary-glow));
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

/* ==========================================================================
   13.0 - COMPONENT: ALERTS & FEEDBACK
   ========================================================================== */

/* Settings Section */
.settings-content {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.settings-section {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
}

.setting-row {
    margin-bottom: var(--spacing-lg);
}
.setting-row:last-child { margin-bottom: 0; }

.setting-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--spacing-sm);
}

.setting-label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

.setting-value {
    font-family: 'Courier New', monospace;
    font-weight: 700;
    color: var(--color-primary);
}

/* Alert Box (Toast) */
.alert-box {
    background: var(--color-danger-bg);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--color-danger);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    display: flex; 
    align-items: center; 
    gap: var(--spacing-md);
    font-size: 0.9rem;
    font-weight: 500;
    animation: slideInUp 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.alert-box i {
    font-size: 1.2rem;
}

.app-version {
    text-align: center; 
    margin-top: 20px; 
    font-size: 0.7rem; 
    color: var(--color-border);
    font-family: monospace;
    opacity: 0.7;
}

/* ==========================================================================
   14.0 - COMPONENT: LOADERS
   ========================================================================== */

#loading-screen {
    position: absolute; 
    inset: 0; 
    z-index: var(--z-modal);
    background: var(--color-bg-main);
    display: flex; 
    flex-direction: column;
    align-items: center; 
    justify-content: center;
    transition: opacity 0.5s ease;
}

.loader {
    width: 48px; 
    height: 48px;
    border: 4px solid var(--color-bg-card-hover);
    border-bottom-color: var(--color-primary);
    border-radius: 50%;
    animation: rotation 1s linear infinite;
    position: relative;
}

/* Inner pulse for loader */
.loader::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 80%; height: 80%;
    border-radius: 50%;
    background: var(--color-primary);
    opacity: 0.1;
    animation: pulse-ring 2s infinite;
}

/* ==========================================================================
   15.0 - ANIMATIONS & KEYFRAMES
   ========================================================================== */

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

@keyframes pulse-ring {
    0% { transform: scale(0.8); box-shadow: 0 0 0 0 var(--color-primary-glow); }
    70% { transform: scale(1); box-shadow: 0 0 0 15px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.8); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@keyframes shine {
    0% { top: -150%; left: -150%; }
    20% { top: 100%; left: 100%; }
    100% { top: 100%; left: 100%; }
}

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

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

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

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}

/* Animation Utility Classes */
.pulse-animation { animation: pulse-ring 2s infinite; }
.fade-in { animation: fadeIn 0.6s ease forwards; }
.shake-animation { animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both; }

/* Staggered Delays */
.delay-100 { animation-delay: 100ms; }
.delay-200 { animation-delay: 200ms; }
.delay-300 { animation-delay: 300ms; }

/* ==========================================================================
   16.0 - MEDIA QUERIES & RESPONSIVENESS
   ========================================================================== */

/* Small Phones (iPhone SE, etc) */
@media (max-height: 667px) {
    :root {
        --header-height: 50px;
        --nav-height: 60px;
        --spacing-lg: 16px;
        --spacing-md: 12px;
    }
    
    h1 { font-size: 1.5rem; }
    
    .timer-digits { font-size: 3rem; }
    
    .goal-text { font-size: 1.5rem; }
    
    .mode-card i { font-size: 1.2rem; }
    .mode-card span.label { font-size: 0.6rem; }
    
    .action-btn { padding: 12px; font-size: 1rem; }
}

/* Tall Phones */
@media (min-height: 850px) {
    .content-flex-layout {
        gap: var(--spacing-lg);
        justify-content: center;
    }
    
    .dashboard-controls {
        padding-bottom: var(--spacing-xl);
    }
}

/* Tablets & Desktop (Centering the App) */
@media (min-width: 481px) {
    body {
        background-color: #0f172a; /* Darker background outside app */
        display: flex;
        align-items: center;
        justify-content: center;
        background-image: 
            radial-gradient(circle at 50% 0%, #1e293b 0%, transparent 70%),
            radial-gradient(circle at 80% 80%, #0f172a 0%, transparent 50%);
    }

    .app-container {
        height: 95vh;
        max-height: 900px;
        border-radius: 32px;
        overflow: hidden;
        border: 4px solid #1e293b;
        box-shadow: 
            0 25px 50px -12px rgba(0, 0, 0, 0.5),
            0 0 0 4px rgba(255, 255, 255, 0.05);
    }
    
    /* Light Mode Desktop Background */
    body[data-theme="light"] {
        background-color: #cbd5e1;
        background-image: 
            radial-gradient(circle at 50% 0%, #f1f5f9 0%, transparent 70%);
    }
    
    body[data-theme="light"] .app-container {
        border-color: #fff;
        box-shadow: 
            0 25px 50px -12px rgba(0, 0, 0, 0.1),
            0 0 0 4px rgba(0, 0, 0, 0.05);
    }
}

/* Landscape Mode Check */
@media (orientation: landscape) and (max-height: 600px) {
    .app-container {
        flex-direction: row;
        max-width: 100%;
        border: none;
        border-radius: 0;
    }
    
    .screen {
        flex-direction: row;
    }
    
    .bottom-nav {
        width: 80px;
        height: 100%;
        grid-template-columns: 1fr;
        grid-template-rows: repeat(3, 1fr);
        border-top: none;
        border-left: 1px solid var(--color-border);
        order: 2;
        padding-bottom: var(--spacing-xs);
    }
    
    .content-flex-layout {
        flex-direction: row;
        align-items: center;
    }
    
    .dashboard-top, .dashboard-controls {
        flex: 1;
        width: 300px;
        max-width: 33%;
    }
    
    .main-timer-section {
        flex: 1;
    }
}

/* ==========================================================================
   17.0 - PRINT STYLES
   ========================================================================== */

@media print {
    body {
        background: white;
        color: black;
        height: auto;
        overflow: visible;
    }

    .app-container {
        box-shadow: none;
        border: none;
        max-width: 100%;
        height: auto;
    }

    .bottom-nav, .action-btn, .mode-grid, .header-actions {
        display: none !important;
    }

    .screen {
        display: block !important;
        height: auto;
        overflow: visible;
    }
    
    .timer-digits {
        color: black;
        text-shadow: none;
        font-size: 3rem;
    }
    
    .card {
        border: 1px solid #ccc;
        background: none;
        box-shadow: none;
        break-inside: avoid;
    }
}