/* =========================================
   Aesthetic Pomodoro Timer Styles
   Deep focus, minimalist full-screen design.
========================================= */

/* --- Variables & Theming --- */
:root {
    /* Fonts */
    --font-ui: 'Outfit', sans-serif;
    --font-clock: 'Syncopate', sans-serif;

    /* Theme Focus (Dark Blue / Purple) */
    --focus-bg: #11111a;
    --focus-primary: #a855f7;
    --focus-glow: rgba(168, 85, 247, 0.4);

    /* Theme Short Break (Teal / Cyan) */
    --short-bg: #0f172a;
    --short-primary: #06b6d4;
    --short-glow: rgba(6, 182, 212, 0.4);

    /* Theme Long Break (Indigo / Blue) */
    --long-bg: #1e1b4b;
    --long-primary: #4f46e5;
    --long-glow: rgba(79, 70, 229, 0.4);

    /* Dynamic Variables mapped by JS based on mode */
    --app-bg: var(--focus-bg);
    --app-primary: var(--focus-primary);
    --app-glow: var(--focus-glow);

    --text-main: #f8fafc;
    --text-muted: #94a3b8;

    /* Ring Math */
    --ring-circumference: 1068;
    /* 2 * PI * 170 */
    --ring-offset: 1068;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-ui);
}

body {
    background-color: var(--app-bg);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Prevent scrolling in fullscreen timer */
    transition: background-color 1.5s ease;
    /* Slow, calming transition */
    position: relative;
}

/* Base glow effect behind the timer */
.ambient-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60vh;
    height: 60vh;
    border-radius: 50%;
    background: var(--app-primary);
    filter: blur(120px);
    opacity: 0.15;
    z-index: 0;
    pointer-events: none;
    transition: background 1.5s ease, opacity 2s ease;
    animation: pulse 8s infinite alternate;
}

@keyframes pulse {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.15;
    }

    100% {
        transform: translate(-50%, -50%) scale(1.1);
        opacity: 0.25;
    }
}

/* --- Navigation --- */
.tool-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 3rem;
    position: relative;
    z-index: 10;
}

.back-link,
.icon-btn {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 500;
    transition: color 0.3s, transform 0.2s;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.back-link:hover,
.icon-btn:hover {
    color: var(--text-main);
    transform: scale(1.05);
}

.nav-controls {
    display: flex;
    gap: 1.5rem;
}

/* --- Main Container --- */
.timer-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 10;
    padding-bottom: 5rem;
}

/* --- Mode Selector --- */
.mode-selector {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.5rem;
    border-radius: 999px;
    margin-bottom: 3rem;
    backdrop-filter: blur(10px);
}

.mode-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.75rem 1.5rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mode-btn:hover {
    color: var(--text-main);
}

.mode-btn.active {
    background: var(--app-primary);
    color: white;
    box-shadow: 0 4px 15px var(--app-glow);
}

/* --- Timer Display --- */
.timer-display-wrapper {
    position: relative;
    width: 360px;
    height: 360px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 3rem;
}

.progress-ring {
    position: absolute;
    top: 0;
    left: 0;
    transform: rotate(-90deg);
    /* Start at top (12 o clock) */
}

.progress-ring-track {
    fill: transparent;
    stroke: rgba(255, 255, 255, 0.05);
}

.progress-ring-circle {
    fill: transparent;
    stroke: var(--app-primary);
    stroke-dasharray: var(--ring-circumference);
    stroke-dashoffset: var(--ring-offset);
    transition: stroke-dashoffset 1s linear, stroke 1.5s ease;
    /* Soft glow on the ring itself */
    filter: drop-shadow(0 0 8px var(--app-glow));
}

.time-readout {
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 2;
}

#timeDisplay {
    font-family: var(--font-clock);
    font-size: 5.5rem;
    font-weight: 700;
    letter-spacing: -2px;
    color: var(--text-main);
    line-height: 1;
    margin-bottom: 0.5rem;
    /* Prevent text selection when clicking play */
    user-select: none;
}

.status-msg {
    font-size: 1rem;
    color: var(--app-primary);
    font-weight: 500;
    letter-spacing: 2px;
    text-transform: uppercase;
    transition: color 1.5s ease;
}

/* --- Controls --- */
.timer-controls {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.control-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.play-btn {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: white;
    color: var(--app-bg);
    font-size: 2rem;
    box-shadow: 0 10px 25px rgba(255, 255, 255, 0.1);
    /* Push icon slightly to right for optical balance of play triangle */
    padding-left: 6px;
}

.play-btn.is-playing {
    padding-left: 0;
    /* Reset for pause/stop icon */
}

.play-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 15px 35px rgba(255, 255, 255, 0.2);
}

.play-btn:active {
    transform: scale(0.95);
}

.reset-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    font-size: 1.2rem;
}

.reset-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    transform: rotate(180deg);
}

/* --- Session Tracker --- */
.session-tracker {
    margin-top: 3rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.session-tracker p {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.pomodoro-dots {
    display: flex;
    gap: 8px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transition: background 0.3s ease;
}

.dot.completed {
    background: var(--app-primary);
    box-shadow: 0 0 5px var(--app-glow);
}

/* --- Modal Base (Similar to Hub, optimized for dark) --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.modal-content.glass-panel {
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.show .modal-content {
    transform: translateY(0);
}

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

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
}

.close-btn:hover {
    color: white;
}

.modal-body {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.setting-row label {
    font-weight: 500;
    color: #cbd5e1;
}

.setting-row input[type="number"] {
    width: 70px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 0.5rem;
    border-radius: 8px;
    text-align: center;
    font-size: 1rem;
}

.setting-row input[type="number"]:focus {
    outline: none;
    border-color: var(--app-primary);
}

/* Toggle Switch CSS */
.switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 24px;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
}

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

input:checked+.slider:before {
    transform: translateX(22px);
}

.slider.round {
    border-radius: 24px;
}

.slider.round:before {
    border-radius: 50%;
}

.modal-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: flex-end;
}

.save-btn {
    background: var(--app-primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.save-btn:hover {
    opacity: 0.9;
}