/* =========================================================
   HOTFLIXX — TEMAS DOS PAINÉIS (gerado)
   5 estilos × modo escuro/claro. Padrão: hotflixx escuro.
========================================================= */

:root,
:root[data-palette="hotflixx"][data-mode="dark"] {
    color-scheme: dark;
    --bg: #080808;
    --bg-soft: #0b0b0b;
    --surface: #111111;
    --surface-2: #161616;
    --surface-3: #202020;
    --border: #252525;
    --border-strong: #363636;
    --text: #f7f7f7;
    --text-soft: #c7c7c7;
    --text-muted: #999999;
    --text-faint: #787878;
    --success: #3ccf86;
    --warning: #e7c15a;
    --danger: #f26b6b;
    --info: #6aa8ff;
    --accent: #e50914;
    --accent-hover: #f2252f;
    --accent-strong: #8f060d;
    --on-accent: #ffffff;
    --shadow-color: 0 0 0;
    --shadow-alpha: 1;
}

:root[data-palette="hotflixx"][data-mode="light"] {
    color-scheme: light;
    --bg: #f6f6f6;
    --bg-soft: #ffffff;
    --surface: #ffffff;
    --surface-2: #f9f9f9;
    --surface-3: #ededed;
    --border: #e3e3e3;
    --border-strong: #cccccc;
    --text: #171717;
    --text-soft: #454545;
    --text-muted: #616161;
    --text-faint: #787878;
    --success: #13824a;
    --warning: #9a6700;
    --danger: #c8242c;
    --info: #1f64d6;
    --accent: #d10a14;
    --accent-hover: #b8070f;
    --accent-strong: #8f060d;
    --on-accent: #ffffff;
    --shadow-color: 16 24 40;
    --shadow-alpha: 0.35;
}

:root[data-palette="oceano"][data-mode="dark"] {
    color-scheme: dark;
    --bg: #06080a;
    --bg-soft: #080b0e;
    --surface: #0c1016;
    --surface-2: #10151c;
    --surface-3: #171e29;
    --border: #1d232d;
    --border-strong: #2a3342;
    --text: #f6f7f8;
    --text-soft: #bfc5cf;
    --text-muted: #8b96a7;
    --text-faint: #677489;
    --success: #3ccf86;
    --warning: #e7c15a;
    --danger: #f26b6b;
    --info: #6aa8ff;
    --accent: #4f8ff7;
    --accent-hover: #6aa1f8;
    --accent-strong: #1e4fae;
    --on-accent: #06122b;
    --shadow-color: 0 0 0;
    --shadow-alpha: 1;
}

:root[data-palette="oceano"][data-mode="light"] {
    color-scheme: light;
    --bg: #f3f6f9;
    --bg-soft: #ffffff;
    --surface: #ffffff;
    --surface-2: #f7f8fb;
    --surface-3: #e9ecf1;
    --border: #dde2e9;
    --border-strong: #c3cad5;
    --text: #10161e;
    --text-soft: #384251;
    --text-muted: #525e6f;
    --text-faint: #687588;
    --success: #13824a;
    --warning: #9a6700;
    --danger: #c8242c;
    --info: #1f64d6;
    --accent: #2563eb;
    --accent-hover: #1d4fd0;
    --accent-strong: #1e3a8a;
    --on-accent: #ffffff;
    --shadow-color: 16 24 40;
    --shadow-alpha: 0.35;
}

:root[data-palette="esmeralda"][data-mode="dark"] {
    color-scheme: dark;
    --bg: #060a09;
    --bg-soft: #090e0c;
    --surface: #0d1512;
    --surface-2: #111b17;
    --surface-3: #192722;
    --border: #1e2b27;
    --border-strong: #2c3f38;
    --text: #f7f8f8;
    --text-soft: #c1cdc9;
    --text-muted: #8ea49c;
    --text-faint: #6b857b;
    --success: #3ccf86;
    --warning: #e7c15a;
    --danger: #f26b6b;
    --info: #6aa8ff;
    --accent: #34d399;
    --accent-hover: #5ee0b0;
    --accent-strong: #0f7a57;
    --on-accent: #04261b;
    --shadow-color: 0 0 0;
    --shadow-alpha: 1;
}

