/* ═══════════════════════════════════════════════════════════
   focus.css — dedicated Focus Mode page styles
   Loaded only on /focus — does not affect the main dashboard.
   ═══════════════════════════════════════════════════════════ */

/* ── Reset & base ────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --accent:        #7C5CFC;
    --accent-light:  #a78bfa;
    --accent-mid:    #8f72fd;
    --accent-dark:   #5b3fd4;
    --accent-deep:   #3a1fa8;
    --bg:            #0c0d14;
    --surface:       #13111e;
    --surface2:      #1c1a2e;
    --surface3:      #252240;
    --border:        #2e3250;
    --text:          #e8eaf0;
    --muted:         #8b8fa8;
    --radius:        12px;
}

html, body {
    height: 100%;
}

body {
    background: var(--bg);
    background-image:
        radial-gradient(ellipse at 50% -10%,
            rgba(124,92,252,0.08) 0%, transparent 55%);
    color: var(--text);
    font-family: 'Inter', system-ui, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ── Top bar ─────────────────────────────────────────────────── */
.focus-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    height: 54px;
    border-bottom: 1px solid rgba(255,255,255,0.045);
    flex-shrink: 0;
}

.focus-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    flex: 1;
    transition: color 0.15s;
}
.focus-back-btn:hover { color: var(--text); }
.focus-back-btn svg   { flex-shrink: 0; }

.focus-page-title {
    font-size: 0.78rem;
    font-weight: 600;
    color: rgba(139,143,168,0.55);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    flex-shrink: 0;
}

.focus-spacer { flex: 1; }

/* ── Main layout ─────────────────────────────────────────────── */
.focus-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 20px 52px;
}

/* ── Phase tabs ──────────────────────────────────────────────── */
.focus-phase-tabs {
    display: flex;
    gap: 3px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 13px;
    padding: 5px;
    margin-bottom: 48px;
}

.focus-tab {
    padding: 8px 18px;
    border-radius: 9px;
    font-size: 0.815rem;
    font-weight: 500;
    color: var(--muted);
    background: none;
    border: none;
    cursor: pointer;
    letter-spacing: 0.01em;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}
.focus-tab:hover:not(.active) {
    color: var(--text);
    background: rgba(255,255,255,0.04);
}
.focus-tab.active {
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 2px 12px rgba(124,92,252,0.35);
}

/* ══════════════════════════════════════════════════════════════
   FLASK SCENE
   ══════════════════════════════════════════════════════════════ */

.flask-scene {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Extra space around the SVG for the glow halo */
    padding: 40px 50px;
    margin-bottom: 32px;
    /* JS writes --flask-glow (0.25 → 1.0); halo reads it */
    --flask-glow: 1;
}

/* Ambient radial glow behind the flask */
.flask-glow-halo {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: radial-gradient(
        ellipse at 50% 60%,
        rgba(124,92,252,0.22) 0%,
        rgba(124,92,252,0.07) 45%,
        transparent 70%
    );
    opacity: var(--flask-glow);
    transition: opacity 0.95s linear;
    pointer-events: none;
}

/* The SVG itself */
#flask-svg {
    position: relative;
    z-index: 1;
    /* Overall drop-shadow around the whole SVG (includes outline glow) */
    filter:
        drop-shadow(0 0 18px rgba(124,92,252,0.45))
        drop-shadow(0 0 50px rgba(124,92,252,0.18));
    transition: filter 0.95s linear;
    overflow: visible; /* allow glow to escape viewBox */
    display: block;
}

/* ── Pixel shimmer animation ─────────────────────────────────── */
/*
   The pixel group subtly pulses while idle.
   When running, it pulses faster.
   Combined with the SVG glow filter, this creates a living feel.
*/
#flask-pixels {
    animation: px-shimmer 4.5s ease-in-out infinite;
}

@keyframes px-shimmer {
    0%, 100% { opacity: 0.88; }
    50%       { opacity: 1.0;  }
}

/* ── Body state classes ──────────────────────────────────────── */

/* Running: halo pulses + pixels shimmer faster */
.is-running .flask-glow-halo {
    animation: halo-pulse 2.8s ease-in-out infinite;
}
.is-running #flask-pixels {
    animation: px-shimmer-fast 2.2s ease-in-out infinite;
}

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

@keyframes px-shimmer-fast {
    0%, 100% { opacity: 0.80; }
    50%       { opacity: 1.0;  }
}

/* Paused: flask breathes gently */
.is-paused #flask-svg {
    animation: flask-breathe 3.5s ease-in-out infinite;
}

