/**
 * Barra de Acessibilidade — estilos
 * Arquivo: public/css/a11y-bar.css
 *
 * Usado pelas views standalone (ex.: fluxo de cadastro) que não passam pelo
 * layout.php principal. Reaproveita as variáveis oklch (--teal, --coral, etc.)
 * já definidas em cada view para manter a identidade visual do site.
 *
 * As classes de efeito (body.high-contrast / body.cursor-large)
 * usam o MESMO nome de classes do public/css/accessibility.css (sistema global do
 * site), para que a preferência do usuário seja visualmente coerente em qualquer
 * página — e funcionam de forma universal (sem depender de seletores específicos
 * de cada layout), via filtros de cor e pilha de fontes.
 */

/* ===== Barra fixa ===== */
.a11y-bar {
    background: linear-gradient(90deg, var(--teal-deep), var(--teal));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 10px 60px;
    min-height: 50px;
    font-size: 0.82rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: relative;
    z-index: 50;
}

.a11y-bar .skip {
    position: absolute;
    left: -9999px;
    top: 0;
    background: #fff;
    color: var(--teal-deep);
    font-weight: 700;
    padding: 8px 15px;
    border-radius: 99px;
    text-decoration: none;
    transition: all 0.2s ease;
    z-index: 100;
}

.a11y-bar .skip:focus {
    position: static;
    left: auto;
    display: inline-block;
}

.a11y-bar .skip:hover,
.a11y-bar .skip:focus {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.a11y-tools {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-left: auto;
}

.a11y-tools .label {
    opacity: 0.9;
    font-weight: 600;
    white-space: nowrap;
}

.a11y-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 99px;
    padding: 7px 15px;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
}

.a11y-btn:hover,
.a11y-btn:focus-visible {
    background: rgba(255, 255, 255, 0.28);
    transform: translateY(-1px);
}

.a11y-btn[aria-pressed="true"] {
    background: #fff;
    color: var(--teal-deep);
    border-color: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
}

/*
 * Os botões usam ligaduras de ícone (ex.: "contrast", "visibility") que só
 * viram glifo quando a fonte de ícones está aplicada. Páginas que já carregam
 * essa regra globalmente (layout.php / registro.css) ficam OK de qualquer
 * forma — mas as views standalone que só incluem este arquivo (dashboards de
 * Colaborador/Profissional/Empresa/Admin etc.) ficavam mostrando o nome cru do
 * ícone como texto. Declarando aqui, a barra funciona em qualquer página.
 */
.a11y-bar .ic {
    font-family: 'Material Symbols Rounded';
    font-weight: normal;
    font-style: normal;
    line-height: 1;
    display: inline-block;
    white-space: nowrap;
    direction: ltr;
    -webkit-font-smoothing: antialiased;
}

.a11y-btn .ic {
    font-size: 18px;
}

.a11y-btn-reset {
    background: rgba(255, 255, 255, 0.08);
    border-style: dashed;
}

.a11y-group {
    display: inline-flex;
    border-radius: 99px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.a11y-mini {
    background: transparent;
    color: #fff;
    border: none;
    font-family: inherit;
    font-weight: 700;
    padding: 7px 14px;
    cursor: pointer;
    font-size: 0.8rem;
    line-height: 1;
    transition: all 0.25s ease;
}

.a11y-mini:hover,
.a11y-mini:focus-visible {
    background: rgba(255, 255, 255, 0.22);
}

.a11y-bar button:focus-visible,
.a11y-bar a:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

@media (max-width: 1200px) {
    .a11y-bar {
        padding: 10px 30px;
    }
}

@media (max-width: 720px) {
    .a11y-bar {
        justify-content: center;
        text-align: center;
    }

    .a11y-tools {
        margin-left: 0;
        justify-content: center;
    }

    .a11y-btn-text {
        display: none;
    }
}

/* ===== Toast de confirmação (criado dinamicamente pelo a11y-bar.js) ===== */
.a11y-toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    transform: translateX(-50%) translateY(12px);
    background: var(--ink);
    color: #fff;
    padding: 12px 22px;
    border-radius: 99px;
    font-size: 0.92rem;
    font-weight: 600;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.25);
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.a11y-toast.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* =====================================================================
   EFEITOS GLOBAIS — aplicados via classes no <body>
   Funcionam em QUALQUER página (não dependem de classes específicas de
   layout), e usam os mesmos nomes do sistema global (accessibility.css)
   para consistência ao navegar entre o cadastro e o resto do site.
   ===================================================================== */

/* --- Alto contraste: inverte cores de forma universal e devolve mídia ao normal --- */
body.high-contrast {
    filter: invert(1) hue-rotate(180deg) !important;
    background: #fff !important;
}

body.high-contrast img,
body.high-contrast svg,
body.high-contrast video,
body.high-contrast picture,
body.high-contrast .ic,
body.high-contrast .header-emoji,
body.high-contrast .card-emoji,
body.high-contrast .quase-la-emoji {
    filter: invert(1) hue-rotate(180deg) !important;
}

body.high-contrast .a11y-bar,
body.high-contrast .a11y-bar * {
    filter: none !important;
}

body.high-contrast .a11y-bar {
    background: #000 !important;
    border-bottom: 2px solid #fff;
}

body.high-contrast .a11y-btn,
body.high-contrast .a11y-mini,
body.high-contrast .a11y-bar .skip {
    border-color: #fff !important;
}

/* --- Cursor ampliado: cursor SVG grande e bem visível em todo o documento --- */
body.cursor-large,
body.cursor-large * {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40"><circle cx="20" cy="20" r="15" fill="none" stroke="black" stroke-width="3"/><circle cx="20" cy="20" r="4" fill="black"/></svg>') 20 20, auto !important;
}

body.cursor-large.high-contrast,
body.cursor-large.high-contrast * {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40"><circle cx="20" cy="20" r="15" fill="none" stroke="white" stroke-width="3"/><circle cx="20" cy="20" r="4" fill="white"/></svg>') 20 20, auto !important;
}

body.cursor-large a,
body.cursor-large button,
body.cursor-large .btn,
body.cursor-large input,
body.cursor-large select,
body.cursor-large textarea,
body.cursor-large [role="button"] {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="44" height="44" viewBox="0 0 44 44"><circle cx="22" cy="22" r="16" fill="black" fill-opacity="0.15" stroke="black" stroke-width="3"/><circle cx="22" cy="22" r="4" fill="black"/></svg>') 22 22, pointer !important;
}

/* --- Reduz movimento quando o usuário pede (alinhado ao restante do site) --- */
@media (prefers-reduced-motion: reduce) {
    .a11y-toast {
        transition: none;
    }
}

body.a11y-reduce-motion *,
body.a11y-reduce-motion *::before,
body.a11y-reduce-motion *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
}
