/* 
   WinUI 3 Design System for HTML5 - Final Consolidated Version
   High-fidelity replica for Windows 11 Fluent Design.
   Compatible with Chrome, Edge, and Firefox.
*/

html, body, div, span, h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, 
kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, 
center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td, article, aside, 
canvas, details, embed, figure, figcaption, footer, header, hgroup, 
menu, nav, output, ruby, section, summary, time, mark, audio, video {
    margin: 0; padding: 0; border: 0; font-size: 100%; vertical-align: baseline;
}

* { 
    box-sizing: border-box; 
    -webkit-font-smoothing: antialiased; 
    -moz-osx-font-smoothing: grayscale; 
    outline: none !important;
}

body { 
    line-height: 1.5; background-color: var(--wui-bg-page); color: var(--wui-text-main); 
    overflow-x: hidden; font-family: var(--wui-font-stack); padding: 30px; font-size: 14px;
}

/* --- Webkit Scrollbars (Chrome/Edge/WebView2) --- */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--wui-text-secondary); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--wui-accent); }

/* --- Standardizing Reset & Firefox Scrollbar --- */
html {
    scrollbar-width: auto; 
    scrollbar-color: var(--wui-text-secondary) transparent; 
}

/* --- Font Definitions --- */

/* Selawk */
@font-face { font-family: 'Selawk'; src: url('./fonts/selawk/selawk.woff2') format('woff2'); font-weight: normal; }
@font-face { font-family: 'Selawk'; src: url('./fonts/selawk/selawkb.woff2') format('woff2'); font-weight: bold; }
@font-face { font-family: 'Selawk'; src: url('./fonts/selawk/selawkl.woff2') format('woff2'); font-weight: 300; }
@font-face { font-family: 'Selawk'; src: url('./fonts/selawk/selawksb.woff2') format('woff2'); font-weight: 600; }
@font-face { font-family: 'Selawk'; src: url('./fonts/selawk/selawksl.woff2') format('woff2'); font-weight: 400; }

/* Fluent System Icons */
@font-face { font-family: 'Fluent System Icons'; src: url('./fonts/FluentSystemIcons/FluentSystemIcons-Filled.woff2') format('woff2'); font-weight: bold; }
@font-face { font-family: 'Fluent System Icons'; src: url('./fonts/FluentSystemIcons/FluentSystemIcons-Light.woff2') format('woff2'); font-weight: 300; }
@font-face { font-family: 'Fluent System Icons'; src: url('./fonts/FluentSystemIcons/FluentSystemIcons-Regular.woff2') format('woff2'); font-weight: normal; }
@font-face { font-family: 'Fluent System Icons Resizable'; src: url('./fonts/FluentSystemIcons/FluentSystemIcons-Resizable.woff2') format('woff2'); }

/* Fluent Emoji */
@font-face { font-family: 'Fluent Emoji Color'; src:url('./fonts/FluentEmoji/FluentEmojiColor.woff2') format('woff2'); font-display:block }
@font-face { font-family: 'Fluent Emoji Flat'; src:url('./fonts/FluentEmoji/FluentEmojiFlat.woff2') format('woff2'); font-display:block }
@font-face { font-family: 'Fluent Emoji High Contrast'; src:url('./fonts/FluentEmoji/FluentEmojiHighContrast.woff2') format('woff2'); font-display:block }
@font-face { font-family: 'Fluent Emoji High Contrast Inverted'; src:url('./fonts/FluentEmoji/FluentEmojiHighContrastInverted.woff2') format('woff2'); font-display:block }

