/* Botão de modo claro/escuro, comum a todas as telas (13/11/2026). Ver config/lib_tema.php.
   Cada tela pode ajustar as cores pelas variáveis --c4t-*, sem reescrever o botão.
   A paleta vem de assets/css/c4-paleta.css (17/11/2026). */

.c4-tema-btn {
    --c4t-fundo: rgba(var(--hub-fg-rgb), 0.06);
    --c4t-borda: var(--hub-line-2);
    --c4t-icone: var(--hub-muted);
    --c4t-ativo-fundo: rgba(var(--hub-accent-rgb), 0.18);
    --c4t-ativo-icone: var(--hub-accent);
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 3px;
    margin: 0;
    border: 1px solid var(--c4t-borda);
    border-radius: 999px;
    background: var(--c4t-fundo);
    cursor: pointer;
    font: inherit;
    line-height: 1;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}
/* No claro o lado ativo é uma pastilha branca sobre o trilho, não um tom de azul. */
html[data-tema="claro"] .c4-tema-btn {
    --c4t-ativo-fundo: var(--hub-card);
}
.c4-tema-btn:focus-visible { outline: 2px solid var(--c4t-ativo-icone); outline-offset: 2px; }

.c4-tema-op {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 28px;
    height: 26px;
    padding: 0 6px;
    border-radius: 999px;
    color: var(--c4t-icone);
    transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}
.c4-tema-op svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.c4-tema-op[data-op="escuro"] svg { fill: currentColor; stroke-width: 1.2; }
.c4-tema-btn:hover .c4-tema-op { color: var(--c4t-ativo-icone); }

.c4-tema-btn[data-ativo="claro"] .c4-tema-op[data-op="claro"],
.c4-tema-btn[data-ativo="escuro"] .c4-tema-op[data-op="escuro"] {
    background: var(--c4t-ativo-fundo);
    color: var(--c4t-ativo-icone);
}
html[data-tema="claro"] .c4-tema-btn[data-ativo="claro"] .c4-tema-op[data-op="claro"] {
    box-shadow: 0 1px 3px rgba(15, 27, 42, 0.14);
}

/* O texto fica para o leitor de tela; a tela que quiser mostrar usa .c4-tema-com-texto. */
.c4-tema-txt {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}
.c4-tema-com-texto .c4-tema-txt {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    font-size: 12px;
    font-weight: 600;
}

/* Tela sem lugar reservado para o botão: ele flutua no canto superior direito. */
.c4-tema-flutuante {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 2147483000;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
    background: var(--hub-topo);
    backdrop-filter: blur(8px);
}
html[data-tema="claro"] .c4-tema-flutuante {
    box-shadow: 0 4px 14px rgba(15, 27, 42, 0.14);
}
@media print { .c4-tema-btn { display: none !important; } }

/* Durante a troca nada anima, senão a tela fica listrada por meio segundo. */
html.c4-tema-trocando *,
html.c4-tema-trocando *::before,
html.c4-tema-trocando *::after { transition: none !important; }
