/* 
   Style.css for Timer Project
   Author: Divine Revelations
   Design: Apple-inspired, Multi-Theme, Scalable Typography
   No-Image Version - Flexible Container Fixed
*/

/* -------------------- {Design System} ------------------- */
:root {
    --font-base: 16px;
    --font-scale: 1;

    /* Transition settings */
    --transition-speed: 0.3s;

    /* Border Logic */
    --border-radius-lg: 40px;
    --border-radius-md: 20px;
    --shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
}

/* ----------------------- {Themes} ----------------------- */
/* Theme 1: Sky Blue (Dark - Default) */
[data-theme="dark-sky"] {
    --bg-color: #0A192F;
    --container-bg: rgba(17, 34, 64, 0.85);
    --text-color: #E6F1FF;
    --text-secondary: #8892B0;
    --primary-color: #64FFDA;
    --accent-color: #007AFF;
    --glass-bg: rgba(10, 25, 47, 0.7);
    --glass-border: rgba(100, 255, 218, 0.2);
    --error-color: #FF3B30;
}

[data-theme="dark-emerald"] {
    --bg-color: #061A13;
    --container-bg: rgba(12, 45, 34, 0.85);
    --text-color: #D1FAE5;
    --text-secondary: #6EE7B7;
    --primary-color: #10B981;
    --accent-color: #059669;
    --glass-bg: rgba(6, 26, 19, 0.7);
    --glass-border: rgba(16, 185, 129, 0.2);
    --error-color: #FF3B30;
}

[data-theme="dark-sunset"] {
    --bg-color: #1A0B0B;
    --container-bg: rgba(54, 21, 21, 0.85);
    --text-color: #FEE2E2;
    --text-secondary: #FCA5A5;
    --primary-color: #EF4444;
    --accent-color: #F97316;
    --glass-bg: rgba(26, 11, 11, 0.7);
    --glass-border: rgba(239, 68, 68, 0.2);
    --error-color: #FF3B30;
}

[data-theme="dark-purple"] {
    --bg-color: #120021;
    --container-bg: rgba(30, 0, 50, 0.85);
    --text-color: #F3E8FF;
    --text-secondary: #D8B4FE;
    --primary-color: #A855F7;
    --accent-color: #C026D3;
    --glass-bg: rgba(18, 0, 33, 0.7);
    --glass-border: rgba(168, 85, 247, 0.2);
    --error-color: #FF3B30;
}

[data-theme="dark-midnight"] {
    --bg-color: #000000;
    --container-bg: rgba(28, 28, 30, 0.85);
    --text-color: #FFFFFF;
    --text-secondary: #A1A1A6;
    --primary-color: #FFD700;
    --accent-color: #FFFFFF;
    --glass-bg: rgba(0, 0, 0, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --error-color: #FF453A;
}

[data-theme="dark-sea"] {
    --bg-color: #001219;
    --container-bg: rgba(0, 95, 115, 0.85);
    --text-color: #E9D8A6;
    --text-secondary: #94D2BD;
    --primary-color: #00FEDE;
    --accent-color: #0A9396;
    --glass-bg: rgba(0, 18, 25, 0.7);
    --glass-border: rgba(0, 254, 222, 0.2);
    --error-color: #FF3B30;
}

[data-theme="dark-slate"] {
    --bg-color: #1E293B;
    --container-bg: rgba(30, 41, 59, 0.85);
    --text-color: #F1F5F9;
    --text-secondary: #94A3B8;
    --primary-color: #38BDF8;
    --accent-color: #0EA5E9;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(56, 189, 248, 0.2);
    --error-color: #FF3B30;
}

/* Light Themes */
[data-theme="light-blue"] {
    --bg-color: #F0F9FF;
    --container-bg: rgba(255, 255, 255, 0.9);
    --text-color: #0C4A6E;
    --text-secondary: #0369A1;
    --primary-color: #0EA5E9;
    --accent-color: #0284C7;
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(14, 165, 233, 0.3);
    --error-color: #DC2626;
}

[data-theme="light-apple"] {
    --bg-color: #F5F5F7;
    --container-bg: rgba(255, 255, 255, 0.9);
    --text-color: #1D1D1F;
    --text-secondary: #86868B;
    --primary-color: #007AFF;
    --accent-color: #000000;
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(0, 122, 255, 0.2);
    --error-color: #FF3B30;
}

[data-theme="light-mint"] {
    --bg-color: #F0FDF4;
    --container-bg: rgba(255, 255, 255, 0.9);
    --text-color: #064E3B;
    --text-secondary: #065F46;
    --primary-color: #10B981;
    --accent-color: #059669;
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(16, 185, 129, 0.3);
    --error-color: #DC2626;
}

[data-theme="light-peach"] {
    --bg-color: #FFF7ED;
    --container-bg: rgba(255, 255, 255, 0.9);
    --text-color: #7C2D12;
    --text-secondary: #9A3412;
    --primary-color: #F97316;
    --accent-color: #EA580C;
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(249, 115, 22, 0.3);
    --error-color: #DC2626;
}

[data-theme="light-lavender"] {
    --bg-color: #F5F3FF;
    --container-bg: rgba(255, 255, 255, 0.9);
    --text-color: #4C1D95;
    --text-secondary: #5B21B6;
    --primary-color: #8B5CF6;
    --accent-color: #7C3AED;
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(139, 92, 246, 0.3);
    --error-color: #DC2626;
}

[data-theme="light-rose"] {
    --bg-color: #FFF1F2;
    --container-bg: rgba(255, 255, 255, 0.9);
    --text-color: #881337;
    --text-secondary: #9F1239;
    --primary-color: #E11D48;
    --accent-color: #BE123C;
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(225, 29, 72, 0.3);
    --error-color: #DC2626;
}

[data-theme="light-cream"] {
    --bg-color: #FEFCE8;
    --container-bg: rgba(255, 255, 255, 0.9);
    --text-color: #713F12;
    --text-secondary: #854D0E;
    --primary-color: #EAB308;
    --accent-color: #CA8A04;
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(234, 179, 8, 0.3);
    --error-color: #DC2626;
}

/* ---------------------- {Core Setup} -------------------- */
html {
    font-size: calc(var(--font-base) * var(--font-scale));
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    width: 100%;
    overflow-x: hidden;
    transition: background-color var(--transition-speed), color var(--transition-speed);
}

/* --------------------- {Splash Screen} ------------------ */
#splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.8s ease-out;
}

