/* ═══════════════════════════════════════════════════
   JURÍDICO TRAINER — styles.css
   Arquivo de ajustes visuais e estéticos
   Edite este arquivo para personalizar cores, fontes
   espaçamentos e animações do app.
═══════════════════════════════════════════════════ */

/* ── IMPORTAÇÃO DE FONTES ─────────────────────────
   Substitua as URLs para trocar as fontes do app.
   Atual: DM Serif Display (títulos) + DM Sans (corpo)
───────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;1,9..40,300&display=swap');

/* ── TOKENS DE DESIGN (MODO CLARO) ───────────────
   Altere aqui para mudar toda a identidade visual.
───────────────────────────────────────────────── */
:root {
  /* Fundos */
  --bg:          #fafaf8;   /* fundo principal */
  --bg2:         #f2f1ed;   /* superfície secundária */
  --bg3:         #e8e7e1;   /* superfície terciária / tracks */

  /* Textos */
  --text:        #1a1916;   /* texto principal */
  --text2:       #5a5852;   /* texto secundário */
  --text3:       #9a9890;   /* texto terciário / hints */

  /* Bordas */
  --border:      rgba(26,25,22,0.12);
  --border2:     rgba(26,25,22,0.22);

  /* Acento (cor de ação principal) */
  --accent:      #1a1916;

  /* Semânticas — acertos, erros, avisos, info */
  --green-bg:    #eaf3de; --green-text:  #3b6d11; --green-border: #97c459;
  --red-bg:      #fcebeb; --red-text:    #791f1f; --red-border:   #e24b4a;
  --blue-bg:     #e6f1fb; --blue-text:   #0c447c; --blue-border:  #85b7eb;
  --amber-bg:    #faeeda; --amber-text:  #633806; --amber-border: #ef9f27;
  --purple-bg:   #eeedfe; --purple-text: #3c3489; --purple-border:#7f77dd;

  /* Tipografia */
  --font-display: 'DM Serif Display', Georgia, serif;
  --font-body:    'DM Sans', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', 'Fira Code', 'Courier New', monospace;

  /* Escala tipográfica */
  --text-xs:   11px;
  --text-sm:   13px;
  --text-base: 15px;
  --text-lg:   18px;
  --text-xl:   22px;
  --text-2xl:  28px;
  --text-3xl:  36px;

  /* Raios de borda */
  --r-sm:   6px;
  --r-md:   10px;
  --r-lg:   14px;
  --r-xl:   20px;
  --r-pill: 9999px;

  /* Espaçamento base */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2.5rem;

  /* Sombras */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08), 0 1px 4px rgba(0,0,0,0.06);

  /* Transições */
  --transition-fast: 120ms ease;
  --transition-base: 220ms ease;
  --transition-slow: 400ms ease;

  /* Largura máxima do conteúdo */
  --max-width: 800px;
}

/* ── TOKENS DE DESIGN (MODO ESCURO) ──────────────
   Sobrescreve automaticamente quando o sistema usa dark mode.
   Altere aqui para ajustar o tema escuro.
───────────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
  :root {
    --bg:     #131210;
    --bg2:    #1d1c19;
    --bg3:    #272520;
    --text:   #f0efe8;
    --text2:  #a0a098;
    --text3:  #60605a;
    --border:  rgba(240,239,232,0.10);
    --border2: rgba(240,239,232,0.20);
    --accent: #f0efe8;

    --green-bg:    #182e08; --green-text:  #c0dd97; --green-border: #639922;
    --red-bg:      #2a0a0a; --red-text:    #f7c1c1; --red-border:   #a32d2d;
    --blue-bg:     #03254c; --blue-text:   #b5d4f4; --blue-border:  #378add;
    --amber-bg:    #271400; --amber-text:  #fac775; --amber-border: #ba7517;
    --purple-bg:   #1a1840; --purple-text: #afa9ec; --purple-border:#534ab7;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.35);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.40);
  }
}

/* ── RESET E BASE ─────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.65;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { font-family: var(--font-body); cursor: pointer; }
textarea, input, select { font-family: var(--font-body); }
img { max-width: 100%; display: block; }

/* ── ACESSIBILIDADE ───────────────────────────── */
.skip-nav {
  position: absolute; top: -100px; left: 1rem;
  background: var(--accent); color: var(--bg);
  padding: 0.5rem 1rem; border-radius: var(--r-md);
  transition: top var(--transition-base); z-index: 999;
  font-size: var(--text-sm); font-weight: 500;
}
.skip-nav:focus { top: 1rem; }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ── LAYOUT PRINCIPAL ─────────────────────────── */
.app-wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem 5rem;
}

