/* Site no celular como app (17/10/2026 — analise-celular-app.md).
   Arquivo próprio, carregado pelo base.html em todas as telas: o output.css do
   Tailwind é montado no servidor e uma classe nova poderia não existir lá. */

/* Recorte da tela (iPhone com notch, de lado): o viewport-fit=cover do
   base.html deixa o conteúdo ir até a borda; o body devolve a folga. */
@supports (padding: env(safe-area-inset-left)) {
    body {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
}

/* iPhone dá zoom ao tocar num campo com letra menor que 16 px (busca do
   painel, do edital, Minha Conta, simulados, pagamento…). */
@media (max-width: 640px) {
    input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="color"]):not([type="file"]),
    select,
    textarea {
        font-size: 16px !important;
    }
}

/* Aberto como app (Tela de Início do iPhone, app da Play Store, PWA): sem o
   rodapé de site ("Dúvidas ou Sugestões?", ©, Termos). */
html.els-app body > footer {
    display: none !important;
}

/* No toque, um :hover que "gruda" depois do toque não deve levantar botões. */
@media (hover: none) {
    .nav-theme-toggle:hover {
        transform: none !important;
    }
}

/* Lei justificada no celular (quem escolheu): hifenização reduz os buracos. */
@media (max-width: 480px) {
    #law-content.text-justified p,
    #law-content.text-justified li {
        -webkit-hyphens: auto;
        hyphens: auto;
    }
}

/* Meu Edital: o quadradinho de "estudei" tem 20 px; no toque a área de acerto
   cresce para ~44 px sem mudar o desenho. */
@media (pointer: coarse) {
    .item-toggle { position: relative; }
    .item-toggle::after { content: ""; position: absolute; inset: -12px; }
}

/* ── Topo compacto no celular (B2) ─────────────────────────────────────
   Antes: título grande, logo e uma linha de links que quebrava em duas —
   ~140 px (17% da tela). Agora uma faixa só: "ELS" + logo à esquerda, ícones
   à direita. Com a barra de baixo, Painel/Conta saem daqui; o "Sair" vai para
   dentro de Minha Conta. */
.site-title-curto { display: none; }
@media (max-width: 640px) {
    nav.els-topo > .container {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 0 12px;
        min-height: 52px;
    }
    nav.els-topo .header-container { padding: 6px 0; justify-content: flex-start; }
    nav.els-topo .site-title { display: none; }
    nav.els-topo .site-title-curto { display: inline; font-size: 1.15rem; font-weight: 800; letter-spacing: .02em; }
    nav.els-topo .site-logo { height: 26px; margin-left: 6px; }
    nav.els-topo .els-topo-links { padding-bottom: 0; align-items: center; gap: 14px; }
    nav.els-topo .els-topo-links > * { margin-left: 0 !important; margin-right: 0 !important; }
    nav.els-topo .els-topo-ola,
    nav.els-topo .els-topo-sair { display: none !important; }
    body.tem-barra-app nav.els-topo .els-topo-texto { display: none !important; }
    nav.els-topo .els-topo-texto { font-size: .9rem; }
    nav.els-topo .nav-link::after { display: none; }
    nav.els-topo .nav-theme-toggle { top: 0; width: 36px; height: 36px; }
    /* "Respostas" vira só o ícone com o número */
    nav.els-topo #relatos-nav-link { font-size: 0; display: inline-flex; align-items: center; gap: 4px; }
    nav.els-topo #relatos-nav-link i { font-size: 1.1rem; }
    nav.els-topo #relatos-nav-link .wa-inbox-unread-badge { font-size: .7rem; }
    nav.els-topo #relatos-nav-link.hidden { display: none; }
}