:root[data-palette="esmeralda"][data-mode="light"] {
    color-scheme: light;
    --bg: #f4f8f7;
    --bg-soft: #ffffff;
    --surface: #ffffff;
    --surface-2: #f7faf9;
    --surface-3: #eaf1ee;
    --border: #dee8e4;
    --border-strong: #c4d4ce;
    --text: #111d18;
    --text-soft: #3b4f48;
    --text-muted: #556d64;
    --text-faint: #6a857b;
    --success: #13824a;
    --warning: #9a6700;
    --danger: #c8242c;
    --info: #1f64d6;
    --accent: #047857;
    --accent-hover: #03644a;
    --accent-strong: #064e3b;
    --on-accent: #ffffff;
    --shadow-color: 16 24 40;
    --shadow-alpha: 0.35;
}

:root[data-palette="violeta"][data-mode="dark"] {
    color-scheme: dark;
    --bg: #08060a;
    --bg-soft: #0a080e;
    --surface: #100c15;
    --surface-2: #14101c;
    --surface-3: #1e1828;
    --border: #231d2d;
    --border-strong: #332a41;
    --text: #f7f7f8;
    --text-soft: #c5c0ce;
    --text-muted: #958ca6;
    --text-faint: #746887;
    --success: #3ccf86;
    --warning: #e7c15a;
    --danger: #f26b6b;
    --info: #6aa8ff;
    --accent: #a78bfa;
    --accent-hover: #bba5fb;
    --accent-strong: #5b3bc4;
    --on-accent: #170b3b;
    --shadow-color: 0 0 0;
    --shadow-alpha: 1;
}

:root[data-palette="violeta"][data-mode="light"] {
    color-scheme: light;
    --bg: #f5f3f9;
    --bg-soft: #ffffff;
    --surface: #ffffff;
    --surface-2: #f8f7fb;
    --surface-3: #ece9f1;
    --border: #e1dde9;
    --border-strong: #cac3d5;
    --text: #15101e;
    --text-soft: #423851;
    --text-muted: #5d526f;
    --text-faint: #746888;
    --success: #13824a;
    --warning: #9a6700;
    --danger: #c8242c;
    --info: #1f64d6;
    --accent: #6d3fe0;
    --accent-hover: #5b2fc9;
    --accent-strong: #4c1d95;
    --on-accent: #ffffff;
    --shadow-color: 16 24 40;
    --shadow-alpha: 0.35;
}

:root[data-palette="preto"][data-mode="dark"] {
    color-scheme: dark;
    --bg: #080808;
    --bg-soft: #0b0b0b;
    --surface: #111111;
    --surface-2: #161616;
    --surface-3: #202020;
    --border: #252525;
    --border-strong: #363636;
    --text: #f7f7f7;
    --text-soft: #c7c7c7;
    --text-muted: #999999;
    --text-faint: #787878;
    --success: #3ccf86;
    --warning: #e7c15a;
    --danger: #f26b6b;
    --info: #6aa8ff;
    --accent: #f5f5f5;
    --accent-hover: #ffffff;
    --accent-strong: #a3a3a3;
    --on-accent: #0a0a0a;
    --shadow-color: 0 0 0;
    --shadow-alpha: 1;
}

:root[data-palette="preto"][data-mode="light"] {
    color-scheme: light;
    --bg: #f6f6f6;
    --bg-soft: #ffffff;
    --surface: #ffffff;
    --surface-2: #f9f9f9;
    --surface-3: #ededed;
    --border: #e3e3e3;
    --border-strong: #cccccc;
    --text: #171717;
    --text-soft: #454545;
    --text-muted: #616161;
    --text-faint: #787878;
    --success: #13824a;
    --warning: #9a6700;
    --danger: #c8242c;
    --info: #1f64d6;
    --accent: #141414;
    --accent-hover: #000000;
    --accent-strong: #525252;
    --on-accent: #ffffff;
    --shadow-color: 16 24 40;
    --shadow-alpha: 0.35;
}

