/* ══════════════════════════════════════════════
   ESTUDO — ESTILO ANKIDROID
   ══════════════════════════════════════════════ */

/* Remove layout padrão da app-shell nesta página */
.study-body { display: block; background: #f2f4f5; }
.study-body .app-layout,
.study-body .sidebar,
.study-body .app-content,
.study-body .app-topbar,
.study-body .app-main { all: unset; display: contents; }

/* ── Telas ──────────────────────────────────── */
.anki-screen {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  background: #f2f4f5;
}
.anki-screen[hidden] { display: none !important; }
.anki-screen--review { background: #fff; }

/* ── Top bar (estilo AnkiDroid) ─────────────── */
.anki-topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 56px;
  padding: 0 8px 0 4px;
  background: #102a33;
  color: #fff;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 10;
}
.anki-topbar__back {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  flex-shrink: 0;
}
.anki-topbar__back:hover { background: rgba(255,255,255,0.12); }
.anki-topbar__title {
  flex: 1;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.anki-topbar__action {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
}
.anki-topbar__action:hover { background: rgba(255,255,255,0.12); }

/* Contadores HUD na topbar da tela de revisão */
.anki-queue-hud {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}
.anki-q {
  font-size: 0.95rem;
  font-weight: 800;
  min-width: 20px;
  text-align: center;
}
.anki-q--learning { color: #ff7b7b; }
.anki-q--new      { color: #82aaff; }
.anki-q--due      { color: #69d49a; }

.anki-zoom-controls {
  display: flex;
  gap: 4px;
  margin-right: 8px;
}
.anki-zoom-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: 4px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.anki-zoom-btn:active { background: rgba(255, 255, 255, 0.1); }

/* ── Lista de Decks (Tela 1) ─────────────────── */
.anki-deck-list {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 80px; /* espaço para bottom nav */
}

/* Continuidade e desempenho antes da lista de decks. */
.study-overview { display: grid; gap: 16px; padding: 24px 16px 20px; background: linear-gradient(145deg, #edf7f8, #f8fbfb); border-bottom: 1px solid #d8e6e8; }
.study-overview__eyebrow { color: #23697a; font-size: .7rem; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.study-overview h1 { margin: 5px 0 6px; color: #102a33; font-size: clamp(1.35rem, 4vw, 1.9rem); line-height: 1.2; }
.study-overview p { max-width: 620px; margin: 0; color: #58707a; font-size: .88rem; line-height: 1.55; }
.study-overview__action { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; width: min(100%, 620px); border: 1px solid #bcd9de; border-radius: 12px; background: #fff; color: #102a33; padding: 13px 14px; text-align: left; cursor: pointer; box-shadow: 0 3px 10px rgba(14,40,48,.05); }
.study-overview__action:hover { border-color: #31849a; }
.study-overview__action span { color: #58707a; font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.study-overview__action strong { overflow: hidden; font-size: .94rem; text-overflow: ellipsis; white-space: nowrap; }
.study-overview__action i { color: #23697a; font-size: 1.15rem; font-style: normal; }
.study-recent-list { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; color: #58707a; font-size: .76rem; font-weight: 700; }
.study-recent-list button { border: 1px solid #c8dce0; border-radius: 999px; background: rgba(255,255,255,.7); color: #24404a; padding: 5px 9px; font: inherit; cursor: pointer; }
.study-recent-list button:hover { border-color: #31849a; color: #174f5f; }

/* Cabeçalho da tabela */
.anki-deck-header {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: #e8eced;
  border-bottom: 1px solid #d0d5d7;
}
.anki-deck-header span {
  font-size: 0.72rem;
  font-weight: 700;
  color: #5a6a70;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.anki-deck-header .col-num { width: 28px; text-align: center; }

/* Linha de deck */
.anki-deck-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: #fff;
  border-bottom: 1px solid #e8ecee;
  cursor: pointer;
  transition: background 120ms;
  -webkit-tap-highlight-color: transparent;
}
.anki-deck-row:active,
.anki-deck-row:hover { background: #f0f6f8; }
.anki-deck-row__name {
  font-size: 0.98rem;
  color: #1a2d35;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.anki-deck-row__name strong, .anki-deck-row__name small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.anki-deck-row__name strong { color: #1a2d35; font-weight: 650; }
.anki-deck-row__name small { margin-top: 2px; color: #6d838a; font-size: .72rem; font-weight: 650; }
.anki-deck-row__name--sub {
  font-size: 0.9rem;
  color: #2e4d59;
  padding-left: 16px;
}
.anki-deck-row__name--sub strong { color: #2e4d59; }
.anki-deck-num {
  width: 28px;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.anki-deck-num--learning { color: #d94f4f; }
.anki-deck-num--new      { color: #3a6ee8; }
.anki-deck-num--due      { color: #2a9e5a; }

@media (min-width: 700px) {
  .study-overview { padding: 30px max(24px, calc((100% - 920px) / 2)) 24px; }
  .anki-deck-header, .anki-deck-row { padding-inline: max(24px, calc((100% - 920px) / 2)); }
}

/* Estado vazio/carregando */
.anki-loading {
  padding: 48px 24px;
  text-align: center;
  color: #7a9199;
  font-size: 0.95rem;
}
.anki-empty-icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 12px;
}

/* ── Bottom nav (Tela 1) ─────────────────────── */
.anki-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  height: 60px;
  background: #fff;
  border-top: 1px solid #dde3e5;
  z-index: 20;
}
.anki-bottom-nav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: #7a9199;
  text-decoration: none;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 6px 0;
  transition: color 120ms;
}
.anki-bottom-nav__item--active { color: #102a33; }
.anki-bottom-nav__item:hover { color: #102a33; }

/* ── Tela de Revisão (Tela 2) ────────────────── */
.anki-review-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 0;
}

/* Badge de status do cartão (NOVO CONTEÚDO / REVISÃO) */
.anki-card-status {
  padding: 10px 20px 6px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #102a33;
  background: #fff;
}

/* Zona do conteúdo do cartão */
.anki-card-zone {
  flex: 1;
  padding: 24px 22px;
  background: #fff;
}

/* Frente do cartão */
.anki-card-front {
  font-size: 1.15em;
  line-height: 1.7;
  color: #1a2d35;
  overflow-wrap: anywhere;
}

/* Linha divisória entre frente e verso */
.anki-card-divider {
  height: 1px;
  background: #dde3e5;
  margin: 20px 0;
}

/* Verso do cartão */
.anki-card-back {
  font-size: 1.05em;
  line-height: 1.65;
  color: #1a2d35;
  overflow-wrap: anywhere;
}

/* ── Footer com botões (fixo na base) ────────── */
.anki-review-footer {
  flex-shrink: 0;
  background: #fff;
  border-top: 1px solid #dde3e5;
  padding: 0;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* Botão "Mostrar resposta" — full-width */
.anki-show-btn {
  display: block;
  width: 100%;
  padding: 18px 24px;
  background: #102a33;
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: none;
  cursor: pointer;
  transition: background 120ms;
}
.anki-show-btn:hover { background: #1a3f4e; }
.anki-show-btn[hidden] { display: none; }

/* Barra de avaliação — 4 botões lado a lado */
.anki-rating-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}
.anki-rating-bar[hidden] { display: none; }
.anki-rating-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 14px 6px;
  border: none;
  border-right: 1px solid rgba(255,255,255,0.15);
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  font-size: 0.88rem;
  line-height: 1.2;
  transition: filter 120ms;
}
.anki-rating-btn:last-child { border-right: none; }
.anki-rating-btn:hover { filter: brightness(1.12); }
.anki-rating-btn__time {
  font-size: 0.72rem;
  font-weight: 500;
  opacity: 0.82;
}
/* Cores iguais ao AnkiDroid */
.rating-again { background: #c0392b; }
.rating-hard  { background: #6c5f73; }
.rating-good  { background: #1a6e4e; }
.rating-easy  { background: #1d6b8a; }

/* ── Dialog ────────────────────────────────── */
.settings-dialog { width: min(520px, calc(100% - 24px)); border: 0; border-radius: 16px; box-shadow: 0 8px 40px rgba(0,0,0,0.22); padding: 0; }
.settings-dialog::backdrop { background: rgba(8,31,40,0.65); backdrop-filter: blur(3px); }
.dialog-body { padding: 24px; }
.dialog-head { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.dialog-head button { width: 38px; height: 38px; border: 1px solid #dde3e5; border-radius: 10px; background: #fff; cursor: pointer; font-size: 1.3rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

[data-theme="dark"] .study-body,
[data-theme="dark"] .anki-screen { background: var(--surface-soft); }
[data-theme="dark"] .anki-screen--review,
[data-theme="dark"] .anki-card-status,
[data-theme="dark"] .anki-card-zone,
[data-theme="dark"] .anki-review-footer,
[data-theme="dark"] .anki-bottom-nav,
[data-theme="dark"] .anki-deck-row,
[data-theme="dark"] .dialog-head button { background: var(--surface); }
[data-theme="dark"] .study-overview { background: linear-gradient(145deg, #11262c, var(--surface-soft)); border-color: var(--line); }
[data-theme="dark"] .study-overview h1,
[data-theme="dark"] .anki-deck-row__name,
[data-theme="dark"] .anki-deck-row__name strong,
[data-theme="dark"] .anki-card-status,
[data-theme="dark"] .anki-card-front,
[data-theme="dark"] .anki-card-back { color: var(--ink-950); }
[data-theme="dark"] .study-overview p,
[data-theme="dark"] .study-overview__action span,
[data-theme="dark"] .study-recent-list,
[data-theme="dark"] .anki-deck-row__name small,
[data-theme="dark"] .anki-loading,
[data-theme="dark"] .anki-bottom-nav__item { color: var(--ink-600); }
[data-theme="dark"] .study-overview__action,
[data-theme="dark"] .study-recent-list button { background: var(--surface); color: var(--ink-950); border-color: var(--line); }
[data-theme="dark"] .anki-deck-header { background: var(--surface-muted); border-color: var(--line); }
[data-theme="dark"] .anki-deck-header span { color: var(--ink-600); }
[data-theme="dark"] .anki-deck-row { border-color: var(--line); }
[data-theme="dark"] .anki-deck-row:active,
[data-theme="dark"] .anki-deck-row:hover { background: var(--surface-muted); }
[data-theme="dark"] .anki-card-divider,
[data-theme="dark"] .anki-review-footer { border-color: var(--line); }
