/**
 * @fileoverview MultiFala Styles v1.1
 * @description  Todo o CSS da aplicação unificado em um único arquivo.
 *               Organizado por seções para fácil manutenção.
 *
 * Seções:
 *   1. Reset & Design Tokens (variáveis CSS)
 *   2. Acessibilidade (skip-link, focus-visible)
 *   3. Layout base (html, body, hidden)
 *   4. Toast / Notificações
 *   5. Tela de autenticação
 *   6. Modal (Termos / Privacidade)
 *   7. App Shell (topbar, nav)
 *   8. View Social (vídeo, chat, controles)
 *   9. View E-mail (upload, formulário, log)
 *  10. Chat Bubbles
 *  11. Footer fixo
 *  12. Page Overlay (páginas internas)
 *  13. Painel de Acessibilidade
 *  14. Responsivo (media queries)
 *
 * @version 1.1.0
 */

/* ══════════════════════════════════════════
   1. RESET & DESIGN TOKENS
══════════════════════════════════════════ */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg:      #fff7ed;
    --card:    #ffffff;
    --surf:    #fff3e0;
    --surf1:   #fff3e0;
    --surf2:   #ffe8c8;
    --border:  #fed7aa;
    --accent:  #ea580c;
    --green:   #16a34a;
    --red:     #dc2626;
    --yellow:  #f59e0b;
    --white:   #431407;
    --text:    #431407;
    --sub:     #9a3412;
    --muted:   #c2783a;
    --dark:    #ffffff;
    --font:    'Plus Jakarta Sans', system-ui, sans-serif;
}

html, body {
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    overflow: hidden;
}

/* ══════════════════════════════════════════
   2. ACESSIBILIDADE
══════════════════════════════════════════ */

/* Skip link — permite pular para conteúdo principal via teclado */
.skip-link {
    position: absolute;
    top: -40px;
    left: 16px;
    background: var(--accent);
    color: #ffffff;
    padding: 8px 16px;
    border-radius: 0 0 8px 8px;
    font-size: 13px;
    font-weight: 700;
    z-index: 9999;
    text-decoration: none;
    transition: top .2s;
}
.skip-link:focus { top: 0; }

/* Focus visible — indicador de teclado em todos os elementos interativos */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 4px;
}
button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

/* ══════════════════════════════════════════
   3. LAYOUT BASE
══════════════════════════════════════════ */

.hidden { display: none !important; }

/* ══════════════════════════════════════════
   4. TOAST / NOTIFICAÇÕES
══════════════════════════════════════════ */

#toast-root {
    position: fixed;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .4rem;
    pointer-events: none;
    width: max-content;
    max-width: 90vw;
}

.toast {
    padding: .55rem 1.2rem;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    background: var(--card);
    border: 1px solid var(--border);
    box-shadow: 0 8px 24px rgba(120,50,0,.15);
    animation: slideUp .2s ease-out;
}
.toast.info { border-left: 3px solid var(--accent); color: var(--accent); }
.toast.err  { border-left: 3px solid var(--red);    color: var(--red); }

@keyframes slideUp {
    from { transform: translateY(10px); opacity: 0; }
    to   { opacity: 1; }
}

/* ══════════════════════════════════════════
   5. TELA DE AUTENTICAÇÃO
══════════════════════════════════════════ */

/* ══════════════════════════════════════════
   5. TELA DE BOAS-VINDAS
══════════════════════════════════════════ */
#auth-shell {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, #fff3e0 0%, #fff7ed 60%, #fde8d0 100%);
    padding: 2rem 1.5rem max(4rem, calc(56px + env(safe-area-inset-bottom, 0px)));
}

/* Card central */
.auth-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    width: 100%;
    max-width: 360px;
    background: rgba(255,255,255,.65);
    border: 1px solid rgba(234,88,12,.15);
    border-radius: 24px;
    padding: 36px 28px 28px;
    box-shadow: 0 8px 40px rgba(234,88,12,.10), 0 2px 8px rgba(0,0,0,.06);
    backdrop-filter: blur(8px);
    animation: authCardIn .5s cubic-bezier(.34,1.56,.64,1) both;
}

@keyframes authCardIn {
    from { opacity:0; transform:translateY(24px) scale(.97) }
    to   { opacity:1; transform:translateY(0) scale(1) }
}