:root[data-palette="ambar"][data-mode="dark"] {
    color-scheme: dark;
    --bg: #0a0806;
    --bg-soft: #0e0b08;
    --surface: #15110c;
    --surface-2: #1c1610;
    --surface-3: #282018;
    --border: #2d251d;
    --border-strong: #41362a;
    --text: #f8f7f7;
    --text-soft: #cec7c0;
    --text-muted: #a69a8c;
    --text-faint: #877968;
    --success: #3ccf86;
    --warning: #e7c15a;
    --danger: #f26b6b;
    --info: #6aa8ff;
    --accent: #f5a524;
    --accent-hover: #f7b54d;
    --accent-strong: #a85f06;
    --on-accent: #241400;
    --shadow-color: 0 0 0;
    --shadow-alpha: 1;
}

:root[data-palette="ambar"][data-mode="light"] {
    color-scheme: light;
    --bg: #f9f6f3;
    --bg-soft: #ffffff;
    --surface: #ffffff;
    --surface-2: #fbf9f7;
    --surface-3: #f1ede9;
    --border: #e9e3dd;
    --border-strong: #d5cdc3;
    --text: #1e1710;
    --text-soft: #514638;
    --text-muted: #6f6252;
    --text-faint: #887968;
    --success: #13824a;
    --warning: #9a6700;
    --danger: #c8242c;
    --info: #1f64d6;
    --accent: #b45309;
    --accent-hover: #9a4607;
    --accent-strong: #7c2d12;
    --on-accent: #ffffff;
    --shadow-color: 16 24 40;
    --shadow-alpha: 0.35;
}

/* =========================================================
   TRANSIÇÃO SUAVE ao mudar de estilo/modo
========================================================= */

html.theme-switching,
html.theme-switching *,
html.theme-switching *::before,
html.theme-switching *::after {
    transition:
        background-color 0.45s ease,
        border-color 0.45s ease,
        color 0.45s ease,
        fill 0.45s ease,
        box-shadow 0.45s ease !important;
}

@media (prefers-reduced-motion: reduce) {
    html.theme-switching,
    html.theme-switching * {
        transition: none !important;
    }
}

body {
    background-color: var(--bg);
    color: var(--text);
}

::selection {
    background: color-mix(in srgb, var(--accent) 30%, transparent);
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}


/* =========================================================
   BOTÃO + PAINEL "APARÊNCIA"
========================================================= */

.theme-button {
    width: 38px;
    height: 38px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    flex-shrink: 0;

    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;

    color: var(--text-soft);
    cursor: pointer;

    transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.theme-button:hover {
    border-color: var(--border-strong);
    color: var(--text);
}

.theme-button svg {
    width: 18px;
    height: 18px;
}

.theme-popover {
    position: fixed;
    z-index: 5000;

    width: min(340px, calc(100vw - 24px));

    padding: 18px;

    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 16px;

    color: var(--text);

    box-shadow: 0 24px 60px rgb(var(--shadow-color) / calc(0.5 * var(--shadow-alpha)));

    opacity: 0;
    transform: translateY(-6px) scale(0.98);
    pointer-events: none;

    transition: opacity 0.18s ease, transform 0.18s ease;
}

.theme-popover.open {
    opacity: 1;
    transform: none;
    pointer-events: auto;
}

.theme-popover h4 {
    margin: 0 0 4px;
    font-size: 14px;
    font-weight: 750;
}

.theme-popover p {
    margin: 0 0 14px;
    color: var(--text-muted);
    font-size: 12px;
}

.theme-label {
    display: block;
    margin: 14px 0 8px;

    color: var(--text-muted);

    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1.2px;
    text-transform: uppercase;
}

.theme-modes {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;

    padding: 4px;

    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 11px;
}

.theme-modes button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;

    padding: 8px 6px;

    background: transparent;
    border: 0;
    border-radius: 8px;

    color: var(--text-muted);

    font: inherit;
    font-size: 12px;
    font-weight: 650;

    cursor: pointer;
}

.theme-modes button svg {
    width: 14px;
    height: 14px;
}

.theme-modes button:hover {
    color: var(--text);
}

