/* assets/css/timer-modern.css */

:root {
    --timer-color: #4caf50;
    --timer-bg: rgba(255, 255, 255, 0.05);
    --timer-track: rgba(255, 255, 255, 0.1);
    --glass-bg: rgba(22, 22, 22, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
    --text-primary: #ffffff;
    --text-muted: #888888;
}

.hidden {
    display: none !important;
}

.light-mode {
    --timer-bg: rgba(0, 0, 0, 0.05);
    --timer-track: rgba(0, 0, 0, 0.1);
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(0, 0, 0, 0.08);
    --text-primary: #222222;
    --text-muted: #666666;
}

/* Modern Timer Container */
.timer-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 0;
}

/* Circular Progress */
.timer-circle-wrap {
    position: relative;
    width: clamp(280px, 40vw, 400px);
    /* Responsive base size */
    height: clamp(280px, 40vw, 400px);
    margin-bottom: 2rem;
}

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

.timer-circle-track {
    fill: none;
    stroke: var(--timer-track);
    stroke-width: 6;
}

.timer-circle-progress {
    fill: none;
    stroke: var(--timer-color);
    stroke-width: 6;
    stroke-linecap: round;
    stroke-dasharray: 283;
    /* Will be updated via JS */
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear, stroke 0.3s;
    filter: drop-shadow(0 0 10px rgba(76, 175, 80, 0.6));
}

/* Inner Display */
.timer-inner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.timer-digits {
    font-family: 'JetBrains Mono', monospace;
    /* Reduced scaling to fit HH:MM:SS */
    font-size: clamp(2.5rem, 14cqw, 5rem);
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 0px;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    cursor: default;
    user-select: none;

    /* Ensure perfect centering */
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;

    /* Container Query Handling */
    container-type: inline-size;
}

.timer-digits.small-text {
    font-size: clamp(2rem, 11cqw, 4rem) !important;
}


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

/* Controls */
.timer-controls-modern {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    justify-content: center;
    margin-top: 1rem;
    z-index: 10002;
    /* Above fullscreen overlay */
}

.btn-modern {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.btn-modern:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3);
    border-color: var(--timer-color);
}

.btn-modern:active {
    transform: translateY(-1px);
}

.btn-modern.play {
    background: var(--timer-color);
    border-color: var(--timer-color);
    color: #fff;
    box-shadow: 0 8px 24px rgba(76, 175, 80, 0.4);
}

.btn-modern.play:hover {
    background: #43a047;
    box-shadow: 0 12px 30px rgba(76, 175, 80, 0.5);
}

/* Reset to clean standard */
.btn-modern svg {
    pointer-events: none;
    /* Prevent clicks on SVG path blocking button click */
    width: 28px;
    height: 28px;
}

/* Presets */
.presets-container {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin: 2rem 0;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.preset-chip {
    padding: 0.6rem 1.2rem;
    border-radius: 2rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    backdrop-filter: blur(8px);
    user-select: none;
}

.preset-chip:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Edit Panel */
.edit-panel {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    margin-top: 2rem;
    display: none;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.edit-panel.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.time-inputs {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.time-unit {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.time-input-field {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 2rem;
    width: 80px;
    height: 80px;
    text-align: center;
    border-radius: 12px;
    outline: none;
}

.time-input-field:focus {
    border-color: var(--timer-color);
    box-shadow: 0 0 0 4px rgba(76, 175, 80, 0.1);
}

.unit-label {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.options-row {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 1rem;
}

.option-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
}


/* === Fullscreen Logic (The Fix) === */
body.is-fullscreen .main-header,
body.is-fullscreen .sidebar,
body.is-fullscreen .sidebar-overlay,
body.is-fullscreen footer,
body.is-fullscreen .content-area,
body.is-fullscreen .tool-hero h1 {
    display: none !important;
}

body.is-fullscreen .tool-hero {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    /* Deep gradient background for modern feel */
    background: radial-gradient(circle at center, #111 0%, #000 100%);
    z-index: 10000;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.is-fullscreen .timer-container {
    width: 100%;
    height: 100%;
    justify-content: center;
    padding: 0;
}

body.is-fullscreen .timer-circle-wrap {
    /* Use min of vw/vh to fit landscape fully without scrolling */
    width: min(70vw, 70vh, 600px);
    height: min(70vw, 70vh, 600px);
    /* Add a subtle glow behind the timer */
    filter: drop-shadow(0 0 30px rgba(76, 175, 80, 0.15));
}

body.is-fullscreen .timer-digits {
    /* Significantly reduced constraint to ensure it stays inside */
    font-size: clamp(3rem, 14cqw, 8rem);
    container-type: inline-size;
}

/* Fallback if container queries aren't fully supported or configured on parent */
body.is-fullscreen .timer-inner {
    container-type: inline-size;
    width: 80%;
    /* restrict inner width */
}

/* Adjust font size based on viewport if container query fails/fallback */
body.is-fullscreen .timer-digits {
    font-size: clamp(3rem, 10vw, 6rem);
    /* Prevent layout oscillation */
    line-height: 1.1;
}

/* Landscape mobile specific tweak */
@media (max-height: 500px) and (orientation: landscape) {
    body.is-fullscreen .timer-circle-wrap {
        width: min(50vh, 300px);
        height: min(50vh, 300px);
    }

    body.is-fullscreen .timer-digits {
        font-size: 3rem;
    }
}

body.is-fullscreen .presets-container,
body.is-fullscreen .edit-panel {
    display: none !important;
}

/* Floating controls in fullscreen with Glassmorphism */
body.is-fullscreen .timer-controls-modern {
    position: absolute;
    bottom: 8%;
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    background: rgba(255, 255, 255, 0.1);
    padding: 1rem 2.5rem;
    border-radius: 50px;
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    gap: 2rem;
}

/* Ringing animation */
.timer-ringing .timer-circle-progress {
    stroke: #ff5252;
    filter: drop-shadow(0 0 20px rgba(244, 67, 54, 0.8));
}

.timer-ringing .timer-digits {
    color: #ff5252;
    animation: pulse-text 1s infinite alternate;
}

@keyframes pulse-text {
    from {
        opacity: 1;
    }

    to {
        opacity: 0.5;
    }
}