/* =====================================================
   POMODORO TIMER - Mood-Based Theme System
   ===================================================== */

/* CSS Variables - Mood Themes */
:root {
    /* Default - Focus Mood */
    --mood-bg-start: #1a1a2e;
    --mood-bg-mid: #16213e;
    --mood-bg-end: #0f3460;
    --mood-primary: #667eea;
    --mood-secondary: #764ba2;
    --mood-accent: #f093fb;
    --mood-text: #ffffff;
    --mood-text-muted: rgba(255, 255, 255, 0.7);
    --mood-glow: rgba(102, 126, 234, 0.5);
    --mood-particle: #667eea;
    
    /* Timer */
    --timer-size: min(350px, 80vw);
    --timer-stroke: 8px;
    
    /* Animation */
    --transition-mood: 1.5s ease;
    --transition-fast: 0.3s ease;
}

/* Focus Mood - Deep concentration */
.mood-focus {
    --mood-bg-start: #0f0c29;
    --mood-bg-mid: #302b63;
    --mood-bg-end: #24243e;
    --mood-primary: #667eea;
    --mood-secondary: #764ba2;
    --mood-accent: #a8edea;
    --mood-glow: rgba(102, 126, 234, 0.6);
    --mood-particle: #667eea;
}

/* Break Mood - Relaxed and calm */
.mood-break {
    --mood-bg-start: #134e5e;
    --mood-bg-mid: #71b280;
    --mood-bg-end: #2d5a4b;
    --mood-primary: #71b280;
    --mood-secondary: #38ef7d;
    --mood-accent: #a8ff78;
    --mood-glow: rgba(113, 178, 128, 0.6);
    --mood-particle: #71b280;
}

/* Long Break Mood - Peaceful and restorative */
.mood-long-break {
    --mood-bg-start: #1e3c72;
    --mood-bg-mid: #2a5298;
    --mood-bg-end: #1e3c72;
    --mood-primary: #89f7fe;
    --mood-secondary: #66a6ff;
    --mood-accent: #c3cfe2;
    --mood-glow: rgba(137, 247, 254, 0.5);
    --mood-particle: #89f7fe;
}

/* Energized Mood - After completing sessions */
.mood-energized {
    --mood-bg-start: #f12711;
    --mood-bg-mid: #f5af19;
    --mood-bg-end: #f37335;
    --mood-primary: #ffecd2;
    --mood-secondary: #fcb69f;
    --mood-accent: #fff;
    --mood-glow: rgba(255, 236, 210, 0.6);
    --mood-particle: #ffecd2;
}

/* Tired Mood - Low energy warning */
.mood-tired {
    --mood-bg-start: #2c3e50;
    --mood-bg-mid: #4a5568;
    --mood-bg-end: #2d3748;
    --mood-primary: #9ca3af;
    --mood-secondary: #6b7280;
    --mood-accent: #e5e7eb;
    --mood-glow: rgba(156, 163, 175, 0.4);
    --mood-particle: #9ca3af;
}

/* =====================================================
   Base Styles
   ===================================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: linear-gradient(135deg, 
        var(--mood-bg-start) 0%, 
        var(--mood-bg-mid) 50%, 
        var(--mood-bg-end) 100%);
    color: var(--mood-text);
    transition: background var(--transition-mood);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    position: relative;
}

/* =====================================================
   Animated Background Canvas
   ===================================================== */
#mood-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    opacity: 0.6;
    pointer-events: none;
}

/* Mood Particles */
.mood-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--mood-particle);
    border-radius: 50%;
    opacity: 0;
    animation: particle-float 8s infinite ease-in-out;
    box-shadow: 0 0 10px var(--mood-glow);
}

@keyframes particle-float {
    0%, 100% {
        opacity: 0;
        transform: translateY(100vh) scale(0);
    }
    10% {
        opacity: 0.8;
    }
    90% {
        opacity: 0.8;
    }
    100% {
        opacity: 0;
        transform: translateY(-10vh) scale(1);
    }
}

/* =====================================================
   Main Container
   ===================================================== */
.pomodoro-container {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    max-width: 500px;
    width: 100%;
}

/* =====================================================
   Navigation
   ===================================================== */
.pomodoro-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    z-index: 100;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--mood-text);
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    transition: var(--transition-fast);
}

.nav-brand:hover {
    color: var(--mood-accent);
}

.nav-brand i {
    font-size: 1.4rem;
}

.nav-actions {
    display: flex;
    gap: 10px;
}

.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: var(--mood-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: var(--transition-fast);
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.btn-icon.active {
    background: var(--mood-primary);
    color: #fff;
}

/* =====================================================
   Mood Character
   ===================================================== */
.mood-character {
    width: 80px;
    height: 80px;
    margin-bottom: 15px;
    position: relative;
    animation: character-bounce 3s infinite ease-in-out;
}

@keyframes character-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.character-face {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--mood-primary), var(--mood-secondary));
    border-radius: 50%;
    position: relative;
    margin: 0 auto;
    box-shadow: 0 8px 30px var(--mood-glow);
    transition: var(--transition-mood);
}

.character-eyes {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding-top: 18px;
}