.theme-modes button[aria-pressed="true"] {
    background: var(--surface-3);
    color: var(--text);
    box-shadow: 0 1px 3px rgb(var(--shadow-color) / calc(0.25 * var(--shadow-alpha)));
}

.theme-palettes {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.theme-swatch {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;

    padding: 8px 2px;

    background: transparent;
    border: 1px solid transparent;
    border-radius: 11px;

    color: var(--text-muted);

    font: inherit;
    font-size: 10px;
    font-weight: 650;

    cursor: pointer;
}

.theme-swatch:hover {
    background: var(--surface-2);
    color: var(--text);
}

.theme-swatch[aria-pressed="true"] {
    border-color: var(--accent);
    color: var(--text);
}

.theme-dot {
    position: relative;

    width: 34px;
    height: 34px;

    border-radius: 50%;

    background: linear-gradient(135deg, var(--sw-bg) 0 50%, var(--sw-accent) 50% 100%);
    box-shadow: inset 0 0 0 1px rgb(127 127 127 / 0.35);
}

.theme-swatch[aria-pressed="true"] .theme-dot::after {
    content: "✓";

    position: absolute;
    inset: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    color: #ffffff;

    font-size: 14px;
    font-weight: 900;
    text-shadow: 0 1px 3px rgb(0 0 0 / 0.6);
}

.theme-reset {
    width: 100%;
    margin-top: 14px;
    padding: 9px;

    background: transparent;
    border: 1px dashed var(--border-strong);
    border-radius: 9px;

    color: var(--text-muted);

    font: inherit;
    font-size: 12px;
    cursor: pointer;
}

.theme-reset:hover {
    color: var(--text);
}


/* =========================================================
   INTERRUPTOR (ligado/desligado)
========================================================= */

.switch-row {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 18px;

    margin: 20px 0 0 !important;
    padding: 15px 16px;

    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 11px;

    cursor: pointer;
}

.switch-text strong {
    display: block;
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
}

.switch-text small {
    display: block;
    margin-top: 4px !important;
    color: var(--text-muted) !important;
    font-size: 11px !important;
    font-weight: 500;
    line-height: 1.5;
}

.switch {
    position: relative;
    flex-shrink: 0;
    width: 46px;
    height: 26px;
}

.switch input {
    position: absolute;
    opacity: 0;
    width: 100% !important;
    height: 100%;
    margin: 0;
    cursor: pointer;
}

.switch-slider {
    position: absolute;
    inset: 0;

    background: var(--surface-3);
    border: 1px solid var(--border-strong);
    border-radius: 999px;

    transition: background 0.2s ease, border-color 0.2s ease;
    pointer-events: none;
}

.switch-slider::after {
    content: "";

    position: absolute;
    top: 3px;
    left: 3px;

    width: 18px;
    height: 18px;

    background: var(--text-muted);
    border-radius: 50%;

    transition: transform 0.2s ease, background 0.2s ease;
}

.switch input:checked + .switch-slider {
    background: var(--accent);
    border-color: var(--accent);
}

.switch input:checked + .switch-slider::after {
    transform: translateX(20px);
    background: var(--on-accent);
}

.switch input:focus-visible + .switch-slider {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}


/* Ícone da app */
.theme-icons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.theme-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;

    padding: 10px 4px 8px;

    /* fundo xadrez discreto para ver o ícone sem fundo */
    background:
        repeating-conic-gradient(color-mix(in srgb, var(--text) 7%, transparent) 0 25%, transparent 0 50%) 0 0 / 12px 12px,
        var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 11px;

    color: var(--text-muted);

    font: inherit;
    font-size: 11px;
    font-weight: 650;

    cursor: pointer;
}

.theme-icon img {
    width: 34px;
    height: 34px;
    border-radius: 8px;
}

.theme-icon[aria-pressed="true"] {
    border-color: var(--accent);
    color: var(--text);
}

.theme-hint {
    margin: 8px 0 0 !important;
    font-size: 11px !important;
}

.theme-popover {
    max-height: calc(100vh - 90px);
    overflow-y: auto;
}
