/* ===================================
   CSS Variables & Reset
   =================================== */

:root {
    /* Color Palette - Focus Flow */
    --color-bg: #f0fdfa;
    --color-bg-dark: #ccfbf1;

    --color-text: #134e4a;
    --color-text-muted: #5f9893;
    --color-text-light: #99f6e4;

    /* Mode Colors */
    --color-work: #14b8a6;
    --color-work-light: #5eead4;
    --color-short-break: #f59e0b;
    --color-short-break-light: #fcd34d;
    --color-long-break: #8b5cf6;
    --color-long-break-light: #c4b5fd;

    --color-current: var(--color-work);
    --color-current-light: var(--color-work-light);

    --color-white: #ffffff;
    --color-border: #d1fae5;

    --color-success: #10b981;
    --color-error: #ef4444;

    /* Typography */
    --font-display: 'Outfit', sans-serif;
    --font-body: 'Manrope', sans-serif;

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 0.75rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    --spacing-3xl: 4rem;

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(20, 184, 166, 0.08);
    --shadow-md: 0 4px 16px rgba(20, 184, 166, 0.12);
    --shadow-lg: 0 8px 32px rgba(20, 184, 166, 0.16);
    --shadow-glow: 0 0 40px rgba(94, 234, 212, 0.3);

    /* Transitions */
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    font-size: 16px;
}

body {
    font-family: var(--font-body);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* ===================================
   Background Gradient
   =================================== */

.bg-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    background: radial-gradient(
        circle at 50% 50%,
        rgba(94, 234, 212, 0.15),
        rgba(20, 184, 166, 0.05),
        transparent
    );
    animation: breathe 8s ease-in-out infinite;
}

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

/* ===================================
   Container
   =================================== */

.container {
    max-width: 600px;
    width: 100%;
    padding: var(--spacing-xl);
    position: relative;
    z-index: 2;
}

/* ===================================
   Header
   =================================== */

.header {
    text-align: center;
    margin-bottom: var(--spacing-xl);
}

.brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
}

.brand-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--color-current), var(--color-current-light));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-white);
    font-size: 1.5rem;
    box-shadow: var(--shadow-md);
    animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: var(--shadow-md);
    }
    50% {
        box-shadow: var(--shadow-glow);
    }
}

.brand h1 {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 800;
    color: var(--color-text);
    letter-spacing: -0.5px;
}

.tagline {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    font-weight: 500;
}

/* ===================================
   Mode Selector
   =================================== */

.mode-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-sm);
    padding: var(--spacing-sm);
    background: var(--color-white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--spacing-2xl);
}

.mode-btn {
    padding: var(--spacing-md);
    background: transparent;
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-xs);
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text-muted);
}

.mode-btn i {
    font-size: 1.125rem;
    transition: all var(--transition);
}

.mode-btn:hover {
    background: var(--color-bg);
    transform: translateY(-2px);
}

.mode-btn.active {
    background: linear-gradient(135deg, var(--color-current), var(--color-current-light));
    color: var(--color-white);
    box-shadow: var(--shadow-md);
}

.mode-btn.active i {
    transform: scale(1.1);
}

/* ===================================
   Timer Circle
   =================================== */

.timer-container {
    position: relative;
    width: 100%;
    max-width: 400px;
    aspect-ratio: 1;
    margin: 0 auto var(--spacing-2xl);
}

.timer-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.timer-bg {
    stroke: var(--color-border);
    opacity: 0.3;
}

.timer-progress {
    stroke: var(--color-current);
    stroke-dasharray: 534.07;
    stroke-dashoffset: 0;
    transition: stroke var(--transition), stroke-dashoffset 1s linear;
    filter: drop-shadow(0 0 8px var(--color-current-light));
}

.timer-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    width: 100%;
}

.timer-display {
    font-family: var(--font-display);
    font-size: 4rem;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1;
    margin-bottom: var(--spacing-sm);
    letter-spacing: -2px;
}

.timer-label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Timer breathing animation */
.timer-container.running .timer-content {
    animation: timerBreathe 4s ease-in-out infinite;
}