/* ── HEADER / NAVEGAÇÃO ───────────────────────── */
.app-header {
  padding: 1.5rem 0 0;
  position: sticky; top: 0; z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}
.brand-row {
  display: flex; align-items: baseline; gap: 10px;
  margin-bottom: 1rem;
}
.brand-name {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  letter-spacing: -0.4px;
  color: var(--text);
}
.brand-tag {
  font-size: var(--text-xs);
  color: var(--text3);
  font-weight: 300;
  text-transform: uppercase;
  letter-spacing: 1.2px;
}
.brand-link {
  font-size: var(--text-xs);
  color: var(--blue-text);
  margin-left: auto;
  padding: 3px 10px;
  border: 1px solid var(--blue-border);
  border-radius: var(--r-pill);
  background: var(--blue-bg);
  transition: opacity var(--transition-fast);
}
.brand-link:hover { opacity: 0.75; }

/* ── TABS ─────────────────────────────────────── */
.tabs {
  display: flex;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  gap: 0;
}
.tabs::-webkit-scrollbar { display: none; }
.tab-btn {
  padding: 0.6rem 1.1rem;
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--text2);
  background: none; border: none;
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
  white-space: nowrap; flex-shrink: 0;
}
.tab-btn.active  { color: var(--text); border-bottom-color: var(--text); font-weight: 500; }
.tab-btn:hover:not(.active) { color: var(--text); }
.tab-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ── PAINÉIS ──────────────────────────────────── */
.panel { display: none; padding-top: 1.5rem; }
.panel.active { display: block; animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ── CARDS ────────────────────────────────────── */
.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-sm);
}
.card-muted {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.25rem 1.5rem;
}
.card + .card, .card-muted + .card-muted { margin-top: 1rem; }

/* ── SEÇÃO LABELS ─────────────────────────────── */
.section-label {
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text2);
  margin: 1.75rem 0 0.75rem;
}
.section-label:first-child { margin-top: 0; }

/* ── BADGES ───────────────────────────────────── */
.badge {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 500;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  line-height: 1.4;
}
.badge-cat     { background: var(--blue-bg);   color: var(--blue-text); }
.badge-facil   { background: var(--green-bg);  color: var(--green-text); }
.badge-medio   { background: var(--amber-bg);  color: var(--amber-text); }
.badge-dificil { background: var(--red-bg);    color: var(--red-text); }
.badge-new     { background: var(--purple-bg); color: var(--purple-text); }

/* ── BOTÕES ───────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  font-size: var(--text-sm);
  font-weight: 500;
  border-radius: var(--r-md);
  border: 1px solid var(--border2);
  background: var(--bg);
  color: var(--text);
  transition: all var(--transition-fast);
  line-height: 1;
}
.btn:hover  { background: var(--bg2); }
.btn:active { transform: scale(0.98); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-primary {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}
.btn-primary:hover { opacity: 0.82; background: var(--text); }
.btn-danger {
  background: var(--red-bg);
  color: var(--red-text);
  border-color: var(--red-border);
}
.btn-danger:hover { opacity: 0.85; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 1rem; }

/* ── INPUTS / SELECTS ─────────────────────────── */
.input, .select-sm, .csv-area {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border2);
  border-radius: var(--r-md);
  transition: border-color var(--transition-fast), outline var(--transition-fast);
}
.input, .select-sm { padding: 7px 10px; }
.input:focus, .select-sm:focus, .csv-area:focus {
  outline: 2px solid var(--accent);
  outline-offset: 0;
  border-color: transparent;
}
.csv-area {
  width: 100%; height: 110px;
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  resize: vertical;
  line-height: 1.6;
}
.hint {
  font-size: var(--text-xs);
  color: var(--text3);
  margin-top: 8px;
  line-height: 1.6;
}