@keyframes flask-breathe {
    0%, 100% { filter:
        drop-shadow(0 0 18px rgba(124,92,252,0.45))
        drop-shadow(0 0 50px rgba(124,92,252,0.18)); }
    50%       { filter:
        drop-shadow(0 0 28px rgba(124,92,252,0.65))
        drop-shadow(0 0 70px rgba(124,92,252,0.28)); }
}

/* Done: brief bright flash */
.is-done #flask-svg {
    animation: flask-done-flash 0.55s ease-out 2;
}

@keyframes flask-done-flash {
    0%   { filter:
        drop-shadow(0 0 18px rgba(124,92,252,0.45))
        drop-shadow(0 0 50px rgba(124,92,252,0.18)); }
    45%  { filter:
        drop-shadow(0 0 50px rgba(167,139,250,0.9))
        drop-shadow(0 0 100px rgba(124,92,252,0.5)); }
    100% { filter:
        drop-shadow(0 0 18px rgba(124,92,252,0.45))
        drop-shadow(0 0 50px rgba(124,92,252,0.18)); }
}

/* ── Progress bar ────────────────────────────────────────────── */
.focus-bar-track {
    width: 100%;
    max-width: 320px;
    height: 5px;
    background: var(--surface3);
    border-radius: 99px;
    overflow: hidden;
    margin-bottom: 18px;
}

.focus-bar-fill {
    height: 100%;
    width: 100%;       /* focus.js sets this on each tick */
    background: linear-gradient(
        90deg,
        var(--accent-deep),
        var(--accent),
        var(--accent-light)
    );
    border-radius: 99px;
    transition: width 0.95s linear;
    box-shadow: 0 0 8px rgba(124,92,252,0.45);
}

/* ── Session / phase label ───────────────────────────────────── */
.focus-session-label {
    font-size: 0.815rem;
    color: var(--muted);
    letter-spacing: 0.025em;
    margin-bottom: 40px;
    text-align: center;
    min-height: 1.2em;
}

/* ── Controls ────────────────────────────────────────────────── */
.focus-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
}

.focus-btn {
    border: none;
    border-radius: var(--radius);
    font-family: 'Inter', system-ui, sans-serif;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
    user-select: none;
    -webkit-user-select: none;
}
.focus-btn:active { transform: scale(0.95); }

/* Primary — Start / Pause */
.focus-btn-primary {
    background: var(--accent);
    color: #fff;
    font-size: 1rem;
    padding: 15px 52px;
    box-shadow: 0 4px 28px rgba(124,92,252,0.40);
    letter-spacing: 0.025em;
    min-width: 140px;
}
.focus-btn-primary:hover {
    background: var(--accent-mid);
    box-shadow: 0 6px 36px rgba(124,92,252,0.56);
}

/* Secondary — Skip */
.focus-btn-secondary {
    background: var(--surface2);
    color: var(--muted);
    font-size: 0.875rem;
    padding: 15px 22px;
    border: 1px solid var(--border);
}
.focus-btn-secondary:hover {
    background: var(--surface3);
    color: var(--text);
    border-color: rgba(124,92,252,0.3);
}

/* ── Keyboard hint ───────────────────────────────────────────── */
.focus-keyboard-hint {
    font-size: 0.775rem;
    color: rgba(139,143,168,0.42);
    letter-spacing: 0.025em;
    text-align: center;
}

.focus-keyboard-hint kbd {
    display: inline-block;
    padding: 1px 6px 2px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 5px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    color: var(--muted);
    vertical-align: baseline;
    letter-spacing: 0;
}

/* ── Responsive — small phones ───────────────────────────────── */
@media (max-width: 480px) {
    .focus-topbar    { padding: 0 18px; }
    .focus-phase-tabs { margin-bottom: 32px; }
    .focus-tab       { padding: 7px 12px; font-size: 0.77rem; }

    .flask-scene     { padding: 28px 36px; margin-bottom: 20px; }

    /* Scale the SVG down on small phones */
    #flask-svg {
        width: 160px !important;
        height: auto !important;
    }

    .focus-bar-track { max-width: 260px; }
    .focus-btn-primary {
        padding: 14px 36px;
        min-width: 120px;
    }
}

/* ── Responsive — short viewports (landscape / small laptops) ── */
@media (max-height: 680px) {
    .focus-main        { justify-content: flex-start; padding-top: 20px; }
    .focus-phase-tabs  { margin-bottom: 24px; }
    .flask-scene       { padding: 24px 40px; margin-bottom: 16px; }
    .focus-session-label { margin-bottom: 18px; }
    .focus-controls    { margin-bottom: 18px; }
}