.eye {
    width: 8px;
    height: 8px;
    background: #fff;
    border-radius: 50%;
    position: relative;
    animation: eye-blink 4s infinite;
}

.eye::after {
    content: '';
    position: absolute;
    width: 4px;
    height: 4px;
    background: #333;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    animation: eye-look 6s infinite ease-in-out;
}

@keyframes eye-blink {
    0%, 45%, 55%, 100% { transform: scaleY(1); }
    50% { transform: scaleY(0.1); }
}

@keyframes eye-look {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(2px); }
    75% { transform: translateX(-2px); }
}

.character-mouth {
    width: 15px;
    height: 8px;
    border-bottom: 3px solid #fff;
    border-radius: 0 0 10px 10px;
    margin: 8px auto 0;
    transition: var(--transition-fast);
}

/* Mood-specific character expressions */
.mood-focus .character-mouth {
    width: 12px;
    height: 4px;
    border-bottom: 2px solid #fff;
    border-radius: 0;
}

.mood-break .character-mouth {
    width: 18px;
    height: 10px;
    border-bottom: 3px solid #fff;
    border-radius: 0 0 15px 15px;
}

.mood-tired .character-eyes .eye {
    transform: scaleY(0.6);
}

.mood-tired .character-mouth {
    border-bottom: none;
    border-top: 3px solid #fff;
    border-radius: 10px 10px 0 0;
}

.mood-energized .character-face {
    animation: character-excited 0.5s infinite alternate;
}

@keyframes character-excited {
    0% { transform: scale(1) rotate(-3deg); }
    100% { transform: scale(1.05) rotate(3deg); }
}

.character-body {
    width: 30px;
    height: 15px;
    background: linear-gradient(135deg, var(--mood-primary), var(--mood-secondary));
    border-radius: 0 0 15px 15px;
    margin: -5px auto 0;
    opacity: 0.8;
    transition: var(--transition-mood);
}

/* =====================================================
   Timer
   ===================================================== */
.timer-wrapper {
    position: relative;
    width: var(--timer-size);
    height: var(--timer-size);
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.timer-track {
    fill: none;
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: var(--timer-stroke);
}

.timer-progress {
    fill: none;
    stroke: url(#timer-gradient);
    stroke-width: var(--timer-stroke);
    stroke-linecap: round;
    stroke-dasharray: 565.48;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear;
}

.gradient-start {
    stop-color: var(--mood-primary);
    transition: stop-color var(--transition-mood);
}

.gradient-end {
    stop-color: var(--mood-secondary);
    transition: stop-color var(--transition-mood);
}

.timer-display {
    text-align: center;
    z-index: 1;
}

.timer-time {
    font-size: clamp(3rem, 15vw, 5rem);
    font-weight: 700;
    letter-spacing: -2px;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 4px 30px var(--mood-glow);
    transition: var(--transition-fast);
}

.timer-label {
    font-size: 1rem;
    color: var(--mood-text-muted);
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-top: 5px;
}

/* Timer pulse animation when running */
.timer-running .timer-time {
    animation: timer-pulse 2s infinite ease-in-out;
}

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

/* =====================================================
   Mood Message
   ===================================================== */
.mood-message {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 20px 0;
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50px;
    backdrop-filter: blur(10px);
    animation: message-fade 0.5s ease;
}

@keyframes message-fade {
    0% { opacity: 0; transform: translateY(-10px); }
    100% { opacity: 1; transform: translateY(0); }
}

.message-text {
    font-size: 0.95rem;
    color: var(--mood-text);
}

.message-emoji {
    font-size: 1.3rem;
    animation: emoji-wiggle 2s infinite ease-in-out;
}

@keyframes emoji-wiggle {
    0%, 100% { transform: rotate(-5deg); }
    50% { transform: rotate(5deg); }
}

/* =====================================================
   Controls
   ===================================================== */
.timer-controls {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-top: 25px;
}

.btn-control {
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition-fast);
}

.btn-control.btn-primary {
    width: 140px;
    height: 56px;
    background: linear-gradient(135deg, var(--mood-primary), var(--mood-secondary));
    color: #fff;
    font-size: 1.1rem;
    box-shadow: 0 8px 30px var(--mood-glow);
}

.btn-control.btn-primary:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 40px var(--mood-glow);
}

.btn-control.btn-primary:active {
    transform: scale(0.98);
}

.btn-control.btn-secondary {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--mood-text);
    font-size: 1.2rem;
}

.btn-control.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* =====================================================
   Session Selector
   ===================================================== */
.session-selector {
    display: flex;
    gap: 10px;
    margin-top: 30px;
    flex-wrap: wrap;
    justify-content: center;
}

.session-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    color: var(--mood-text-muted);
    cursor: pointer;
    transition: var(--transition-fast);
    min-width: 100px;
}

.session-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.session-btn.active {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--mood-primary);
    color: var(--mood-text);
}

.session-btn i {
    font-size: 1.5rem;
    margin-bottom: 5px;
}

.session-btn span {
    font-weight: 600;
    font-size: 0.85rem;
}

.session-btn small {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-top: 3px;
}