/* ── Barra de baixo (B1) — _barra_app.html ───────────────────────────── */
.els-barra-app { display: none; }
@media (max-width: 640px) {
    .els-barra-app {
        display: flex;
        position: fixed;
        left: 0; right: 0; bottom: 0;
        height: calc(60px + env(safe-area-inset-bottom, 0px));
        padding: 0 4px env(safe-area-inset-bottom, 0px);
        background: rgba(255, 255, 255, .97);
        -webkit-backdrop-filter: blur(12px);
        backdrop-filter: blur(12px);
        border-top: 1px solid #e5e7eb;
        box-shadow: 0 -1px 8px rgba(0, 0, 0, .06);
        z-index: 900;
        justify-content: space-around;
        align-items: stretch;
    }
    .els-barra-app a {
        flex: 1 1 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        color: #64748b;
        font-size: .7rem;
        font-weight: 600;
        text-decoration: none;
        -webkit-tap-highlight-color: transparent;
    }
    .els-barra-app a i { font-size: 1.2rem; }
    .els-barra-app a.ativo { color: #2563eb; }
    .els-barra-app a.els-barra-continuar i {
        width: 44px; height: 30px; border-radius: 9999px;
        display: flex; align-items: center; justify-content: center;
        background: linear-gradient(135deg, #2563eb, #4f46e5); color: #fff; font-size: 1.05rem;
        box-shadow: 0 4px 10px rgba(37, 99, 235, .35);
    }
    .els-barra-app a.els-barra-continuar { color: #1d4ed8; }
    body.tem-barra-app { padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }
    /* A barra própria do Meu Edital dá lugar a esta. */
    body.tem-barra-app .mobile-global-nav { display: none !important; }
    /* Avisos que ficavam no pé da tela sobem acima da barra. */
    body.tem-barra-app .els-toast,
    body.tem-barra-app #undo-zerar-toast,
    body.tem-barra-app #milestone-toast,
    body.tem-barra-app #sugestoes-notif-banner,
    body.tem-barra-app .cr-toast,
    body.tem-barra-app .eg-aviso {
        bottom: calc(72px + env(safe-area-inset-bottom, 0px)) !important;
    }
    body.dark-mode .els-barra-app { background: rgba(17, 24, 39, .97); border-top-color: #374151; }
    body.dark-mode .els-barra-app a { color: #9ca3af; }
    body.dark-mode .els-barra-app a.ativo { color: #60a5fa; }
}
@media print {
    .els-barra-app { display: none !important; }
}

/* ── Leitura da lei: "Trechos" no celular (B3b) ──────────────────────────
   O painel de trechos (#sibling-nav-panel) só existia a partir de 769 px. No
   celular ele abre como folha no pé da tela, pela gaveta "Opções". */
@media (max-width: 768px) {
    #sibling-nav-panel.cel-aberto {
        display: flex;
        position: fixed;
        left: 0; right: 0; bottom: 0; top: auto;
        transform: none;
        max-height: 75vh;
        max-height: 75dvh;
        z-index: 2100;
        pointer-events: auto;
        flex-direction: column;
        align-items: stretch;
        border-radius: 18px 18px 0 0;
        overflow: hidden;
        background: #fff;
        box-shadow: 0 -10px 40px rgba(0, 0, 0, .18);
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
    #sibling-nav-panel.cel-aberto .sibling-nav-toggle { display: none; }
    #sibling-nav-panel.cel-aberto .sibling-nav-content {
        width: 100% !important;
        max-height: none;
        overflow-y: auto;
        border-left: 0;
        box-shadow: none;
    }
    #sibling-nav-panel.cel-aberto .sibling-nav-link { padding-top: 12px; padding-bottom: 12px; }
    .els-trechos-fundo {
        position: fixed; inset: 0; z-index: 2099; background: rgba(15, 23, 42, .45);
    }
    body.dark-mode #sibling-nav-panel.cel-aberto { background: #1f2937; }
}

/* Escolha da ação de IA no celular (view_law.html, askAiConfirm): uma por linha. */
.els-swal-ia .swal2-radio {
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
}
.els-swal-ia .swal2-radio label {
    margin: 0 !important;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    text-align: left;
    font-size: .95rem;
}

/* Leitura da lei no celular: os botões de mostrar/ocultar viravam olhos
   coloridos sem nome — um rótulo curto embaixo do ícone (C5). */
@media (max-width: 480px) {
    #sticky-toggle-row .toggle-btn-comments,
    #sticky-toggle-row .toggle-btn-juris,
    #sticky-toggle-row .toggle-btn-doutrina,
    #sticky-toggle-row .toggle-btn-my-notes,
    #sticky-toggle-row .toggle-btn-questions {
        flex-direction: column !important;
        gap: 2px !important;
        min-width: 50px !important;
        padding: 4px 6px !important;
    }
    #sticky-toggle-row .toggle-btn-comments::after,
    #sticky-toggle-row .toggle-btn-juris::after,
    #sticky-toggle-row .toggle-btn-doutrina::after,
    #sticky-toggle-row .toggle-btn-my-notes::after,
    #sticky-toggle-row .toggle-btn-questions::after {
        font-size: .6rem;
        font-weight: 700;
        line-height: 1;
        white-space: nowrap;
    }
    #sticky-toggle-row .toggle-btn-comments::after { content: "Coment."; }
    #sticky-toggle-row .toggle-btn-juris::after { content: "Juris"; }
    #sticky-toggle-row .toggle-btn-doutrina::after { content: "Doutrina"; }
    #sticky-toggle-row .toggle-btn-my-notes::after { content: "Minhas"; }
    #sticky-toggle-row .toggle-btn-questions::after { content: "Questões"; }
}
/* "Atalhos de teclado" não serve no toque. */
@media (pointer: coarse) {
    #toolbar-shortcuts-btn { display: none !important; }
}

/* Barra de ferramentas da lei que some ao rolar para baixo (app-celular.js). */
@media (max-width: 480px) {
    #sticky-action-bar { transition: transform .25s ease; }
    #sticky-action-bar.els-barra-recolhida { transform: translateY(calc(-100% - 16px)); }
}

/* Convite para o lembrete diário (app-celular.js), acima da barra de baixo. */
.els-convite-push {
    position: fixed; left: 12px; right: 12px; z-index: 1500;
    bottom: calc(76px + env(safe-area-inset-bottom, 0px));
    display: flex; flex-direction: column; gap: 10px;
    padding: 14px 16px; border-radius: 14px;
    background: #1e293b; color: #fff; font-size: .95rem; font-weight: 600;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
}
.els-convite-push div { display: flex; gap: 8px; justify-content: flex-end; }
.els-convite-push button { border: 0; border-radius: 10px; padding: 10px 16px; font-weight: 700; font-size: .9rem; }
.els-convite-push .sim { background: #2563eb; color: #fff; }
.els-convite-push .nao { background: transparent; color: #cbd5e1; }

/* Faixa "Use o app" no Meu Painel (app-celular.js) e folha do passo a passo do iPhone. */
.els-instalar {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    margin: -12px 0 16px; padding: 10px 12px; border-radius: 12px;
    background: #eef2ff; border: 1px solid #c7d2fe; color: #312e81; font-size: .88rem;
}
.els-instalar-txt { flex: 1 1 200px; }
.els-instalar-sim {
    background: #4f46e5; color: #fff !important; text-decoration: none !important;
    padding: 8px 12px; border-radius: 10px; font-weight: 700; white-space: nowrap;
}
.els-instalar-x { border: 0; background: transparent; color: #6366f1; font-size: 1.4rem; line-height: 1; padding: 0 4px; }
.els-folha-fundo { position: fixed; inset: 0; z-index: 10050; background: rgba(15, 23, 42, .5); }
.els-folha {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 10051;
    max-height: 85vh; max-height: 85dvh; overflow-y: auto;
    background: #fff; color: #1f2937; border-radius: 18px 18px 0 0;
    padding: 10px 20px calc(20px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -10px 40px rgba(0, 0, 0, .2);
}
.els-folha-alca { width: 40px; height: 4px; border-radius: 4px; background: #d1d5db; margin: 0 auto 12px; }
.els-folha h3 { font-size: 1.15rem; font-weight: 800; margin: 0 0 10px; }
.els-folha ol { list-style: decimal; padding-left: 22px; margin: 0 0 12px; line-height: 1.55; }
.els-folha li { margin-bottom: 8px; }
.els-folha-aviso { background: #fef3c7; color: #78350f; padding: 10px 12px; border-radius: 10px; font-size: .9rem; }
.els-folha-nota { font-size: .85rem; color: #6b7280; }
.els-folha-botoes { display: flex; gap: 10px; justify-content: flex-end; }
.els-folha-botoes a, .els-folha-botoes button {
    padding: 10px 16px; border-radius: 10px; font-weight: 700; border: 0; text-decoration: none;
}
.els-folha-botoes a { background: #eef2ff; color: #4338ca; }
.els-folha-botoes button { background: #2563eb; color: #fff; }
body.dark-mode .els-folha { background: #1f2937; color: #e5e7eb; }
body.dark-mode .els-instalar { background: #1e1b4b; border-color: #3730a3; color: #c7d2fe; }

/* ── Cabeçalhos grandes no celular (19/10/2026) ──────────────────────────
   A Central de Questões, a Área Premium, o Assessor, o Caderno de Anotações e
   as Estatísticas abriam com um cabeçalho que ocupava a 1ª tela inteira. Mesmo
   acabamento da jurisprudência (_juris_celular.html): ícone menor, título e
   texto mais curtos, e o conteúdo aparece já na primeira tela. O `body` na
   frente faz valer sobre o CSS de cada tela, que vem depois deste arquivo. */
@media (max-width: 640px) {
    /* Central de Questões */
    body .es-central { padding: 1.15rem 1rem 1rem; margin-bottom: 1.1rem; border-radius: 16px; }
    body .es-central h1 { font-size: 1.75rem; margin-bottom: .35rem; }
    body .es-central p { font-size: .9rem; line-height: 1.5; }
    body .es-central-volta { margin-top: .8rem; }
    /* O tema fica no botão da barra azul do topo, que só delega neste aqui. */
    body .es-central-tema { display: none; }

    /* Área Premium */
    body .pd-topbar { margin-bottom: .6rem; }
    body .pd-hero { padding: .25rem .25rem 0; margin-bottom: 1.25rem; }
    body .pd-header-icon { width: 56px; height: 56px; border-radius: 16px; margin-bottom: .7rem; }
    body .pd-header-icon i { font-size: 1.5rem; }
    body .pd-title { font-size: 1.85rem; margin-bottom: .4rem; }
    body .pd-subtitle { font-size: .93rem; line-height: 1.5; }

    /* Assessor */
    body .sandbox-header { margin-bottom: 1.25rem; }
    body .sandbox-header-icon { width: 52px; height: 52px; font-size: 1.5rem; margin-bottom: .6rem; }
    body .sandbox-subtitle { font-size: .92rem; margin-bottom: .75rem; }

    /* Caderno de Anotações */
    body .nb-hero { margin-bottom: 1.25rem !important; }
    body .nb-header-icon { width: 52px; height: 52px; font-size: 1.5rem; margin-bottom: .6rem; }
    body .nb-subtitle { font-size: .92rem; margin-bottom: .75rem; }

    /* Estatísticas (o ícone tem estilo embutido: precisa do !important) */
    body .stats-hero { margin-bottom: 1.5rem !important; }
    body .stats-header-icon { width: 52px !important; height: 52px !important; font-size: 1.3rem !important; margin-bottom: .6rem !important; }
    body .stats-subtitle { font-size: .92rem; margin-bottom: .9rem; }
    /* Os cartões dos gráficos: o título quebrava em 3 linhas grandes. */
    body .stats-container .chart-card { padding: 1.25rem 1rem; margin-bottom: 1.25rem; }
    body .stats-container .chart-header { margin-bottom: 1rem; }
    body .stats-container .chart-header h2 { font-size: 1.15rem; line-height: 1.35; }
}