:root {
    --wui-accent: #005fb8;
    --wui-accent-hover: #196ec0;
    --wui-accent-active: #3184ca;
    --wui-bg-page: #f3f3f3;
    --wui-bg-card: #ffffff;
    --wui-text-main: #1a1a1a;
    --wui-text-secondary: #616161;
    --wui-text-disabled: #9d9d9d;
    --wui-border-light: rgba(0, 0, 0, 0.08);
    --wui-border-strong: rgba(0, 0, 0, 0.44);
    --wui-control-bg: #fbfbfb;
    --wui-control-hover: #f6f6f6;
    --wui-track-bg: rgba(0, 0, 0, 0.1); 
    --wui-font-stack: "Selawik", sans-serif;
    --wui-icon-font: "Fluent System Icons";
    --wui-shadow: 0 2px 4px rgba(0,0,0,0.04);
}

@media (prefers-color-scheme: dark) {
    :root {
        --wui-bg-page: #202020;
        --wui-bg-card: #2c2c2c;
        --wui-text-main: #ffffff;
        --wui-text-secondary: #adadad;
        --wui-border-light: rgba(255, 255, 255, 0.08);
        --wui-border-strong: rgba(255, 255, 255, 0.54);
        --wui-control-bg: rgba(255, 255, 255, 0.06);
        --wui-control-hover: rgba(255, 255, 255, 0.09);
        --wui-accent: #60cdff;
        --wui-track-bg: rgba(255, 255, 255, 0.2); 
    }
}

/* --- Typography --- */
h1, h2, h3, h4 { font-weight: 600; margin: 0 0 12px 0; }
h1 { font-size: 28px; letter-spacing: -0.01em; }
h2 { font-size: 20px; }
p { margin-bottom: 12px; color: var(--wui-text-secondary); }
a { color: var(--wui-accent); text-decoration: none; border-radius: 4px; transition: 0.1s; display: inline-block; }
a:hover { background-color: var(--wui-control-hover); }