/* Logo */
.auth-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.auth-logo-mark {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    background: var(--accent);
    color: #fff;
    font-size: 42px;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 24px rgba(234,88,12,.35);
    animation: logoFloat 4s ease-in-out infinite;
}

@keyframes logoFloat {
    0%,100% { transform: translateY(0) }
    50%      { transform: translateY(-5px) }
}

.auth-logo-text {
    font-size: 28px;
    font-weight: 900;
    letter-spacing: -1px;
    line-height: 1;
}

.auth-logo-multi { color: var(--accent); }
.auth-logo-fala  { color: var(--text); }

/* Tagline */
.auth-tagline {
    font-size: 13px;
    color: var(--sub);
    font-style: italic;
    text-align: center;
    margin: 4px 0 0;
    opacity: .85;
}

/* Divisor */
.auth-divider {
    width: 40px;
    height: 2px;
    background: var(--accent);
    border-radius: 2px;
    margin: 20px auto;
    opacity: .4;
}

/* Diferenciais */
.auth-features {
    list-style: none;
    padding: 0;
    margin: 0 0 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.auth-features li {
    display: block;
}

.auth-feat-icon { display: none; }

.auth-features li div {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.auth-features li strong {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
}

.auth-features li span {
    font-size: 12px;
    color: var(--sub);
    line-height: 1.4;
}

/* Botão Começar */
#btn-auth {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    background: var(--accent);
    color: #ffffff;
    border: none;
    border-radius: 50px;
    padding: 14px 32px;
    font: 700 15px var(--font);
    letter-spacing: .4px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(234,88,12,.35);
    transition: background .2s, transform .15s, box-shadow .2s;
    margin-bottom: 14px;
}
#btn-auth:hover {
    background: var(--sub);
    transform: translateY(-2px);
    box-shadow: 0 6px 28px rgba(234,88,12,.45);
}
#btn-auth:active   { transform: translateY(0); }
#btn-auth:disabled { opacity:.35; cursor:not-allowed; transform:none; box-shadow:none; }

/* Consentimento */
.consent-footer {
    text-align: center;
    font-size: 11px;
    color: var(--muted);
    line-height: 1.7;
    max-width: 280px;
}
.consent-footer a {
    color: var(--sub);
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
    transition: color .15s;
}
.consent-footer a:hover { color: var(--accent); }

/* ══════════════════════════════════════════
   6. MODAL (Termos / Privacidade)
══════════════════════════════════════════ */

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(120,50,0,.75);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .22s;
}
.modal-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.modal-box {
    background: var(--surf);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 100%;
    max-width: 520px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 64px rgba(120,50,0,.5);
    transform: translateY(12px);
    transition: transform .22s;
}
.modal-overlay.open .modal-box { transform: translateY(0); }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.modal-header h3 { font-size: 15px; font-weight: 700; color: var(--white); }

.modal-close {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--sub);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, color .15s;
}
.modal-close:hover { background: var(--surf2); color: var(--white); }

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    font-size: 13px;
    color: var(--sub);
    line-height: 1.7;
}
.modal-body::-webkit-scrollbar       { width: 4px; }
.modal-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.modal-body h4 {
    font-size: 12px;
    font-weight: 700;
    color: var(--white);
    margin: 14px 0 5px;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.modal-body h4:first-child { margin-top: 0; }
.modal-body p  { margin-bottom: 8px; }
.modal-body ul { padding-left: 16px; margin-bottom: 8px; }
.modal-body li { margin-bottom: 4px; }
.modal-body strong { color: var(--white); }

/* ══════════════════════════════════════════
   7. APP SHELL — Topbar e Nav
══════════════════════════════════════════ */

#app-shell {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding-bottom: max(56px, calc(56px + env(safe-area-inset-bottom, 0px))); /* footer + safe-area iOS */
}

/* Top bar */
#app-topbar {
    background: var(--surf);
    border-bottom: 1px solid var(--border);
    padding: 10px 20px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    position: relative;
}

.app-logo {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--accent);
    color: #ffffff;
    font-size: 14px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

#app-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 16px;
    font-weight: 800;
    color: var(--white);
    letter-spacing: -.3px;
    pointer-events: none;
}
#app-title span { color: var(--accent); }

