/* ============================================================
   BANCO DE PREGUNTAS — Styles
   ============================================================ */

/* ── BancoCatalog: 5-tile grid ──────────────────────────────── */
.bc-tiles-section { margin: 32px 0 24px; }

.bc-tiles-top {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.bc-tiles-bottom {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 12px;
}
.bc-tiles-bottom .bc-tile {
  flex: 1;
  max-width: calc(33.33% - 6px);
}

.bc-tile {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 24px 20px 20px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  min-height: 148px;
  justify-content: center;
  user-select: none;
}
.bc-tile:hover,
.bc-tile:focus-visible {
  background: var(--surface-2);
  border-color: var(--bc-accent, var(--red));
  box-shadow: 0 0 0 1px var(--bc-accent, var(--red-glow)),
              0 0 28px rgba(0,0,0,0.4);
  outline: none;
}
.bc-tile-jp {
  font-family: var(--font-jp);
  font-size: 38px;
  font-weight: 900;
  line-height: 1;
  color: var(--line-2);
  transition: color 0.15s;
}
.bc-tile:hover .bc-tile-jp { color: var(--bc-accent, var(--red)); }
.bc-tile-label {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-2);
  line-height: 1.3;
}
.bc-tile-count {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
  color: var(--bc-accent, var(--ok));
}

/* ── BancoCatalog: materia modal ────────────────────────────── */
.bc-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 800;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.bc-modal-shell {
  background: var(--surface);
  border: 1px solid var(--line-2);
  width: 100%;
  max-width: 920px;
  height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
@keyframes bcIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.bc-modal-anim { animation: bcIn 0.18s ease both; }
@media (prefers-reduced-motion: reduce) {
  .bc-modal-anim { animation: none; }
}

.bc-modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.bc-modal-body {
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* ── Document list ──────────────────────────────────────────── */
.bc-doc-list {
  height: 100%;
  overflow-y: auto;
  padding: 0;
}
.bc-doc-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.1s;
}
.bc-doc-row:hover { background: var(--surface-2); }

/* ── Three-state pill ───────────────────────────────────────── */
.bc-pill {
  display: inline-flex;
  border: 1px solid var(--line-2);
  overflow: hidden;
  flex-shrink: 0;
}
.bc-pill-btn {
  padding: 5px 10px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  cursor: pointer;
  border: none;
  background: var(--surface);
  color: var(--muted-2);
  transition: background 0.1s, color 0.1s;
  white-space: nowrap;
}
.bc-pill-btn:not(:last-child) { border-right: 1px solid var(--line-2); }
.bc-pill-btn.active-activar         { background: rgba(110,231,135,0.15); color: var(--ok);    }
.bc-pill-btn.active-solo_simulacros { background: rgba(255,180,61,0.15);  color: var(--amber); }
.bc-pill-btn.active-denegar         { background: rgba(255,77,77,0.15);   color: var(--err);   }
.bc-pill-btn:hover:not([class*="active-"]) { color: var(--ink); background: var(--surface-2); }

/* ── Question panel (second level) ─────────────────────────── */
.bc-q-panel {
  position: absolute;
  inset: 0;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.22s ease;
  overflow: hidden;
}
.bc-q-panel.open { transform: translateX(0); }
@media (prefers-reduced-motion: reduce) {
  .bc-q-panel { transition: none; }
}

.bc-q-panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.bc-q-list {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
}

/* ── Question card ──────────────────────────────────────────── */
.bc-q-card {
  border: 1px solid var(--line);
  background: var(--bg-2);
  margin-bottom: 10px;
}
.bc-q-card-body {
  display: grid;
  grid-template-columns: 1fr 160px;
  gap: 16px;
  padding: 14px 16px;
}
.bc-q-num {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 700;
  color: var(--line-2);
  line-height: 1;
  margin-bottom: 8px;
}
.bc-q-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

/* Context block */
.bc-context-block {
  border-left: 3px solid var(--line-2);
  background: var(--surface-2);
  padding: 10px 14px;
  margin-bottom: 12px;
}
.bc-context-toggle {
  background: none;
  border: none;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  text-align: left;
}
.bc-context-toggle:hover { color: var(--ink); }
.bc-context-text {
  font-size: 12px;
  color: var(--ink-2);
  line-height: 1.65;
  margin-top: 8px;
  white-space: pre-wrap;
}

.bc-enunciado {
  font-size: 13px;
  line-height: 1.65;
  color: var(--ink);
  margin-bottom: 12px;
}
.bc-option {
  display: flex;
  gap: 10px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  margin-bottom: 5px;
  font-size: 12px;
  line-height: 1.4;
}
.bc-option-letter {
  font-family: var(--font-mono);
  color: var(--muted);
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
}
.bc-respuesta-btn {
  background: transparent;
  border: 1px solid var(--line-2);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 5px 12px;
  cursor: pointer;
  margin-top: 10px;
  transition: border-color 0.12s, color 0.12s;
}
.bc-respuesta-btn:hover { border-color: var(--red); color: var(--red); }
.bc-respuesta-reveal {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 7px 14px;
  background: rgba(110,231,135,0.08);
  border: 1px solid var(--ok);
  font-family: var(--font-mono);
}
.bc-visual-block {
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-left: 3px solid var(--cyan);
  margin-bottom: 10px;
  font-size: 12px;
  color: var(--ink-2);
  line-height: 1.6;
}

/* Skeleton */
.bc-skeleton {
  background: linear-gradient(
    90deg,
    var(--surface) 25%,
    var(--surface-2) 50%,
    var(--surface) 75%
  );
  background-size: 200% 100%;
  animation: bcSkel 1.4s infinite;
  border-radius: 2px;
}
@keyframes bcSkel {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── RecursoVisual renderer ─────────────────────────────────── */
/* --rv-accent lo define inline cada visual según la materia de la pregunta */
.rv-wrap {
  --rv-accent: var(--cyan);
  margin: 12px 0;
  background: var(--surface-2);
  border: 1px solid var(--rv-accent);
  border-left: 3px solid var(--rv-accent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--rv-accent) 18%, transparent);
  overflow: hidden;
}
.rv-svg { padding: 8px; background: #fff; }
.rv-svg svg { display: block; margin: 0 auto; max-height: 420px; }
.rv-chart { padding: 12px 16px; }
.rv-chart canvas { max-height: 360px; }
.rv-html { padding: 8px; }
.rv-pending {
  padding: 12px 16px;
}
.rv-texto {
  padding: 12px 16px;
  background: var(--surface-2);
}
/* Skeleton del tamaño aprox del SVG mientras la cola lo genera */
.rv-skeleton-box {
  width: 100%;
  height: 200px;
  border-radius: 4px;
  background: linear-gradient(90deg,
    rgba(255,255,255,0.03) 25%,
    rgba(255,255,255,0.07) 50%,
    rgba(255,255,255,0.03) 75%);
  background-size: 200% 100%;
  animation: rvSkel 1.4s infinite;
}
@keyframes rvSkel {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
/* Transición suave al reemplazar skeleton por el SVG */
.rv-svg, .rv-chart, .rv-html { animation: rvFadeIn 0.3s ease; }
@keyframes rvFadeIn { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .rv-skeleton-box, .rv-svg, .rv-chart, .rv-html { animation: none; }
}
.rv-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--rv-accent);
  margin-bottom: 6px;
}
.rv-desc { font-size: 12px; color: var(--ink-2); line-height: 1.6; }

/* "IMAGEN" section header — readable on both white (svg) and dark backgrounds */
.rv-header {
  display: inline-block;
  background: var(--rv-accent, var(--cyan));
  color: #0A0A0A;
  padding: 3px 8px;
  margin-bottom: 8px;
  border-radius: 2px;
  font-weight: 700;
}
.rv-pending-note {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--rv-accent, var(--cyan));
  margin-bottom: 8px;
}
.rv-spinner-sm {
  width: 11px;
  height: 11px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  opacity: 0.9;
  border-radius: 50%;
  display: inline-block;
  animation: rvspin 0.7s linear infinite;
}
@keyframes rvspin { to { transform: rotate(360deg); } }