/* ── TIMER BAR ────────────────────────────────── */
.timer-track {
  height: 3px;
  background: var(--bg3);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 1rem;
}
.timer-fill {
  height: 100%;
  background: var(--text);
  border-radius: 2px;
  transition: width 1s linear, background var(--transition-base);
}
.timer-fill.warning { background: var(--red-border); }

/* ── PROGRESS ROW ─────────────────────────────── */
.progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
  gap: 12px;
}
.progress-label { font-size: var(--text-sm); color: var(--text2); }
.score-chip {
  font-size: var(--text-sm);
  font-weight: 500;
  padding: 3px 12px;
  border-radius: var(--r-pill);
  background: var(--bg2);
  color: var(--text2);
  border: 1px solid var(--border);
  white-space: nowrap;
}

/* ── QUESTÃO ──────────────────────────────────── */
.q-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 0.75rem; }
.q-text {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  line-height: 1.55;
  color: var(--text);
  margin-bottom: 1.25rem;
  white-space: pre-line;
}
.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
@media (max-width: 520px) { .options-grid { grid-template-columns: 1fr; } }
.opt-btn {
  padding: 11px 14px;
  text-align: left;
  font-size: var(--text-sm);
  line-height: 1.45;
  border: 1px solid var(--border2);
  border-radius: var(--r-md);
  background: var(--bg2);
  color: var(--text);
  transition: all var(--transition-fast);
}
.opt-btn:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--bg);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.opt-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.opt-btn:disabled { cursor: default; transform: none; box-shadow: none; }
.opt-btn.correct {
  background: var(--green-bg);
  border-color: var(--green-border);
  color: var(--green-text);
  font-weight: 500;
}
.opt-btn.wrong {
  background: var(--red-bg);
  border-color: var(--red-border);
  color: var(--red-text);
}

/* ── FEEDBACK ─────────────────────────────────── */
.feedback {
  margin-top: 1rem;
  padding: 11px 14px;
  border-radius: var(--r-md);
  font-size: var(--text-sm);
  line-height: 1.55;
  display: none;
  border: 1px solid transparent;
  animation: slideIn 0.2s ease;
}
.feedback.show { display: block; }
.feedback.ok  { background: var(--green-bg);  color: var(--green-text);  border-color: var(--green-border); }
.feedback.err { background: var(--red-bg);    color: var(--red-text);    border-color: var(--red-border); }
@keyframes slideIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* ── COMPLETE A FRASE ─────────────────────────── */
.sentence-box {
  font-family: var(--font-display);
  font-size: 19px;
  line-height: 1.75;
  padding: 1.25rem 1.5rem;
  background: var(--bg2);
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  margin-bottom: 1.25rem;
  color: var(--text);
}
.blank {
  display: inline-block;
  min-width: 130px;
  border-bottom: 2px solid var(--text);
  color: var(--text3);
  font-style: italic;
  text-align: center;
  padding: 0 6px;
  transition: all var(--transition-base);
}
.blank.filled {
  color: var(--blue-text);
  border-color: var(--blue-border);
  font-style: normal;
  font-weight: 500;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 1rem; }