#peer-status-badge {
    margin-left: auto;
    display: flex;
    align-items: center;
}
.dot-badge {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--muted);
    transition: background .4s, box-shadow .4s;
}
#peer-status-badge.connected .dot-badge {
    background: var(--green);
    box-shadow: 0 0 7px var(--green);
}

/* Nav tabs */
#main-nav {
    background: var(--surf);
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-shrink: 0;
    padding: 0 20px;
    gap: 4px;
}
.nav-btn {
    padding: 12px 20px;
    font: 600 13px var(--font);
    color: var(--muted);
    border: none;
    background: transparent;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: color .2s, border-color .2s;
    white-space: nowrap;
}
.nav-btn.active {
    color: var(--white);
    border-bottom-color: var(--accent);
}

/* ══════════════════════════════════════════
   8. VIEW SOCIAL — Vídeo, Chat, Controles
══════════════════════════════════════════ */

#view-social {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.social-body {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 300px;
    grid-template-rows: 1fr auto;
    min-height: 0;
    overflow: hidden;
}

/* Área de vídeo */
.video-area {
    grid-column: 1;
    grid-row: 1;
    background: #1a1208;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border-right: 1px solid var(--border);
}

#remoteVideo,
#localVideo {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
#remoteVideo { z-index: 1; }

/* PiP do vídeo local */
.local-pip {
    position: absolute;
    bottom: 14px;
    right: 14px;
    width: 140px;
    height: 100px;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid var(--border);
    z-index: 3;
    background: var(--surf);
}
.local-pip video { width: 100%; height: 100%; object-fit: cover; }

.pip-live {
    position: absolute;
    top: 7px;
    right: 7px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
    z-index: 4;
}

/* Watermark canvas */
.video-watermark {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: .12;
    z-index: 2;
    width: 100%;
    height: 100%;
}

/* Câmera off state */
.cam-off-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    background: #1a1208;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.cam-off-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--surf);
    border: 2px solid var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
}
.cam-off-label { font-size: 13px; color: var(--sub); font-weight: 600; }

/* Live dot (remoto) */
.live-dot-abs {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--red);
    box-shadow: 0 0 10px var(--red);
    z-index: 4;
    animation: blink 2s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: .25; }
}

/* Watermark label */
.wm-label {
    position: absolute;
    bottom: 8px;
    left: 12px;
    font-size: 9px;
    color: rgba(234,88,12,.2);
    z-index: 4;
    font-weight: 700;
    letter-spacing: 1px;
    pointer-events: none;
}

/* Chat panel lateral */
.chat-panel {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    background: var(--card);
    overflow: hidden;
    min-height: 0;
}
.chat-panel-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    background: var(--surf);
}
.chat-panel-title { font-size: 15px; font-weight: 700; color: var(--white); }

.active-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(46,213,115,.1);
    border: 1px solid rgba(46,213,115,.22);
    border-radius: 20px;
    padding: 3px 9px;
    font-size: 11px;
    font-weight: 600;
    color: var(--green);
}
.live-dot-sm {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green);
    flex-shrink: 0;
    animation: blink 2s infinite;
}

#chat-box {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
}
#chat-box::-webkit-scrollbar       { width: 4px; }
#chat-box::-webkit-scrollbar-track { background: transparent; }
#chat-box::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

#chat-empty {
    margin: auto;
    text-align: center;
    font-size: 13px;
    color: var(--muted);
}

.chat-input-row {
    padding: 10px 12px 14px;
    display: flex;
    gap: 8px;
    align-items: center;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}
#chat-input {
    flex: 1;
    background: var(--surf);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 10px 16px;
    font: 13px var(--font);
    color: var(--text);
    outline: none;
    resize: none;
    height: 42px;
    transition: border-color .2s;
}
#chat-input:focus        { border-color: var(--accent); }
#chat-input::placeholder { color: var(--muted); }

#btn-chat-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent);
    border: none;
    color: #ffffff;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity .2s;
    flex-shrink: 0;
}
#btn-chat-send:hover { opacity: .85; }

