/* Focus Flow - Ambient Timer for Deep Work */

:root {
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-card: #252540;
    --accent: #6366f1;
    --accent-glow: rgba(99, 102, 241, 0.3);
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --success: #22c55e;
    --warning: #f59e0b;
}

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

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

.app {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 3rem;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #6366f1, #8b5cf6, #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Timer Section */
.timer-section {
    background: var(--bg-secondary);
    border-radius: 24px;
    padding: 2.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

.timer-display {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.timer-ring {
    position: relative;
    width: 240px;
    height: 240px;
}

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

.timer-bg {
    fill: none;
    stroke: var(--bg-card);
    stroke-width: 8;
}

.timer-progress {
    fill: none;
    stroke: var(--accent);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 565.48;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear;
    filter: drop-shadow(0 0 8px var(--accent-glow));
}

.timer-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3.5rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: 2px;
}

/* Timer Presets */
.timer-presets {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.preset {
    background: var(--bg-card);
    border: 2px solid transparent;
    color: var(--text-secondary);
    padding: 0.6rem 1.2rem;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.preset:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.preset.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* Timer Controls */
.timer-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.control-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-card);
    border: none;
    color: var(--text-primary);
    padding: 0.9rem 1.5rem;
    border-radius: 14px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.control-btn:hover:not(:disabled) {
    background: var(--bg-primary);
    transform: translateY(-2px);
}

.control-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.control-btn.primary {
    background: var(--accent);
    box-shadow: 0 4px 16px var(--accent-glow);
}

.control-btn.primary:hover:not(:disabled) {
    background: #5558e3;
}

.control-btn .icon {
    font-size: 1rem;
}

/* Sounds Section */
.sounds-section {
    background: var(--bg-secondary);
    border-radius: 24px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

.sounds-section h2 {
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
}

.sounds-hint {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

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

.sound-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 1.25rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s ease;
    border: 2px solid transparent;
    position: relative;
}

.sound-card:hover {
    transform: translateY(-3px);
    background: #2d2d4a;
}

.sound-card.active {
    border-color: var(--accent);
    box-shadow: 0 0 20px var(--accent-glow);
}

.sound-icon {
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
}

.sound-name {
    font-weight: 500;
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
}

.volume-slider {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-primary);
    border-radius: 3px;
    outline: none;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.sound-card.active .volume-slider {
    opacity: 1;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    transition: transform 0.15s;
}

.volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.volume-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: none;
}

.sound-toggle {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--bg-primary);
    transition: background 0.2s;
}

.sound-card.active .sound-toggle {
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
}

/* Stats Section */
.stats-section {
    background: var(--bg-secondary);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

.stats-section h2 {
    font-size: 1.4rem;
    margin-bottom: 1.5rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.stat-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 1.5rem 1rem;
    text-align: center;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 0.25rem;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 3rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Running state */
body.timer-running {
    background: linear-gradient(180deg, #0f0f1a 0%, #1a1025 100%);
}

body.timer-running .timer-progress {
    stroke: var(--success);
    filter: drop-shadow(0 0 12px rgba(34, 197, 94, 0.4));
}

/* Completed animation */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.timer-ring.completed {
    animation: pulse 0.5s ease-in-out 3;
}

/* Responsive */
@media (max-width: 600px) {
    .app {
        padding: 1.5rem 1rem;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .timer-ring {
        width: 200px;
        height: 200px;
    }
    
    .timer-text {
        font-size: 2.8rem;
    }
    
    .timer-section,
    .sounds-section,
    .stats-section {
        padding: 1.5rem;
        border-radius: 20px;
    }
    
    .sound-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
    }
    
    .stat-value {
        font-size: 1.8rem;
    }
    
    .stat-card {
        padding: 1rem 0.5rem;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus states */
button:focus-visible,
.sound-card:focus-visible,
input:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