.chip {
  padding: 8px 16px;
  font-size: var(--text-sm);
  border: 1px solid var(--border2);
  border-radius: var(--r-pill);
  background: var(--bg);
  color: var(--text);
  transition: all var(--transition-fast);
}
.chip:hover:not(:disabled) {
  background: var(--bg2);
  border-color: var(--accent);
  transform: translateY(-1px);
}
.chip:disabled { opacity: 0.38; cursor: default; transform: none; }
.chip.selected { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── MÉTRICAS GRID ────────────────────────────── */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(115px, 1fr));
  gap: 10px;
  margin-bottom: 1.5rem;
}
.metric-card {
  background: var(--bg2);
  border-radius: var(--r-md);
  padding: 1rem;
  border: 1px solid var(--border);
  transition: box-shadow var(--transition-fast);
}
.metric-card:hover { box-shadow: var(--shadow-sm); }
.metric-label {
  font-size: var(--text-xs);
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.metric-val {
  font-size: 26px;
  font-weight: 500;
  line-height: 1;
  color: var(--text);
}
.metric-sub {
  font-size: var(--text-xs);
  color: var(--text3);
  margin-top: 4px;
}

/* ── BARRAS DE PROGRESSO ──────────────────────── */
.bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.bar-name {
  font-size: var(--text-sm);
  color: var(--text2);
  min-width: 130px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bar-track {
  flex: 1;
  height: 7px;
  background: var(--bg3);
  border-radius: 4px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.7s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--text);
}
.bar-fill.green  { background: var(--green-border); }
.bar-fill.amber  { background: var(--amber-border); }
.bar-fill.red    { background: var(--red-border); }
.bar-fill.blue   { background: var(--blue-border); }
.bar-fill.purple { background: var(--purple-border); }
.bar-pct {
  font-size: var(--text-sm);
  color: var(--text2);
  min-width: 46px;
  text-align: right;
  white-space: nowrap;
}

/* ── INSIGHTS ─────────────────────────────────── */
.insight-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 0.875rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin-bottom: 8px;
  transition: box-shadow var(--transition-fast);
}
.insight-item:hover { box-shadow: var(--shadow-sm); }
.insight-icon {
  font-size: 15px;
  flex-shrink: 0;
  color: var(--text2);
  margin-top: 2px;
  width: 20px;
  text-align: center;
}
.insight-main { font-size: var(--text-sm); color: var(--text); line-height: 1.5; font-weight: 500; }
.insight-sub  { font-size: var(--text-xs); color: var(--text3); margin-top: 3px; line-height: 1.5; }

/* ── CURVA DE APRENDIZADO ─────────────────────── */
.chart-wrap {
  position: relative;
  width: 100%;
  height: 220px;
  margin: 0.5rem 0 1.5rem;
}

/* ── LOADING ──────────────────────────────────── */
.loading-msg {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  padding: 2.5rem;
  color: var(--text2);
  font-size: var(--text-sm);
}
.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--border2);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── EMPTY STATE ──────────────────────────────── */
.empty-msg {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text3);
  font-size: var(--text-sm);
  line-height: 1.7;
}

/* ── CONFIGURAÇÕES ────────────────────────────── */
.config-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.config-label {
  font-size: var(--text-sm);
  color: var(--text2);
  min-width: 180px;
}

/* ── SETUP TITLE ──────────────────────────────── */
.setup-title {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 0.75rem;
}

/* ── TABELA DE HISTÓRICO ──────────────────────── */
.hist-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.hist-table th {
  text-align: left;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
}
.hist-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
.hist-table tr:last-child td { border-bottom: none; }
.hist-table tr:hover td { background: var(--bg2); }
.mark-ok  { color: var(--green-text); font-weight: 500; }
.mark-err { color: var(--red-text); font-weight: 500; }

/* ── REPORT BOX ───────────────────────────────── */
.report-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 1rem 1.25rem;
  margin-top: 0.75rem;
}
.report-desc {
  font-size: var(--text-sm);
  color: var(--text2);
  margin-bottom: 1rem;
  line-height: 1.6;
}

/* ── DASHBOARD LINK ───────────────────────────── */
.dash-promo {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 1rem 1.25rem;
  background: var(--blue-bg);
  border: 1px solid var(--blue-border);
  border-radius: var(--r-md);
  margin-bottom: 1.5rem;
  transition: opacity var(--transition-fast);
}
.dash-promo:hover { opacity: 0.88; }
.dash-promo-text { font-size: var(--text-sm); color: var(--blue-text); line-height: 1.5; }
.dash-promo-text strong { display: block; font-weight: 500; }

/* ── ANIMAÇÕES ESPECIAIS ──────────────────────── */
@keyframes pop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.15); }
  100% { transform: scale(1); }
}
.pop { animation: pop 0.3s ease; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25%       { transform: translateX(-4px); }
  75%       { transform: translateX(4px); }
}
.shake { animation: shake 0.3s ease; }

/* ── RESPONSIVO ───────────────────────────────── */
@media (max-width: 600px) {
  .app-wrap { padding: 0 0.875rem 4rem; }
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .bar-name { min-width: 90px; font-size: 11px; }
  .card, .card-muted { padding: 1rem; }
}
