/* ============================================================
   ICFES // CYBERDECK — Design System
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Archivo+Black&family=Space+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;700&family=Noto+Sans+JP:wght@700;900&display=swap');

:root {
  --bg:       #0A0A0A;
  --bg-2:     #111111;
  --surface:  #151515;
  --surface-2:#1C1C1C;
  --surface-3:#252525;
  --line:     #262626;
  --line-2:   #333333;
  --ink:      #EDE8E0;
  --ink-2:    #BFBAB1;
  --muted:    #6B6660;
  --muted-2:  #4A4641;

  /* Accent — controlled by Tweaks JS */
  --red:      #FF2A2A;
  --red-deep: #C21818;
  --red-glow: rgba(255,42,42,0.35);

  /* Acento — por defecto sigue al rojo; theme.js lo sobreescribe por personaje */
  --acento:      var(--red);
  --acento-rgb:  255, 42, 42;
  --acento-glow: var(--red-glow);
  --acento-dim:  rgba(255,42,42,0.10);

  --lime:  #B8FF3D;
  --cyan:  #3DF0FF;
  --amber: #FFB43D;
  --ok:    #6EE787;
  --err:   #FF4D4D;

  --font-display: 'Archivo Black', 'Space Grotesk', system-ui, sans-serif;
  --font-ui:      'Space Grotesk', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, monospace;
  --font-jp:      'Noto Sans JP', sans-serif;

  --r-sm: 2px;
  --r-md: 4px;
  --r-lg: 8px;

  /* Legacy aliases for existing JS */
  --color-primary:       var(--red);
  --color-primary-light: var(--red);
  --color-primary-dim:   rgba(255,42,42,0.1);
  --color-primary-glow:  var(--red-glow);
  --color-bg:            var(--bg);
  --color-surface:       var(--surface);
  --color-surface-2:     var(--surface-2);
  --color-surface-3:     var(--surface-3);
  --color-border:        var(--line);
  --color-border-2:      var(--line-2);
  --color-text:          var(--ink);
  --color-text-muted:    var(--muted);
  --color-text-dim:      var(--muted-2);
  --color-success:       var(--ok);
  --color-error:         var(--err);
  --color-warning:       var(--amber);
  --nav-height:          62px;
  --font:                var(--font-ui);

  /* More legacy aliases */
  --color-bg-2:          var(--bg-2);
  --color-lime:          var(--lime);
  --color-cyan:          var(--cyan);
  --color-primary-deep:  var(--red-deep);
  --color-info:          var(--cyan);

  /* Radii + transitions (old codebase refs) */
  --radius-sm:  2px;
  --radius-md:  4px;
  --radius-lg:  8px;
  --transition-fast: 0.15s ease;

  /* Shadows */
  --shadow-sm:     0 1px 4px rgba(0,0,0,0.5);
  --shadow-md:     0 4px 16px rgba(0,0,0,0.6);
  --shadow-lg:     0 8px 32px rgba(0,0,0,0.7);
  --shadow-orange: 0 0 0 1px var(--red-glow), 0 4px 24px var(--red-glow);
}

/* ── Reset ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "ss02";
}

body {
  min-height: 100vh;
  background-image:
    radial-gradient(ellipse at top left,    rgba(255,42,42,0.06), transparent 50%),
    radial-gradient(ellipse at bottom right, rgba(255,42,42,0.04), transparent 50%);
}

/* Scanlines */
body.scan-on::after {
  content: "";
  position: fixed; inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0, transparent 2px,
    rgba(255,255,255,0.012) 2px, rgba(255,255,255,0.012) 3px
  );
  pointer-events: none;
  z-index: 9999;
  mix-blend-mode: overlay;
}

/* Film grain */
body::before {
  content: "";
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.18 0'/></filter><rect width='120' height='120' filter='url(%23n)'/></svg>");
  opacity: var(--grain-opacity, 0.4);
  pointer-events: none;
  z-index: 9998;
  mix-blend-mode: overlay;
}

a { color: var(--red); text-decoration: none; }
button { font-family: var(--font-ui); cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea {
  font-family: var(--font-ui);
  background: var(--bg);
  border: 1px solid var(--line-2);
  color: var(--ink);
  padding: 10px 14px;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 2px var(--red-glow);
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--line-2); }
::-webkit-scrollbar-thumb:hover { background: var(--red); }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

/* ── Typography ─────────────────────────────────── */
.display {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: -0.01em;
  line-height: 0.92;
}
.mono { font-family: var(--font-mono); }
.jp   { font-family: var(--font-jp); font-weight: 900; }

.label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
.label-red {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--red);
}

/* Legacy aliases */
.label-accent { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--red); }
.text-accent  { color: var(--red); }
.text-muted   { color: var(--muted); }
.text-success { color: var(--ok); }
.text-error   { color: var(--err); }

h1 { font-family: var(--font-display); font-size: 1.8rem; text-transform: uppercase; line-height: 0.92; }
h2 { font-family: var(--font-display); font-size: 1.4rem; text-transform: uppercase; }
h3 { font-family: var(--font-ui); font-size: 1rem; font-weight: 600; }
h4 { font-size: 0.9rem; font-weight: 600; }

/* ── Notched corners ────────────────────────────── */
.notch {
  --n: 12px;
  clip-path: polygon(0 0, calc(100% - var(--n)) 0, 100% var(--n), 100% 100%, var(--n) 100%, 0 calc(100% - var(--n)));
}
.notch-tl {
  --n: 14px;
  clip-path: polygon(var(--n) 0, 100% 0, 100% 100%, 0 100%, 0 var(--n));
}

