/**
 * ═══════════════════════════════════════════════════════════════════════════
 * RELATOS v1.0.1 — v12.0.89 (a folha sobe acima do HUD: velocimetro e SOS ficavam por cima dos tiles); v1.0.0 — v12.0.88 (FASE 14, RELATOS-01: o painel "Sinalizar" e o toast)
 * ═══════════════════════════════════════════════════════════════════════════
 *
 * Opcao A do canvas de 04/11/2026 ("Grade de 7"), escolhida pelo dono: folha de baixo na
 * familia visual (cartao, borda, sombra e tons dos tokens --m-* de marca.css — os ids
 * #relatos-sheet e #relatos-toast entraram nos escopos la), 7 tiles em 3 colunas (icone de
 * linha num quadrado tonal + rotulo) e um "Cancelar" tracejado. Toast "Sinalizado: X ·
 * Desfazer" em tom ok por cima do mapa.
 *
 * SEM `backdrop-filter` (custo em celular fraco, medido na v11.2.181).
 * Quem desenha: js/ui/relatosSheet.js.
 *
 * Localizacao: frontend/css/relatos.css
 */

/* ───────── Fundo ───────── */
#relatos-sheet {
    position: fixed;
    inset: 0;
    /* 🔧 v1.0.1 (v12.0.89, print do dono 04/11): acima do HUD (velocimetro e SOS, --z-hud) — com a folha aberta
       os dois ficavam por cima dos tiles. O veu escuro cobre o HUD; fecha a folha, volta tudo. */
    z-index: calc(var(--z-hud) + 1);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    background: rgba(8, 14, 22, 0.62);
    -webkit-tap-highlight-color: transparent;
    font-family: system-ui, -apple-system, Roboto, 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
    animation: rrFundo 0.18s ease both;
}

/* ───────── Folha ───────── */
#relatos-sheet .rr-folha {
    box-sizing: border-box;
    width: 100%;
    padding: 10px 16px calc(24px + env(safe-area-inset-bottom, 0px));
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--m-card);
    border: 1px solid var(--m-borda);
    border-bottom: 0;
    border-radius: 22px 22px 0 0;
    box-shadow: var(--m-sombra);
    color: var(--m-texto);
    animation: rrSobe 0.22s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

#relatos-sheet .rr-alca {
    align-self: center;
    width: 36px;
    height: 4px;
    border-radius: 999px;
    background: var(--m-borda-forte);
}

#relatos-sheet .rr-topo {
    display: flex;
    align-items: center;
    gap: 12px;
}

#relatos-sheet .rr-topo-ic {
    display: grid;
    place-items: center;
    flex: none;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--m-aviso-bg);
    color: var(--m-aviso-txt);
}

#relatos-sheet .rr-titulos {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

#relatos-sheet .rr-titulo {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.2;
    color: var(--m-texto);
    text-transform: none;
}

#relatos-sheet .rr-sub {
    font-size: 13px;
    color: var(--m-texto-2);
}

#relatos-sheet .rr-fechar {
    margin-left: auto;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 999px;
    border: 1px solid var(--m-borda);
    background: var(--m-sup);
    color: var(--m-texto-2);
    cursor: pointer;
}

/* ───────── Grade de 7 + Cancelar ───────── */
#relatos-sheet .rr-grade {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

#relatos-sheet .rr-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 84px;
    padding: 10px 8px;
    border: 1px solid var(--m-borda);
    border-radius: 16px;
    background: var(--m-campo);
    color: var(--m-texto);
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.15;
    text-align: center;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    transition: transform 0.12s, filter 0.12s;
}

#relatos-sheet .rr-tile:active {
    transform: scale(0.97);
    filter: brightness(0.96);
}

#relatos-sheet .rr-tile-ic {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
}

#relatos-sheet .rr-tom-perigo { background: var(--m-perigo-bg); color: var(--m-perigo); }
#relatos-sheet .rr-tom-aviso  { background: var(--m-aviso-bg);  color: var(--m-aviso-txt); }
#relatos-sheet .rr-tom-info   { background: var(--m-info-bg);   color: var(--m-info-txt); }

#relatos-sheet .rr-tile-cancelar {
    border: 1px dashed var(--m-borda-forte);
    background: transparent;
    color: var(--m-texto-2);
    font-weight: 600;
}

/* ───────── Toast ───────── */
#relatos-toast {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: calc(190px + env(safe-area-inset-bottom, 0px));
    z-index: calc(var(--z-hud) + 2);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid var(--m-borda);
    background: var(--m-ok-bg);
    color: var(--m-ok-txt);
    box-shadow: var(--m-sombra);
    font-family: system-ui, -apple-system, Roboto, 'Segoe UI', sans-serif;
    font-size: 14px;
    font-weight: 600;
    animation: rrSobe 0.18s ease both;
}

#relatos-toast.rr-toast-aviso  { background: var(--m-aviso-bg);  color: var(--m-aviso-txt); }
#relatos-toast.rr-toast-perigo { background: var(--m-perigo-bg); color: var(--m-perigo); }

#relatos-toast .rr-toast-ic {
    display: grid;
    place-items: center;
    flex: none;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    background: currentColor;
}

#relatos-toast .rr-toast-ic svg { color: var(--m-card); }

#relatos-toast .rr-toast-txt {
    flex: 1;
    min-width: 0;
}

#relatos-toast .rr-toast-desfazer {
    margin-left: auto;
    min-height: 36px;
    padding: 0 10px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: inherit;
    font-family: inherit;
    font-size: 13px;
    font-weight: 800;
    text-decoration: underline;
    cursor: pointer;
}

/* ───────── "Ainda está?" no card do alertService (fora dos escopos dos tokens: cores literais) ───────── */
.alert-toast .alert-toast-voto {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    font-size: 13px;
    font-weight: 600;
}

.alert-toast .alert-toast-voto button {
    min-height: 32px;
    padding: 0 12px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.14);
    color: inherit;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

/* ───────── Animações ───────── */
@keyframes rrFundo { from { opacity: 0; } to { opacity: 1; } }
@keyframes rrSobe  { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
    #relatos-sheet, #relatos-sheet .rr-folha, #relatos-toast { animation: none !important; }
}