/* =====================================================
   Stats Display
   ===================================================== */
.stats-display {
    display: flex;
    align-items: center;
    gap: 25px;
    margin-top: 35px;
    padding: 20px 30px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--mood-text);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--mood-text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 3px;
}

.stat-divider {
    width: 1px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
}

/* =====================================================
   Daily Goal
   ===================================================== */
.daily-goal {
    width: 100%;
    max-width: 350px;
    margin-top: 25px;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
}

.goal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 0.85rem;
    color: var(--mood-text-muted);
}

.goal-count {
    font-weight: 600;
    color: var(--mood-text);
}

.goal-progress {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.goal-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--mood-primary), var(--mood-secondary));
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* =====================================================
   Settings Modal
   ===================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-fast);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: linear-gradient(135deg, var(--mood-bg-start), var(--mood-bg-mid));
    border-radius: 24px;
    width: 90%;
    max-width: 420px;
    max-height: 85vh;
    overflow-y: auto;
    transform: scale(0.9) translateY(20px);
    transition: var(--transition-fast);
}

.modal-overlay.active .modal-content {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
    font-weight: 600;
}

.btn-close-modal {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: var(--mood-text);
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-close-modal:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 25px;
}

.setting-group {
    margin-bottom: 25px;
}

.setting-group label {
    display: block;
    font-size: 0.9rem;
    color: var(--mood-text-muted);
    margin-bottom: 10px;
}

.setting-group input[type="range"] {
    width: calc(100% - 50px);
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.1);
    appearance: none;
    cursor: pointer;
}

.setting-group input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--mood-primary);
    cursor: pointer;
    box-shadow: 0 2px 10px var(--mood-glow);
}

.setting-value {
    display: inline-block;
    width: 40px;
    text-align: right;
    font-weight: 600;
    color: var(--mood-text);
}

.toggle-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.toggle-group label:first-child {
    margin-bottom: 0;
}

.toggle {
    position: relative;
    width: 50px;
    height: 26px;
}

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

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 26px;
    transition: var(--transition-fast);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: var(--transition-fast);
}

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

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

/* Reset Stats Button */
.btn-reset-stats {
    background: linear-gradient(135deg, rgba(255, 59, 48, 0.3) 0%, rgba(255, 59, 48, 0.1) 100%);
    border: 1px solid rgba(255, 59, 48, 0.4);
    color: #ff6b6b;
    padding: 12px 20px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    justify-content: center;
}

.btn-reset-stats:hover {
    background: linear-gradient(135deg, rgba(255, 59, 48, 0.5) 0%, rgba(255, 59, 48, 0.2) 100%);
    border-color: rgba(255, 59, 48, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(255, 59, 48, 0.3);
}

.btn-reset-stats i {
    font-size: 1rem;
}

/* =====================================================
   Celebration
   ===================================================== */
.celebration {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-fast);
}

.celebration.active {
    opacity: 1;
    visibility: visible;
}

.celebration-content {
    text-align: center;
    animation: celebration-pop 0.5s ease;
}

@keyframes celebration-pop {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.celebration-icon {
    font-size: 5rem;
    animation: celebration-bounce 0.5s infinite alternate;
}

@keyframes celebration-bounce {
    0% { transform: scale(1); }
    100% { transform: scale(1.1); }
}

.celebration-text {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--mood-text);
    margin-top: 15px;
}

/* =====================================================
   Responsive Design
   ===================================================== */
@media (max-width: 480px) {
    .pomodoro-container {
        padding: 15px;
    }
    
    .pomodoro-nav {
        padding: 10px 15px;
    }
    
    .nav-brand span {
        display: none;
    }
    
    .mood-character {
        width: 60px;
        height: 60px;
    }
    
    .character-face {
        width: 45px;
        height: 45px;
    }
    
    .stats-display {
        gap: 15px;
        padding: 15px 20px;
    }
    
    .stat-value {
        font-size: 1.2rem;
    }
    
    .session-selector {
        gap: 8px;
    }
    
    .session-btn {
        padding: 12px 15px;
        min-width: 85px;
    }
    
    .timer-controls {
        gap: 15px;
    }
    
    .btn-control.btn-primary {
        width: 120px;
        height: 50px;
    }
}

/* =====================================================
   Fullscreen Mode
   ===================================================== */
body.fullscreen-mode {
    cursor: none;
}

body.fullscreen-mode .pomodoro-nav {
    opacity: 0;
    transition: opacity 0.3s ease;
}

body.fullscreen-mode:hover .pomodoro-nav {
    opacity: 1;
    cursor: auto;
}

body.fullscreen-mode .session-selector,
body.fullscreen-mode .stats-display,
body.fullscreen-mode .daily-goal {
    opacity: 0;
    transition: opacity 0.3s ease;
}

body.fullscreen-mode:hover .session-selector,
body.fullscreen-mode:hover .stats-display,
body.fullscreen-mode:hover .daily-goal {
    opacity: 1;
}

/* =====================================================
   Accessibility
   ===================================================== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus indicators */
button:focus-visible,
input:focus-visible {
    outline: 2px solid var(--mood-accent);
    outline-offset: 2px;
}