.splash-logo {
    font-size: 5rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: 10px;
    text-shadow: 0 0 30px rgba(255, 255, 255, 0.5);
}

/* ------------------------ {Layout} ---------------------- */
.main-container {
    width: 100%;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2rem;
}

.timer-box {
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(25px);
    backdrop-filter: blur(25px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-lg);
    padding: 4rem 3rem;

    /* Fixed: Dynamic sizing to prevent overflow at large font scales */
    width: clamp(200px, 95%, 1200px);
    max-width: max-content;
    /* Allow stretching beyond 700px if needed */
    min-width: min-content;

    display: inline-block;
    /* Helps with content-based sizing */
    text-align: center;
    box-shadow: var(--shadow);
    position: relative;
    transition: transform 0.3s ease, width 0.3s ease;
    margin: 2rem auto;
}

/* -------------------- {Timer Display} ------------------- */
.timer-display {
    /* Set to use REM to follow font-scale exactly */
    font-size: 8rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    margin-bottom: 2rem;
    letter-spacing: -2px;
    line-height: 1.1;
    white-space: nowrap;
    /* Keep time on one line */
    width: 100%;
}

#error-message {
    color: var(--error-color);
    font-weight: 600;
    margin-bottom: 1.5rem;
    min-height: 1.5rem;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 1.2rem;
}

#error-message.show {
    opacity: 1;
}

/* --------------------- {Wheel Inputs} ------------------- */
.timer-inputs-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    margin-bottom: 3.5rem;
    -webkit-user-select: none;
    user-select: none;
    flex-wrap: wrap;
    /* Good for very large scales */
}

.wheel-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.2rem;
}

.wheel-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 1px;
}

.wheel-input {
    width: 6.5rem;
    height: 8.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem;
    border: 1px solid var(--glass-border);
}

[data-theme^="light"] .wheel-input {
    background: rgba(0, 0, 0, 0.05);
}

.wheel-val {
    font-size: 2.8rem;
    font-weight: 700;
    color: var(--text-color);
    line-height: 1;
}

.wheel-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.8rem;
    cursor: pointer;
    padding: 5px;
    width: 100%;
    transition: color 0.2s, background 0.2s;
    display: flex;
    justify-content: center;
    border-radius: 10px;
}

.wheel-btn:hover {
    color: var(--primary-color);
    background: rgba(255, 255, 255, 0.1);
}

/* --------------------- {Btn Controls} ------------------- */
.control-buttons {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    width: 100%;
    flex-wrap: wrap;
}

.btn {
    padding: 1.4rem 2.8rem;
    font-size: 1.3rem;
    font-weight: 600;
    border: none;
    border-radius: 40px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.btn:active {
    transform: scale(0.95);
}

.btn-start {
    background-color: #34C759;
    box-shadow: 0 4px 15px rgba(52, 199, 89, 0.3);
}

.btn-pause {
    background-color: #FFCC00;
    color: #000 !important;
    box-shadow: 0 4px 15px rgba(255, 204, 0, 0.3);
}

.btn-stop {
    background-color: #FF3B30;
    box-shadow: 0 4px 15px rgba(255, 59, 48, 0.3);
}

.btn-reset {
    background-color: var(--text-secondary);
}

/* -------------------- {Settings UI} --------------------- */
.settings-toggle {
    position: absolute;
    top: 2rem;
    right: 2.5rem;
    cursor: pointer;
    font-size: 1.8rem;
    color: var(--text-secondary);
    transition: transform 0.3s ease;
    z-index: 100;
}

.settings-toggle:hover {
    transform: rotate(90deg);
}

.settings-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 90%;
    max-width: 450px;
    background: var(--container-bg);
    -webkit-backdrop-filter: blur(35px);
    backdrop-filter: blur(35px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-lg);
    padding: 3rem;
    box-shadow: 0 30px 100px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.settings-panel.active {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

.close-settings {
    cursor: pointer;
    font-size: 1.8rem;
    color: var(--text-secondary);
}

.settings-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.cycle-btn {
    padding: 1rem 2rem;
    font-size: 1.4rem;
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 17px;
    cursor: pointer;
    min-width: 6rem;
    transition: transform 0.2s;
}

.cycle-btn:active {
    transform: scale(0.9);
}

/* --------------------- {Input Switches} ------------------ */
.switch {
    position: relative;
    display: inline-block;
    width: 51px;
    height: 31px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 27px;
    width: 27px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--primary-color);
}

input:checked+.slider:before {
    transform: translateX(20px);
}

/* ----------------------- {Utility} ---------------------- */
.hidden {
    display: none !important;
}