/* Shared dark-mode overrides + the theme toggle button. Loaded on every page
   after its own stylesheet, since [data-theme] selectors already win on
   specificity over a page's plain :root. */

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --bg: #12151c;
        --surface: #1a1f2b;
        --border: #2b3040;
        --text: #e8eaf0;
        --text-muted: #9aa2b4;
        --primary: #5b8def;
        --primary-hover: #79a3f2;
        --primary-contrast: #0c1016;
        --success: #34c98a;
        --danger: #f0605c;
        --warning: #d9a441;
        --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 4px 16px rgba(0, 0, 0, .55);
    }
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #12151c;
    --surface: #1a1f2b;
    --border: #2b3040;
    --text: #e8eaf0;
    --text-muted: #9aa2b4;
    --primary: #5b8def;
    --primary-hover: #79a3f2;
    --primary-contrast: #0c1016;
    --success: #34c98a;
    --danger: #f0605c;
    --warning: #d9a441;
    --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 4px 16px rgba(0, 0, 0, .55);
}

.theme-toggle-btn {
    appearance: none;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    border-radius: 10px;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
}

.theme-toggle-btn:hover { border-color: var(--primary); }
.theme-toggle-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.theme-toggle-btn--floating {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 9999;
    box-shadow: var(--shadow);
}