/* ── Buttons ────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
  white-space: nowrap;
}
.btn:hover { border-color: var(--ink); }

.btn-primary { background: var(--red); color: #0A0A0A; border-color: var(--red); }
.btn-primary:hover { background: #FF4242; border-color: #FF4242; box-shadow: 0 0 0 1px var(--red-glow), 0 4px 24px var(--red-glow); }

.btn-outline  { background: transparent; border: 1px solid var(--line-2); color: var(--ink); }
.btn-outline:hover { border-color: var(--red); color: var(--red); }

.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { color: var(--ink); background: var(--surface-2); border-color: var(--line-2); }

.btn-danger { background: var(--err); color: #fff; border-color: var(--err); }
.btn-danger:hover { opacity: 0.85; }

.btn-sm { padding: 6px 14px; font-size: 11px; }
.btn-lg { padding: 14px 28px; font-size: 13px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-cut {
  --cut: 8px;
  clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
}

/* ── Tags / Badges ──────────────────────────────── */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: 1px solid var(--line-2);
  color: var(--ink-2);
  background: var(--surface);
}
.tag-red      { color: var(--red);  border-color: var(--red);  background: rgba(255,42,42,0.08); }
.tag-lime     { color: var(--lime); border-color: rgba(184,255,61,0.4); background: rgba(184,255,61,0.06); }
.tag-cyan     { color: var(--cyan); border-color: rgba(61,240,255,0.4); background: rgba(61,240,255,0.06); }
.tag-solid-red{ background: var(--red); color: #0A0A0A; border-color: var(--red); font-weight: 700; }

/* Legacy badge aliases */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; font-family: var(--font-mono); font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.badge-orange { background: rgba(255,42,42,0.08); color: var(--red); border: 1px solid rgba(255,42,42,0.3); }
.badge-green  { background: rgba(110,231,135,0.1); color: var(--ok); }
.badge-gray   { background: var(--surface-2); color: var(--muted); }

/* ── Cards ──────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--line); padding: 20px; }
.card-hover { transition: border-color 0.15s, box-shadow 0.15s; }
.card-hover:hover { border-color: var(--red); box-shadow: 0 0 0 1px var(--red-glow), 0 0 20px rgba(255,42,42,0.1); }

/* ── Utilities ──────────────────────────────────── */
.flex { display: flex; }
.row  { display: flex; flex-direction: row; }
.col  { display: flex; flex-direction: column; }
.items-center    { align-items: center; }
.items-end       { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.justify-end     { justify-content: flex-end; }
.grow { flex: 1; }
.rel  { position: relative; }

.gap-1 { gap: 4px; }  .gap-2 { gap: 8px; }  .gap-3 { gap: 12px; }
.gap-4 { gap: 16px; } .gap-6 { gap: 24px; } .gap-8 { gap: 32px; }

.mt-1 { margin-top: 8px; }   .mt-2 { margin-top: 16px; }  .mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; }.mb-3 { margin-bottom: 24px; }
.w-full { width: 100%; }

/* ── Note/markdown content ──────────────────────── */
.note-content h1 { font-size: 1.5rem; margin-bottom: 16px; }
.note-content h2 { font-size: 1.2rem; margin: 20px 0 12px; color: var(--red); border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.note-content h3 { font-size: 1rem; margin: 16px 0 8px; color: var(--muted); }
.note-content p  { margin-bottom: 12px; line-height: 1.7; }
.note-content ul, .note-content ol { margin: 8px 0 12px 20px; }
.note-content li { margin-bottom: 6px; }
.note-content strong { color: var(--red); }
.note-content em     { color: var(--muted); }
.note-content code   { background: var(--surface-2); padding: 2px 6px; font-family: var(--font-mono); font-size: 0.88rem; color: var(--red); }
.note-content pre.code-block { background: var(--surface-2); padding: 16px; overflow-x: auto; margin: 12px 0; border-left: 3px solid var(--red); font-family: var(--font-mono); }
.note-content .table-wrapper { overflow-x: auto; margin: 16px 0; }
.note-content table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.note-content th { background: var(--surface-2); color: var(--red); padding: 10px 14px; text-align: left; border-bottom: 2px solid var(--red); font-family: var(--font-mono); }
.note-content td { padding: 8px 14px; border-bottom: 1px solid var(--line); }
.note-content tr:hover td { background: var(--surface-2); }
.note-content blockquote { border-left: 3px solid var(--red); padding: 8px 16px; margin: 12px 0; color: var(--muted); background: var(--surface-2); }

.icfes-note { background: rgba(255,42,42,0.06); border: 1px solid rgba(255,42,42,0.3); padding: 12px 16px; margin: 16px 0; font-size: 0.88rem; }
.icfes-tip-box { background: var(--bg-2); border-left: 3px solid var(--red); padding: 16px 18px; margin: 20px 0; }

/* ── Empty state ────────────────────────────────── */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 60px 20px; text-align: center; color: var(--muted); }
.empty-state .empty-icon { font-size: 3rem; opacity: 0.5; }
.empty-state h3 { color: var(--ink); }

/* ── Loader ─────────────────────────────────────── */
.loader { width: 32px; height: 32px; border: 3px solid var(--surface-3); border-top-color: var(--red); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-center { display: flex; align-items: center; justify-content: center; padding: 60px; }

/* ── Responsive ─────────────────────────────────── */
@media (max-width: 768px) {
  h1 { font-size: 1.4rem; }
  .btn-lg { padding: 12px 20px; font-size: 12px; }
}