@keyframes timerBreathe {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.02);
    }
}

/* ===================================
   Controls
   =================================== */

.controls {
    display: flex;
    justify-content: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-2xl);
}

.control-btn {
    padding: var(--spacing-md) var(--spacing-xl);
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--color-current), var(--color-current-light));
    border: none;
    border-radius: var(--radius-full);
    color: var(--color-white);
    cursor: pointer;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    box-shadow: var(--shadow-md);
    min-width: 140px;
    justify-content: center;
}

.control-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: var(--shadow-lg);
}

.control-btn:active {
    transform: translateY(0) scale(1);
}

.control-btn-ghost {
    background: var(--color-white);
    color: var(--color-current);
    border: 2px solid var(--color-border);
}

.control-btn-ghost:hover {
    background: var(--color-bg);
    border-color: var(--color-current);
}

/* ===================================
   Stats Grid
   =================================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-xl);
}

.stat-card {
    background: var(--color-white);
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    transition: all var(--transition);
}

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

.stat-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--color-current-light), var(--color-bg-dark));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-current);
    font-size: 1.25rem;
    flex-shrink: 0;
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===================================
   Settings Panel
   =================================== */

.settings-panel {
    background: var(--color-white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.settings-toggle {
    width: 100%;
    padding: var(--spacing-md) var(--spacing-lg);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    font-family: var(--font-body);
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--color-text-muted);
}

.settings-toggle:hover {
    background: var(--color-bg);
    color: var(--color-text);
}

.settings-toggle i {
    transition: transform var(--transition);
}

.settings-toggle.active i {
    transform: rotate(180deg);
}

.settings-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-slow);
}

.settings-content.open {
    max-height: 500px;
    border-top: 1px solid var(--color-border);
}

.settings-group {
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--color-border);
}

.settings-group:last-of-type {
    border-bottom: none;
}

.settings-label {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: var(--spacing-sm);
}

.settings-label i {
    color: var(--color-current);
    font-size: 0.875rem;
}

.settings-input {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    background: var(--color-bg);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text);
    transition: all var(--transition);
}

.settings-input:focus {
    outline: none;
    border-color: var(--color-current);
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.1);
}

.settings-save {
    width: 100%;
    padding: var(--spacing-md);
    background: linear-gradient(135deg, var(--color-current), var(--color-current-light));
    border: none;
    border-radius: 0;
    color: var(--color-white);
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    font-family: var(--font-body);
    font-size: 0.9375rem;
    font-weight: 700;
}

.settings-save:hover {
    background: linear-gradient(135deg, var(--color-current-light), var(--color-current));
}

/* ===================================
   Toast
   =================================== */

.toast {
    position: fixed;
    bottom: var(--spacing-xl);
    left: 50%;
    transform: translateX(-50%) translateY(150%);
    background: var(--color-white);
    color: var(--color-text);
    padding: var(--spacing-md) var(--spacing-xl);
    border-radius: var(--radius-full);
    border: 2px solid var(--color-current);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 0.9375rem;
    font-weight: 700;
    z-index: 1000;
    transition: transform var(--transition);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

.toast i {
    color: var(--color-success);
    font-size: 1.125rem;
}

.toast.error {
    border-color: var(--color-error);
}

.toast.error i {
    color: var(--color-error);
}

/* ===================================
   Responsive
   =================================== */

@media (max-width: 640px) {
    .container {
        padding: var(--spacing-md);
    }

    .brand h1 {
        font-size: 1.5rem;
    }

    .timer-display {
        font-size: 3rem;
    }

    .timer-label {
        font-size: 0.875rem;
    }

    .mode-selector {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .controls {
        flex-direction: column;
        width: 100%;
    }

    .control-btn {
        width: 100%;
    }
}

/* ===================================
   Utilities
   =================================== */

.hidden {
    display: none !important;
}

/* Selection */
::selection {
    background: var(--color-current-light);
    color: var(--color-text);
}

::-moz-selection {
    background: var(--color-current-light);
    color: var(--color-text);
}