/* Barra de controles */
.controls-bar {
    grid-column: 1;
    grid-row: 2;
    background: var(--surf);
    border-top: 1px solid var(--border);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.btn-ctrl {
    padding: 10px 22px;
    border-radius: 10px;
    font: 600 13px var(--font);
    border: none;
    cursor: pointer;
    transition: opacity .2s;
    min-height: 44px;
}
.btn-ctrl:hover { opacity: .83; }
.bc-neutral { background: var(--surf2); color: var(--sub); }
.bc-blue    { background: var(--accent); color: #ffffff; }
.bc-red     { background: rgba(255,71,87,.13); color: var(--red); border: 1px solid rgba(255,71,87,.28); }

/* ══════════════════════════════════════════
   9. VIEW E-MAIL — Upload, Formulário, Log
══════════════════════════════════════════ */

#view-email {
    flex: 1;
    overflow-y: auto;
    padding: 28px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-content: start;
}

.email-section-title { font-size: 18px; font-weight: 700; color: var(--white); margin-bottom: 4px; }
.email-section-sub   { font-size: 13px; color: var(--muted); margin-bottom: 16px; }

.field-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--sub);
    margin-bottom: 6px;
    letter-spacing: .5px;
    text-transform: uppercase;
}
.field-input {
    width: 100%;
    background: var(--surf);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 13px 14px;
    font: 13px var(--font);
    color: var(--text);
    outline: none;
    transition: border-color .2s;
}
.field-input:focus        { border-color: var(--accent); }
.field-input::placeholder { color: var(--muted); }

/* Drop zone de upload */
.drop-zone {
    background: rgba(234,88,12,.04);
    border: 1px dashed rgba(234,88,12,.22);
    border-radius: 14px;
    padding: 28px 20px;
    text-align: center;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transition: background .2s, border-color .2s;
    margin: 16px 0;
}
.drop-zone:hover,
.drop-zone.dragover {
    background: rgba(234,88,12,.08);
    border-color: var(--accent);
}

.upload-ico {
    width: 52px;
    height: 52px;
    background: rgba(234,88,12,.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: var(--accent);
    margin-bottom: 4px;
}
.drop-t { font-size: 16px; font-weight: 700; color: var(--white); }
.drop-s { font-size: 12px; color: var(--muted); }
.size-tags { display: flex; gap: 6px; margin-top: 4px; justify-content: center; }
.size-tag  { padding: 4px 11px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.tag-blue   { background: rgba(234,88,12,.12);  color: var(--accent); }
.tag-yellow { background: rgba(255,211,42,.12);  color: var(--yellow); }
.tag-red    { background: rgba(255,71,87,.12);   color: var(--red); }

.btn-main {
    background: var(--accent);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    padding: 14px 28px;
    font: 700 15px var(--font);
    cursor: pointer;
    transition: opacity .2s;
    width: 100%;
}
.btn-main:hover { opacity: .87; }

/* Histórico de enviados */
.log-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.log-entry {
    display: flex;
    align-items: center;
    padding: 13px 14px;
    background: var(--surf);
    border-radius: 10px;
    border: 1px solid var(--border);
    margin-bottom: 8px;
}
.log-name { font-size: 13px; font-weight: 600; color: var(--text); }
.log-time { font-size: 11px; color: var(--muted); margin-top: 3px; }

/* Info card */
.info-card {
    background: rgba(234,88,12,.05);
    border: 1px solid rgba(234,88,12,.14);
    border-radius: 12px;
    padding: 16px;
    font-size: 13px;
    color: var(--sub);
    line-height: 1.8;
    margin-top: auto;
}
.info-card strong { color: var(--white); display: block; margin-bottom: 4px; font-size: 14px; }

/* ══════════════════════════════════════════
   10. CHAT BUBBLES
══════════════════════════════════════════ */

.bubble {
    max-width: 82%;
    padding: 9px 14px;
    border-radius: 16px;
    font-size: 13px;
    line-height: 1.45;
    font-weight: 500;
    word-break: break-word;
}
.bubble-out {
    align-self: flex-end;
    background: var(--accent);
    color: #ffffff;
    border-radius: 16px 16px 4px 16px;
}
.bubble-in {
    align-self: flex-start;
    background: var(--surf);
    color: var(--text);
    border-radius: 16px 16px 16px 4px;
    border: 1px solid var(--border);
}
.burn-timer    { font-size: 10px; color: rgba(255,255,255,.5); margin-top: 3px; text-align: right; }
.burn-timer-in { font-size: 10px; color: var(--muted); margin-top: 3px; }

/* ══════════════════════════════════════════
   11. FOOTER FIXO
══════════════════════════════════════════ */

#main-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255,237,213,0.98);
    border-top: 1px solid var(--border);
    padding: 10px 16px 8px;
    text-align: center;
    z-index: 100;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

#main-footer .footer-links {
    font-size: 12px;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    max-width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    flex-wrap: nowrap;
}
#main-footer .footer-links::-webkit-scrollbar { display: none; }

#main-footer .footer-links a {
    color: var(--sub);
    text-decoration: none;
    cursor: pointer;
    padding: 3px 8px;
    border-radius: 4px;
    transition: color .18s, background .18s;
    font-weight: 500;
    font-size: 12px;
}
#main-footer .footer-links a:hover {
    color: var(--accent);
    background: rgba(234,88,12,.1);
}
#main-footer .footer-links .sep {
    color: var(--muted);
    padding: 0 2px;
    font-size: 11px;
    user-select: none;
}
#main-footer p {
    font-size: 10.5px;
    color: var(--muted);
    margin: 0;
}