/* ── Prueba: bloque de contexto compartido ──────────────────── */
.prueba-contexto {
  margin-bottom: 20px;
  padding: 14px 18px;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-left: 4px solid var(--red);
}
.prueba-contexto-range {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 10px;
}
.prueba-contexto-body {
  font-size: 13px;
  line-height: 1.75;
  color: var(--ink-2);
  white-space: pre-wrap;
}

/* ── Respondedor UI states ──────────────────────────────────── */
.bc-resp-pending {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 5px 0;
  opacity: 0.75;
}
.bc-resp-failed {
  margin-top: 10px;
}
.bc-resp-letter-btn {
  background: var(--surface-3);
  border: 1px solid var(--line-2);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
}
.bc-resp-letter-btn:hover {
  background: var(--surface-2);
  color: var(--ink);
  border-color: var(--red);
}
.bc-badge-ia {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--amber);
  border: 1px solid rgba(255,180,61,0.4);
  background: rgba(255,180,61,0.1);
}

/* Generation progress notice */
.rv-gen-notice {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(61,240,255,0.06);
  border-bottom: 1px solid rgba(61,240,255,0.2);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--cyan);
  flex-shrink: 0;
}
.rv-spinner {
  width: 12px;
  height: 12px;
  border: 2px solid rgba(61,240,255,0.25);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

/* Responsive */
@media (max-width: 860px) {
  .bc-tiles-top { grid-template-columns: repeat(2, 1fr); }
  .bc-tiles-bottom { justify-content: flex-start; }
  .bc-tiles-bottom .bc-tile { max-width: none; }
}
@media (max-width: 600px) {
  .bc-tiles-top { grid-template-columns: 1fr; }
  .bc-tiles-bottom { flex-direction: column; }
  .bc-tiles-bottom .bc-tile { max-width: none; }
  .bc-q-card-body { grid-template-columns: 1fr; }
  .bc-q-controls { flex-direction: row; flex-wrap: wrap; align-items: flex-start; }
  .bc-doc-row { grid-template-columns: 1fr auto; }
  .bc-doc-row .bc-date-cell { display: none; }
}

/* ── Upload zone ─────────────────────────────────────────── */
.bank-upload-zone {
  border: 2px dashed var(--line);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  margin-bottom: 16px;
  position: relative;
}
.bank-upload-zone:hover,
.bank-upload-zone.drag-over {
  border-color: var(--red);
  background: rgba(255, 42, 42, 0.03);
}

/* ── Materia selector ────────────────────────────────────── */
.bank-materia-select {
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s;
}
.bank-materia-select:focus {
  border-color: var(--red);
}

/* ── Cyberpunk progress bar ──────────────────────────────── */
.bank-bar-track {
  width: 300px;
  height: 4px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  position: relative;
  overflow: hidden;
}

.bank-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--red-deep), var(--red), #FF7070);
  transition: width 0.4s ease;
  box-shadow: 0 0 10px var(--red-glow), 0 0 20px rgba(255, 42, 42, 0.2);
  position: relative;
}

