/* ==========================================================================
   Loomy · Chamados T.I. — chrome das telas + responsividade + toque + PWA
   Complementa o theme.css (design system). Carregado depois dele.
   ========================================================================== */

/* -------------------- Base / toque -------------------- */
html { -webkit-text-size-adjust: 100%; }
html, body { height: 100%; }
body {
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button { font-family: inherit; }
/* alvos de toque sem atraso de 300ms e sem zoom por duplo-toque */
.btn, .chip, .cat-row, .wordmark, .drop, select, input, textarea {
  touch-action: manipulation;
}
.btn, .chip, .cat-row, .wordmark { user-select: none; -webkit-user-select: none; }
/* iOS: impede zoom automático em foco (fonte < 16px) mantendo o visual */
@supports (-webkit-touch-callout: none) {
  .input, select, input, textarea, .input-group .ig-input { font-size: 16px; }
}

/* feedback tátil discreto */
.btn:active { transform: translateY(1px); }
.cat-row:active { background: var(--surface-3); }
.chip:active { transform: scale(0.97); }
@media (hover: none) {
  .btn-secondary:hover { background: var(--surface-2); }
  .cat-row:hover { background: var(--surface); }
  .chip:hover { color: var(--muted); border-color: var(--border-strong); }
}

/* -------------------- Layout base (chrome) -------------------- */
.screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding:
    max(16px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right))
    max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
}
.hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
  flex: none;
}
.wordmark { background: none; border: none; cursor: pointer; padding: 4px 2px; }

.app { flex: 1; display: flex; flex-direction: column; min-height: 0; }

/* centralizado (boas-vindas, sucesso) */
.stage { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 16px; }
/* topo (formulário, categorias) */
.view { width: 100%; }

.card { width: 100%; }
@media (max-width: 480px) { .card { padding: 20px; border-radius: 12px; } }

/* -------------------- Boas-vindas -------------------- */
.tagline { font-size: 12px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted-2); }
.stage h1 { font-size: clamp(26px, 7vw, 32px); font-weight: 700; letter-spacing: -0.02em; margin: 0; line-height: 1.1; }
.stage h1 b { color: var(--green); font-weight: 700; }
.stage .lead { font-size: 16px; font-weight: 500; color: var(--muted); margin: 0; max-width: 30rem; line-height: 1.55; }

/* -------------------- Pergunta / formulário -------------------- */
.q { display: block; font-size: clamp(19px, 5vw, 22px); font-weight: 600; margin: 0 0 16px; line-height: 1.25; }
.q .req { color: var(--green); }
.q-sub { font-size: 14px; color: var(--muted); margin: -8px 0 18px; line-height: 1.5; }
.hint { font-size: 13px; color: var(--muted-2); margin: 10px 0 0; line-height: 1.45; }
.err { min-height: 1.1rem; margin: 10px 0 0; font-size: 13px; font-weight: 600; color: var(--danger); }

.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { min-height: 44px; }

/* campo de e-mail com domínio fixo (@loomy.com.br) */
.input-group {
  display: flex; align-items: center; width: 100%; min-height: 48px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-field);
  padding: 0 14px; transition: border-color 0.15s ease;
}
.input-group:focus-within { border-color: var(--green); }
.ig-input { flex: 1; min-width: 0; background: transparent; border: none; outline: none; color: var(--text); font-family: inherit; font-size: 15px; padding: 12px 0; }
.ig-input::placeholder { color: var(--muted-2); }
.ig-suffix { flex: none; padding-left: 2px; color: var(--muted-2); font-size: 15px; font-weight: 500; white-space: nowrap; user-select: none; -webkit-user-select: none; }

.nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }
.nav .btn { min-height: 44px; }
.btn { min-height: 44px; }

/* categorias: linhas com alvo de toque confortável */
.cat-row { min-height: 60px; }
.cat-row:focus-visible, .chip:focus-visible, .btn:focus-visible, .wordmark:focus-visible, .drop:focus-visible, .input:focus-visible {
  outline: 2px solid var(--green); outline-offset: 2px;
}

/* -------------------- Upload de arquivo -------------------- */
.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  padding: 22px 16px; text-align: center; cursor: pointer;
  background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--r-field);
  color: var(--muted); transition: border-color 0.15s ease, background 0.15s ease;
}
.drop:hover, .drop.drag { border-color: var(--green); background: var(--surface-2); }
.drop-ic { width: 22px; height: 22px; color: var(--green); }
.drop-ic svg { width: 100%; height: 100%; display: block; }
.drop-main { font-size: 14px; font-weight: 600; color: var(--text); }
.drop-sub { font-size: 12px; color: var(--muted-2); }
.files { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.files li {
  display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px;
}
.files li::before { content: "📎"; }

/* -------------------- Revisão -------------------- */
.review-title { font-size: 20px; font-weight: 700; margin: 0 0 4px; }
.review-sub { font-size: 14px; color: var(--muted); margin: 0 0 18px; }
.review { display: grid; gap: 8px; }
.review-row { display: grid; gap: 3px; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-field); }
.review-row .k { font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted-2); }
.review-row .v { font-size: 14px; color: var(--text); line-height: 1.45; word-break: break-word; }

/* -------------------- Sucesso -------------------- */
.check { width: 64px; height: 64px; border-radius: 50%; background: rgba(166, 254, 31, 0.12); display: flex; align-items: center; justify-content: center; color: var(--green); margin: 0 auto 18px; }
.check svg { width: 32px; height: 32px; }
.success-card { text-align: center; max-width: 30rem; }
.success-card h2 { font-size: 24px; font-weight: 700; margin: 0 0 10px; }
.protocol { font-size: 15px; color: var(--muted); margin: 0 0 14px; }
.protocol b { color: var(--green); font-weight: 700; letter-spacing: 0.02em; }
.ssub { font-size: 14px; color: var(--muted); line-height: 1.55; margin: 0 auto 22px; }
.ssub b { color: var(--text); font-weight: 600; }
.actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* -------------------- Animações de entrada -------------------- */
@keyframes fade-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.anim { animation: fade-up 0.28s ease; }

@media (prefers-reduced-motion: reduce) {
  .anim { animation: none; }
  * { transition: none !important; }
}

/* -------------------- Ajustes p/ telas muito baixas / teclado aberto -------------------- */
@media (max-height: 560px) {
  .stage { justify-content: flex-start; padding-top: 8px; }
}