/* ══════════════════════════════════════════
   12. PAGE OVERLAY (páginas internas)
══════════════════════════════════════════ */

.page-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .25s;
    pointer-events: none;
}
.page-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.page-container {
    background: var(--surf1);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: min(780px, 94vw);
    max-height: 85vh;
    overflow-y: auto;
    padding: 32px 36px;
    position: relative;
    transform: translateY(24px);
    transition: transform .25s;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.page-overlay.open .page-container { transform: translateY(0); }

.page-close {
    position: sticky;
    top: 0;
    float: right;
    background: var(--surf2);
    border: 1px solid var(--border);
    color: var(--sub);
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
    margin-bottom: 16px;
    transition: background .2s;
    z-index: 1;
}
.page-close:hover { background: var(--accent); color: #ffffff; }

/* Conteúdo das páginas internas */
#page-content h1 { font-size: 22px; font-weight: 800; color: var(--white); margin: 0 0 6px; }
#page-content .page-badge {
    display: inline-block;
    background: var(--accent);
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    margin-bottom: 20px;
    letter-spacing: .5px;
}
#page-content h2 {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent);
    margin: 24px 0 8px;
    text-transform: uppercase;
    letter-spacing: .8px;
}
#page-content p  { font-size: 14px; color: var(--sub); line-height: 1.7; margin-bottom: 12px; }
#page-content ul { padding-left: 18px; margin-bottom: 12px; }
#page-content ul li { font-size: 14px; color: var(--sub); line-height: 1.7; margin-bottom: 6px; }

#page-content .info-box {
    background: var(--surf2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px 20px;
    margin: 16px 0;
}
#page-content .info-box strong { color: var(--white); font-size: 13px; }
#page-content .info-box p      { margin: 6px 0 0; font-size: 13px; }
#page-content hr               { border: none; border-top: 1px solid var(--border); margin: 24px 0; }

#page-content .tech-tag {
    display: inline-block;
    background: rgba(234,88,12,.12);
    color: var(--accent);
    border: 1px solid rgba(234,88,12,.3);
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    margin: 3px 3px 3px 0;
}

#page-content .step {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    margin-bottom: 16px;
}
#page-content .step-num {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    background: var(--accent);
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 800;
}
#page-content .step-body p     { margin: 0; }
#page-content .step-body strong { color: var(--white); }

/* Cards de download */
.dl-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--surf2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 18px;
    cursor: pointer;
    transition: border-color .2s, background .2s;
}
.dl-card:hover { border-color: var(--accent); background: rgba(234,88,12,.08); }
.dl-icon  { font-size: 26px; flex-shrink: 0; }
.dl-info  { flex: 1; }
.dl-info strong { display: block; color: var(--white); font-size: 14px; }
.dl-info span   { font-size: 12px; color: var(--muted); }
.dl-arrow { color: var(--accent); font-size: 18px; }

/* Guia de instalação */
#install-guide-content .install-step {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    margin-bottom: 14px;
}
#install-guide-content .install-num {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    background: var(--accent);
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
}
#install-guide-content h3 { color: var(--white); margin-bottom: 14px; font-size: 15px; }

/* ══════════════════════════════════════════
   13. PAINEL DE ACESSIBILIDADE
══════════════════════════════════════════ */

