@import url('https://fonts.cdnfonts.com/css/lcd');
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Display:wght@300;400;500&family=Tektur:wght@400;500;550&display=swap');

/* ── CSS Custom Properties (Theme Tokens) ── */
:root {
    /* Default: Site theme (Solarized Dark) */
    --bg-primary: #002b36;
    --bg-secondary: #073642;
    --text-primary: #9ab2bb;
    --text-muted: #839496;
    --accent: rgb(82, 215, 170);
    --accent-hover: #268bd2;
    --border: #586e75;
    --timer-label: rgb(82, 215, 170);
    --elapsed-stroke: #586e75;
    --modal-bg: #073642;
    --modal-text: #9ab2bb;
    --modal-border: #586e75;
    --input-bg: #002b36;
    --input-text: #9ab2bb;
    --input-border: #586e75;
    --btn-bg: rgb(82, 215, 170);
    --btn-text: #002b36;
    --btn-hover-bg: #268bd2;
    --btn-hover-text: #fff;
    --switcher-bg: #073642;
    --switcher-active: rgb(82, 215, 170);
    --gradient-start: rgb(82, 215, 170);
    --gradient-mid: #268bd2;
    --gradient-end: #dc322f;
}

[data-theme="dark"] {
    --bg-primary: #000000;
    --bg-secondary: #111111;
    --text-primary: #c9d1d9;
    --text-muted: #8b949e;
    --accent: #58a6ff;
    --accent-hover: #79c0ff;
    --border: #30363d;
    --timer-label: #58a6ff;
    --elapsed-stroke: #30363d;
    --modal-bg: #111111;
    --modal-text: #c9d1d9;
    --modal-border: #30363d;
    --input-bg: #000000;
    --input-text: #c9d1d9;
    --input-border: #30363d;
    --btn-bg: #238636;
    --btn-text: #fff;
    --btn-hover-bg: #2ea043;
    --btn-hover-text: #fff;
    --switcher-bg: #111111;
    --switcher-active: #58a6ff;
    --gradient-start: #58a6ff;
    --gradient-mid: #f0883e;
    --gradient-end: #f85149;
}

[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --text-primary: #333333;
    --text-muted: #666666;
    --accent: #268bd2;
    --accent-hover: #2aa198;
    --border: #ccc;
    --timer-label: #d33682;
    --elapsed-stroke: #ccc;
    --modal-bg: #f5f5f5;
    --modal-text: #333333;
    --modal-border: #ccc;
    --input-bg: #ffffff;
    --input-text: #333333;
    --input-border: #93a1a1;
    --btn-bg: #268bd2;
    --btn-text: #ffffff;
    --btn-hover-bg: #2aa198;
    --btn-hover-text: #ffffff;
    --switcher-bg: #f5f5f5;
    --switcher-active: #268bd2;
    --gradient-start: #268bd2;
    --gradient-mid: #b58900;
    --gradient-end: #dc322f;
}

/* ── Base Styles ── */
*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body {
    font-family: "Noto Sans Display", sans-serif;
    font-optical-sizing: auto;
    font-weight: 300;
    font-style: normal;
    color: var(--text-primary);
    background-color: var(--bg-primary) !important;
    transition: background-color 0.3s ease, color 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

/* ── Theme Switcher ── */
.theme-switcher {
    position: fixed;
    top: 14px;
    left: 14px;
    display: flex;
    gap: 0;
    background: var(--switcher-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 3px;
    z-index: 1000;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.theme-switcher button {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 16px;
    line-height: 1;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-switcher button:hover {
    color: var(--accent);
}

.theme-switcher button.active {
    background: var(--bg-primary);
    color: var(--switcher-active);
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* ── Settings Button ── */
.settings-button {
    position: fixed;
    top: 14px;
    right: 14px;
    background: var(--btn-bg);
    color: var(--btn-text);
    border: none;
    border-radius: 8px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.2s ease;
    z-index: 1000;
}

.settings-button:hover {
    background: var(--btn-hover-bg);
    color: var(--btn-hover-text);
    transform: rotate(45deg);
}

/* ── Timer ── */
.base-timer {
    position: relative;
    width: min(650px, 85vw);
    height: min(650px, 85vw);
    margin: auto;
}

.base-timer__svg {
    transform: scaleX(-1);
    filter: drop-shadow(0 0 20px rgba(82, 215, 170, 0.15));
    transition: filter 0.3s ease;
}

[data-theme="dark"] .base-timer__svg {
    filter: drop-shadow(0 0 20px rgba(88, 166, 255, 0.15));
}

[data-theme="light"] .base-timer__svg {
    filter: drop-shadow(0 0 20px rgba(38, 139, 210, 0.15));
}

.base-timer__circle {
    fill: none;
    stroke: none;
}

.base-timer__path-elapsed {
    stroke-width: 8px;
    stroke: var(--elapsed-stroke);
    /* LED segment effect: small dashes with gaps to look like discrete LED segments */
    stroke-dasharray: 3.4 1.2;
    stroke-linecap: butt;
    opacity: 0.3;
    transform: rotate(90deg);
    transform-origin: center;
    transition: stroke 0.3s ease;
}

.base-timer__path-remaining {
    stroke-width: 7px;
    stroke-linecap: butt;
    transform: rotate(90deg);
    transform-origin: center;
    transition: 0.3s linear stroke-dasharray;
    fill-rule: nonzero;
    stroke: url(#gradient);
}

.base-timer__path-remaining.green {
    stroke: url(#gradient);
}

.base-timer__path-remaining.orange {
    color: orange;
}

.base-timer__path-remaining.red {
    color: red;
}

.base-timer__label {
    position: absolute;
    width: min(650px, 85vw);
    height: min(650px, 85vw);
    top: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 120px !important;
    font-weight: 400 !important;
    letter-spacing: 0.3px;
    color: var(--timer-label);
    font-family: 'LCD2', monospace !important;
    transition: color 0.3s ease;
}

/* ── Modal Overrides ── */
.modal-content {
    background-color: var(--modal-bg) !important;
    color: var(--modal-text) !important;
    border: 1px solid var(--modal-border) !important;
    border-radius: 10px;
}

.modal-header {
    border-bottom-color: var(--modal-border) !important;
}

.modal-footer {
    border-top-color: var(--modal-border) !important;
}

.modal-title {
    font-family: "Tektur", sans-serif;
    font-weight: 400;
    color: var(--accent) !important;
    font-size: 18px;
}

.modal .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

[data-theme="light"] .modal .btn-close {
    filter: none;
}

.modal .form-control {
    background-color: var(--input-bg) !important;
    color: var(--input-text) !important;
    border: 1px solid var(--input-border) !important;
    font-family: 'LCD2', monospace;
    font-size: 24px;
    text-align: center;
}

.modal .form-control:focus {
    box-shadow: 0 0 0 3px rgba(82, 215, 170, 0.25) !important;
    border-color: var(--accent) !important;
}

.modal .btn-primary {
    background-color: var(--btn-bg) !important;
    color: var(--btn-text) !important;
    border: none !important;
    font-family: "Tektur", sans-serif;
    font-weight: 500;
    padding: 8px 32px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.modal .btn-primary:hover {
    background-color: var(--btn-hover-bg) !important;
    color: var(--btn-hover-text) !important;
}

/* ── Responsive ── */
@media screen and (max-width: 480px) {
    .theme-switcher {
        top: 8px;
        left: 8px;
        padding: 2px;
    }

    .theme-switcher button {
        padding: 5px 8px;
        font-size: 14px;
    }

    .settings-button {
        top: 8px;
        right: 8px;
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
}