/* --- Buttons --- */
button, input[type="button"], input[type="submit"] {
    background-color: var(--wui-control-bg);
    border: 1px solid var(--wui-border-light);
    border-bottom: 1.3px solid var(--wui-border-strong);
    border-radius: 4px; color: var(--wui-text-main);
    padding: 0 16px; min-width: 100px; height: 32px;
    cursor: default; user-select: none;
    transition: all 0.1s cubic-bezier(0.7, 0, 0.3, 1);
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
button:active {
    transform: scale(0.98);
    background-color: rgba(128, 128, 128, 0.1);
}
button.primary {
    background-color: var(--wui-accent);
    border: 1px solid rgba(0,0,0,0.1);
    border-bottom: 1px solid rgba(0,0,0,0.3);
    color: #fff;
}
button:hover { background-color: var(--wui-control-hover); }

/* --- Inputs & Select --- */
input:not(
    [type="checkbox"], [type="radio"], [type="range"],
    [type="button"], [type="submit"], [type="reset"],
    [type="hidden"], [type="image"], [type="color"]
), select, textarea {
    background-color: var(--wui-control-bg);
    border: 1px solid var(--wui-border-light);
    border-bottom: 2px solid var(--wui-border-strong);
    border-radius: 4px; color: var(--wui-text-main);
    padding: 0 12px; line-height: 30px; height: 32px;
    transition: background 0.2s;
    outline: none !important;
    box-shadow: none !important;
}

select {
    appearance: none; -webkit-appearance: none; -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='grey' d='M1.5 3.5l4.5 4.5 4.5-4.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center;
    padding-right: 32px !important;
}

/* WinUI Focus */
input:focus, select:focus, textarea:focus { 
    background: var(--wui-bg-card); 
    border-bottom-color: var(--wui-accent); 
    outline: none !important;
    box-shadow: none !important;
}

/* --- Checkbox & Radio --- */
input[type="checkbox"], input[type="radio"] {
    appearance: none; width: 20px; height: 20px;
    border: 1px solid var(--wui-border-strong); border-radius: 4px;
    background: var(--wui-control-bg); vertical-align: middle;
    position: relative; cursor: pointer; margin-right: 8px;
    outline: none !important;
}
input[type="radio"] { border-radius: 50%; }
input[type="checkbox"]:checked, input[type="radio"]:checked { background-color: var(--wui-accent); border: none; }
input[type="checkbox"]:checked::after {
    content: "\F294"; font-family: var(--wui-icon-font); font-size: 10px;
    color: #fff; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
}
input[type="radio"]:checked::after {
    content: ""; width: 8px; height: 8px; background: #fff;
    border-radius: 50%; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
}

/* --- Progress Bar --- */
progress {
    appearance: none; -moz-appearance: none; -webkit-appearance: none;
    height: 4px; width: 100%; border: none; 
    background-color: var(--wui-track-bg); border-radius: 10px; 
    display: block; margin: 10px 0; overflow: hidden;
}
progress::-webkit-progress-bar { background-color: var(--wui-track-bg); border-radius: 10px; }
progress::-webkit-progress-value { background-color: var(--wui-accent); border-radius: 10px; transition: width 0.3s ease; }
progress::-moz-progress-bar { background-color: var(--wui-accent); border-radius: 10px; }

/* --- Volume Slider (Unified & Overlap Fixed) --- */
input[type="range"] {
    appearance: none; -webkit-appearance: none; -moz-appearance: none;
    background: transparent; cursor: pointer; width: 100%; height: 32px;
    outline: none !important;
}

/* Track Styling */
input[type="range"]::-webkit-slider-runnable-track { 
    background: var(--wui-track-bg); height: 4px; border-radius: 4px; 
    overflow: hidden; 
}
input[type="range"]::-moz-range-track { background: var(--wui-track-bg); height: 4px; border-radius: 4px; }

/* Fill Styling (Firefox Native) */
input[type="range"]::-moz-range-progress { background-color: var(--wui-accent); height: 4px; border-radius: 4px; }

/* Thumb Styling */
input[type="range"]::-webkit-slider-thumb {
    appearance: none; -webkit-appearance: none;
    height: 18px; width: 18px;
    background: var(--wui-accent); 
    border: 3px solid var(--wui-bg-card);
    border-radius: 50%; 
    margin-top: -7px;
    position: relative;
    box-shadow: -100vw 0 0 -6.5px var(--wui-accent); 
    z-index: 2;
}

input[type="range"]::-moz-range-thumb {
    appearance: none; height: 18px; width: 18px; 
    background: var(--wui-accent);
    border: 3px solid var(--wui-bg-card); 
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3); 
    box-sizing: border-box;
}

/* --- Tables & Lists --- */
table {
    width: 100%; border-spacing: 0; background: var(--wui-bg-card);
    border-radius: 8px; border: 1px solid var(--wui-border-light);
    box-shadow: var(--wui-shadow); overflow: hidden;
}
th {
    text-align: left; padding: 12px; font-weight: 600;
    background: rgba(128, 128, 128, 0.05); border-bottom: 1px solid var(--wui-border-light);
}
td { padding: 12px; border-bottom: 1px solid var(--wui-border-light); }
tr:hover { background: var(--wui-control-hover); }

/* --- Containers --- */
.card {
    background: var(--wui-bg-card); border: 1px solid var(--wui-border-light);
    border-radius: 8px; padding: 20px; box-shadow: var(--wui-shadow); margin-bottom: 20px;
}
details { background: var(--wui-bg-card); border: 1px solid var(--wui-border-light); border-radius: 8px; margin-bottom: 10px; }
summary {
    padding: 12px 16px;
    cursor: pointer;
    font-weight: 500;
    display: flex;
    justify-content: space-between;
    align-items: center;
    list-style: none;
}
summary::after { content: "\F2A3"; font-family: var(--wui-icon-font); font-size: 12px; transition: 0.2s; }
details[open] summary::after { transform: rotate(180deg); }
.details-content { padding: 0 16px 16px 16px; color: var(--wui-text-secondary); }

/* --- Icons --- */
.wui-icon { font-family: var(--wui-icon-font); font-style: normal; display: inline-block; vertical-align: middle; line-height: 1; }