/* Botão flutuante */
#a11y-toggle {
    position: fixed;
    bottom: 66px;
    right: 16px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--accent);
    color: #ffffff;
    border: none;
    cursor: pointer;
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 150;
    box-shadow: 0 4px 16px rgba(234,88,12,.45);
    transition: transform .2s, background .2s;
    outline: none;
}
#a11y-toggle:hover        { transform: scale(1.1); background: #3a8aef; }
#a11y-toggle:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

/* Painel */
#a11y-panel {
    position: fixed;
    bottom: 122px;
    right: 16px;
    width: 290px;
    max-width: calc(100vw - 32px);
    background: var(--surf1);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    z-index: 149;
    box-shadow: 0 8px 32px rgba(120,50,0,.4);
    transform: scale(.92) translateY(12px);
    opacity: 0;
    pointer-events: none;
    transition: transform .22s, opacity .22s;
    transform-origin: bottom right;
}
#a11y-panel.open {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: all;
}
#a11y-panel h3 {
    font-size: 13px;
    font-weight: 800;
    color: var(--white);
    margin: 0 0 14px;
    letter-spacing: .5px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Linhas de controle */
.a11y-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.a11y-row:last-child { border-bottom: none; padding-bottom: 0; }

.a11y-label {
    font-size: 13px;
    color: var(--sub);
    display: flex;
    align-items: center;
    gap: 8px;
}
.a11y-label span { font-size: 16px; }

/* Toggle switch */
.a11y-switch {
    position: relative;
    width: 40px;
    height: 22px;
    flex-shrink: 0;
}
.a11y-switch input { opacity: 0; width: 0; height: 0; }