/* Glitch flicker */
@keyframes bar-flicker {
  0%,  88%, 100% { opacity: 1; }
  90%             { opacity: 0.6; }
  92%             { opacity: 1; }
  94%             { opacity: 0.4; }
  96%             { opacity: 1; }
}
.bank-bar-fill::after {
  content: "";
  position: absolute;
  top: 0; right: 0;
  width: 20px; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.6));
  animation: bar-shimmer 1.2s infinite;
}
@keyframes bar-shimmer {
  0%   { opacity: 0; transform: translateX(-20px); }
  50%  { opacity: 1; }
  100% { opacity: 0; transform: translateX(10px); }
}

/* ── 7-column grid ───────────────────────────────────────── */
.bank-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}

.bank-col {
  background: var(--bg);
  min-width: 0;
}

.bank-col-header {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 8px 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: default;
  user-select: none;
  transition: color 0.15s, background 0.15s;
  position: sticky;
  top: 0;
  z-index: 2;
}
.bank-col-header:hover {
  color: var(--ink);
  background: var(--surface-2);
}
/* Visual cue for double-click affordance */
.bank-col-header::after {
  content: "⊞";
  font-size: 8px;
  color: var(--muted-2);
  opacity: 0;
  transition: opacity 0.15s;
  margin-left: 2px;
}
.bank-col-header:hover::after {
  opacity: 1;
}

.bank-col-body {
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ── Cards ───────────────────────────────────────────────── */
.bank-card {
  background: var(--surface);
  border: 1px solid var(--line);
  overflow: hidden;
  transition: border-color 0.15s;
}
.bank-card:hover {
  border-color: var(--line-2);
}

.bank-card-compact {
  width: 180px;
  flex-shrink: 0;
}

.bank-card-header {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 10px 8px;
  cursor: pointer;
}
.bank-card-header:hover {
  background: var(--surface-2);
}

/* ── Question rows ───────────────────────────────────────── */
.bank-questions-list {
  animation: fadeInUp 0.2s ease both;
}

.bank-q-row {
  transition: background 0.1s;
  cursor: default;
}
.bank-q-row:hover {
  background: var(--surface-2);
}
/* Double-click cursor hint */
.bank-q-row:active {
  background: var(--surface-3);
}

/* ── Status button variants ──────────────────────────────── */
.bank-status-btn {
  letter-spacing: 0.06em;
  line-height: 1;
  white-space: nowrap;
}

/* ── Invisible tag ───────────────────────────────────────── */
.tag-invisible {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--amber);
  border: 1px solid var(--amber);
  background: rgba(255, 180, 61, 0.08);
}

/* ── Varios row ──────────────────────────────────────────── */
.bank-varios-row {
  margin-bottom: 24px;
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
}

/* ── Modals ──────────────────────────────────────────────── */
.bank-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 700;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 0.15s ease;
}

.bank-modal-box {
  background: var(--surface);
  border: 1px solid var(--line-2);
  padding: 24px;
  width: 100%;
  max-width: 560px;
  max-height: 82vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

/* Folder modal */
.bank-folder-box {
  background: var(--surface);
  border: 1px solid var(--line-2);
  padding: 24px;
  width: 100%;
  max-width: 860px;
  max-height: 82vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.bank-folder-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* ── Loading overlay animation ───────────────────────────── */
#bank-loading-overlay {
  animation: fadeIn 0.4s ease;
}

/* ── Responsive: collapse grid on narrow screens ─────────── */
@media (max-width: 900px) {
  .bank-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
@media (max-width: 600px) {
  .bank-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .bank-col-header { font-size: 8px; padding: 6px 6px; }
}