.a11y-slider {
    position: absolute;
    inset: 0;
    background: var(--border);
    border-radius: 22px;
    cursor: pointer;
    transition: background .2s;
}
.a11y-slider:before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform .2s;
}
.a11y-switch input:checked + .a11y-slider              { background: var(--accent); }
.a11y-switch input:checked + .a11y-slider:before       { transform: translateX(18px); }
.a11y-switch input:focus-visible + .a11y-slider        { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Controles de fonte */
.a11y-font-btns { display: flex; gap: 6px; }
.a11y-font-btns button {
    background: var(--surf2);
    border: 1px solid var(--border);
    color: var(--white);
    border-radius: 8px;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
}
.a11y-font-btns button:hover        { background: var(--accent); border-color: var(--accent); }
.a11y-font-btns button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Nota Libras */
.a11y-libras-note {
    margin-top: 14px;
    padding: 10px 12px;
    background: rgba(234,88,12,.08);
    border: 1px solid rgba(234,88,12,.2);
    border-radius: 10px;
    font-size: 11px;
    color: var(--sub);
    line-height: 1.5;
}
.a11y-libras-note a            { color: var(--accent); text-decoration: none; }
.a11y-libras-note a:hover      { text-decoration: underline; }

/* Modos aplicados ao body */
body.a11y-alto-contraste      { filter: contrast(1.6) saturate(0); }
body.a11y-daltonismo          { filter: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'><filter id='d'><feColorMatrix type='matrix' values='0.567 0.433 0 0 0  0.558 0.442 0 0 0  0 0.242 0.758 0 0  0 0 0 1 0'/></filter></svg>#d"); }
body.a11y-reducir-animacoes * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
body.a11y-foco-visivel *:focus { outline: 3px solid #ff0 !important; outline-offset: 4px !important; }

/* ══════════════════════════════════════════
   14. RESPONSIVO
══════════════════════════════════════════ */

@media (max-width: 768px) {
    .social-body {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
    }
    .video-area {
        grid-column: 1;
        grid-row: 1;
        border-right: none;
        border-bottom: 1px solid var(--border);
        height: 220px;
        flex-shrink: 0;
    }
    .local-pip { width: 90px; height: 66px; }
    .chat-panel {
        grid-column: 1;
        grid-row: 2;
        max-height: calc(100vh - 220px - 60px - 56px); /* viewport - vídeo - controls - footer */
    }
    .controls-bar {
        grid-column: 1;
        grid-row: 3;
        padding: 8px 12px;
        gap: 6px;
        justify-content: center;
    }
    .btn-ctrl { padding: 9px 10px; font-size: 12px; flex: 1; min-width: 70px; }

    #view-email {
        grid-template-columns: 1fr;
        padding: 16px 16px max(16px, env(safe-area-inset-bottom, 16px));
    }
    #main-nav  { padding: 0 8px; }
    .nav-btn   { padding: 12px 14px; font-size: 12px; }
    #app-topbar { padding: 10px 14px; }

    /* Page overlay — padding reduzido em tablet */
    .page-container { padding: 24px 24px; }
}

@media (max-width: 480px) {
    .video-area    { height: 180px; }
    .controls-bar  { flex-wrap: wrap; justify-content: center; gap: 8px; }
    .btn-ctrl      { flex: none; width: calc(50% - 4px); min-height: 44px; }

    /* Auth card — padding menor em telas pequenas */
    .auth-card     { padding: 28px 20px 24px; }

    /* Page overlay — mobile pequeno */
    .page-container { padding: 20px 18px; }
    .page-close     { padding: 6px 12px; }

    /* Modal */
    .modal-body    { padding: 16px; }
    .modal-header  { padding: 14px 16px; }
}

@media (max-width: 360px) {
    .auth-card       { padding: 24px 16px 20px; border-radius: 20px; }
    .auth-logo-mark  { width: 60px; height: 60px; font-size: 34px; }
    .auth-logo-text  { font-size: 24px; }
    #btn-auth        { padding: 13px 24px; font-size: 14px; }
    .btn-ctrl        { width: 100%; }
    #a11y-panel      { width: calc(100vw - 24px); right: 12px; }
}

/* ═══════════════════════════════════════════════════
 * MODO ESCURO
 * ═══════════════════════════════════════════════════ */
[data-theme="dark"] {
    --bg:      #1a0f08;
    --card:    #2a1810;
    --surf:    #231208;
    --surf1:   #231208;
    --surf2:   #2e1a0e;
    --border:  #4a2510;
    --accent:  #f97316;
    --text:    #fef3e2;
    --sub:     #fdba74;
    --muted:   #fb923c;
    --dark:    #1a0f08;
    --white:   #fef3e2;
    color-scheme: dark;
}

/* Vídeo mantém fundo escuro em ambos os temas */
[data-theme="dark"] .video-area,
[data-theme="dark"] #remoteVideo {
    background: #0a0603;
}

/* Toast no modo escuro */
[data-theme="dark"] .toast {
    background: var(--card);
    border-color: var(--border);
    color: var(--text);
}

/* Inputs no modo escuro */
[data-theme="dark"] input,
[data-theme="dark"] textarea,
[data-theme="dark"] select {
    background: var(--surf);
    color: var(--text);
    border-color: var(--border);
}

/* Scrollbar no modo escuro */
[data-theme="dark"] ::-webkit-scrollbar-track { background: var(--bg); }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: var(--border); }

/* Botão de tema */
#btn-theme {
    position: fixed;
    bottom: 124px;
    right: 16px;
    z-index: 160;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
    transition: transform .2s, background .2s;
}
#btn-theme:hover { transform: scale(1.1); background: var(--surf); }

/* ═══════════════════════════════════════════════════
 * INDICADOR DE QUALIDADE DE CONEXÃO
 * ═══════════════════════════════════════════════════ */
#quality-widget {
    display: none;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    border-radius: 8px;
    background: var(--surf);
    border: 1px solid var(--border);
    transition: background .3s;
}

#quality-widget:hover {
    background: var(--surf2);
}

#quality-bars [data-bar] {
    width: 3px;
    border-radius: 1px;
    transition: background .4s, height .3s;
}

#quality-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--sub);
    min-width: 32px;
    transition: color .4s;
}

/* Animação pulso na fila de espera */
@keyframes waitPulse {
    0%, 100% { transform: scale(1);   opacity: 1   }
    50%       { transform: scale(1.1); opacity: 0.8 }
}

#knock-modal .knock-waiting-icon {
    animation: waitPulse 1.4s ease-in-out infinite;
    display: inline-block;
}

/* ══════════════════════════════════════════
   15. REDUÇÃO DE MOVIMENTO (acessibilidade)
══════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
    }
    .auth-logo-mark { animation: none; }
    .auth-card      { animation: none; opacity: 1; transform: none; }
}
