/* ═══════════════════════════════════════════════════════════════
   GEOLEJANDRÍA V2 - GEOTEMA Y2K BRUTALISTA
   Estética web primitiva, caótica y táctil
   ═══════════════════════════════════════════════════════════════ */

:root[data-theme="geotema"] {
  /* Colores base */
  --bg-primary: #ffffff;
  --bg-secondary: #c0c0c0;
  --bg-tertiary: #808080;
  --text-primary: #000000;
  --text-secondary: #000080;
  --border-color: #000000;
  --accent-yellow: #ffff00;
  --accent-red: #ff0000;
  --accent-blue: #0000ff;
  
  /* Cursor personalizado */
  --cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path d="M0,0 L0,13 L4,9 L7,16 L9,15 L6,8 L11,8 Z" fill="black"/></svg>'), auto;
}

* {
  box-sizing: border-box;
}

body[data-theme="geotema"] {
  margin: 0;
  padding: 0;
  font-family: 'Comic Sans MS', 'Comic Sans', cursive;
  background: var(--bg-primary);
  color: var(--text-primary);
  cursor: var(--cursor);
  overflow-x: hidden;
}

/* ═══════════════════════════════════════════════════════════════
   TIPOGRAFÍA Y2K
   ═══════════════════════════════════════════════════════════════ */

h1, h2, h3 {
  font-family: 'Comic Sans MS', 'Comic Sans', cursive;
  margin: 0;
  padding: 0;
}

.mono {
  font-family: 'Courier New', monospace;
}

/* ═══════════════════════════════════════════════════════════════
   SCROLLBARS BRUTALISTAS (Chess Pattern)
   ═══════════════════════════════════════════════════════════════ */

::-webkit-scrollbar {
  width: 16px;
  height: 16px;
}

::-webkit-scrollbar-track {
  background: repeating-conic-gradient(#c0c0c0 0% 25%, #808080 0% 50%) 50% / 8px 8px;
  border: 2px solid #000;
}

::-webkit-scrollbar-thumb {
  background: #c0c0c0;
  border: 2px solid #000;
  border-style: outset;
}

::-webkit-scrollbar-thumb:hover {
  background: #a0a0a0;
}

::-webkit-scrollbar-corner {
  background: #c0c0c0;
}

/* ═══════════════════════════════════════════════════════════════
   BOTONES ESTILO WINDOWS 95
   ═══════════════════════════════════════════════════════════════ */

.btn {
  font-family: 'Comic Sans MS', cursive;
  font-size: 14px;
  padding: 8px 20px;
  background: #c0c0c0;
  border: 3px solid;
  border-color: #ffffff #000000 #000000 #ffffff;
  border-style: outset;
  cursor: var(--cursor);
  font-weight: bold;
  transition: none;
}

.btn:active {
  border-color: #000000 #ffffff #ffffff #000000;
  border-style: inset;
  transform: translate(1px, 1px);
}

.btn:hover {
  background: #d0d0d0;
}

/* ═══════════════════════════════════════════════════════════════
   FORMULARIOS RETRO (CONSOLA)
   ═══════════════════════════════════════════════════════════════ */

.form-retro {
  background: #c0c0c0;
  border: 3px solid;
  border-color: #808080 #ffffff #ffffff #808080;
  border-style: inset;
  padding: 16px;
  margin: 12px 0;
}

.input-retro {
  font-family: 'Courier New', monospace;
  font-size: 13px;
  padding: 4px 8px;
  background: #ffffff;
  border: 2px solid;
  border-color: #808080 #ffffff #ffffff #808080;
  border-style: inset;
  width: 100%;
  margin: 4px 0;
}

.input-retro:focus {
  outline: 2px dotted #000;
  outline-offset: 2px;
}

label.retro-label {
  font-family: 'Comic Sans MS', cursive;
  font-weight: bold;
  display: block;
  margin: 8px 0 4px 0;
  color: var(--text-primary);
}

select.input-retro {
  cursor: var(--cursor);
  appearance: none;
  background: #ffffff url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="8"><path d="M0,0 L6,8 L12,0 Z" fill="black"/></svg>') no-repeat right 8px center;
  padding-right: 28px;
}

textarea.input-retro {
  resize: vertical;
  min-height: 80px;
}

/* ═══════════════════════════════════════════════════════════════
   VENTANAS FLOTANTES (PAPER-NOTE)
   ═══════════════════════════════════════════════════════════════ */

.paper-note {
  position: absolute;
  background: #ffffcc;
  border: 3px solid #000000;
  box-shadow: 8px 8px 0px #000000;
  padding: 16px;
  min-width: 280px;
  max-width: 400px;
  z-index: 1000;
  transform: rotate(-1deg);
  transition: transform 0.2s;
}

.paper-note:hover {
  transform: rotate(0deg);
  box-shadow: 10px 10px 0px #000000;
}

.paper-note::before {
  content: '';
  position: absolute;
  top: -8px;
  left: var(--tape-left, 20%);
  width: 60px;
  height: 20px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(0, 0, 0, 0.1);
  transform: rotate(var(--tape-rot, -5deg));
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.paper-note h3 {
  margin: 0 0 8px 0;
  font-size: 18px;
  border-bottom: 2px solid #000;
  padding-bottom: 4px;
}

.paper-note p {
  margin: 8px 0;
  font-size: 13px;
  line-height: 1.4;
  font-family: 'Courier New', monospace;
}

.paper-note-close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #ff0000;
  color: #fff;
  border: 2px solid #000;
  width: 24px;
  height: 24px;
  cursor: var(--cursor);
  font-weight: bold;
  font-size: 16px;
  line-height: 20px;
  text-align: center;
  padding: 0;
}

/* ═══════════════════════════════════════════════════════════════
   TOOLTIPS GLOSARIO
   ═══════════════════════════════════════════════════════════════ */

.glosario-term {
  cursor: help;
  text-decoration: underline dotted;
  position: relative;
}

.glosario-term:hover::after {
  content: attr(data-def);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #ffffcc;
  border: 2px solid #000;
  box-shadow: 4px 4px 0px #000;
  padding: 8px 12px;
  font-size: 12px;
  font-family: 'Courier New', monospace;
  white-space: nowrap;
  z-index: 2000;
  margin-bottom: 4px;
  max-width: 300px;
  white-space: normal;
}

/* ═══════════════════════════════════════════════════════════════
   SIDE WIDGET (Filtros de módulos)
   ═══════════════════════════════════════════════════════════════ */

.side-widget {
  position: fixed;
  right: 0;
  top: 60px;
  width: 220px;
  background: var(--text-secondary);
  border: 3px solid #000;
  border-right: none;
  padding: 12px;
  z-index: 900;
  box-shadow: -4px 4px 0px rgba(0, 0, 0, 0.3);
}

.side-widget h3 {
  color: #fff;
  font-size: 16px;
  margin: 0 0 12px 0;
  text-align: center;
  border-bottom: 2px solid #fff;
  padding-bottom: 4px;
}

.side-widget label {
  display: block;
  color: #fff;
  font-size: 13px;
  margin: 6px 0;
  cursor: var(--cursor);
  user-select: none;
}

.side-widget input[type="checkbox"] {
  margin-right: 6px;
  cursor: var(--cursor);
}

/* ═══════════════════════════════════════════════════════════════
   ENLACES Y2K
   ═══════════════════════════════════════════════════════════════ */

a {
  color: #0000ff;
  text-decoration: underline;
  background: transparent;
  transition: all 0.1s;
}

a:hover {
  background: #ffff00;
  color: #ff0000;
  font-weight: bold;
}

a:visited {
  color: #800080;
}

/* ═══════════════════════════════════════════════════════════════
   CRT OVERLAY (Efecto de monitor antiguo)
   ═══════════════════════════════════════════════════════════════ */

.crt-overlay {
  pointer-events: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    repeating-linear-gradient(
      0deg,
      rgba(0, 0, 0, 0.03),
      rgba(0, 0, 0, 0.03) 1px,
      transparent 1px,
      transparent 2px
    );
  z-index: 9999;
  animation: crt-flicker 3s infinite;
}

@keyframes crt-flicker {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.97; }
}

/* ═══════════════════════════════════════════════════════════════
   ANIMACIONES
   ═══════════════════════════════════════════════════════════════ */

@keyframes errorGlitch {
  0%, 100% { color: #000; }
  25% { color: #ff0000; transform: translate(-2px, 0); }
  50% { color: #000; transform: translate(2px, 0); }
  75% { color: #ff0000; transform: translate(-2px, 0); }
}

@keyframes glitch-shake {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  25% { transform: translate(-2px, 2px) rotate(-0.5deg); }
  50% { transform: translate(2px, -2px) rotate(0.5deg); }
  75% { transform: translate(-2px, -2px) rotate(-0.3deg); }
}

.error-text {
  animation: errorGlitch 0.5s infinite;
}

.shake {
  animation: glitch-shake 0.3s infinite;
}

/* ═══════════════════════════════════════════════════════════════
   GATEWAY MODAL (Aviso móvil)
   ═══════════════════════════════════════════════════════════════ */

.gateway-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #c0c0c0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.gateway-content {
  background: #ffffff;
  border: 4px solid #000;
  box-shadow: 8px 8px 0px #000;
  padding: 24px;
  max-width: 400px;
  text-align: center;
}

.gateway-content h2 {
  margin: 0 0 16px 0;
  font-size: 22px;
}

.gateway-content p {
  margin: 12px 0;
  font-size: 14px;
  line-height: 1.6;
}

/* ═══════════════════════════════════════════════════════════════
   NODOS DEL GRAFO
   ═══════════════════════════════════════════════════════════════ */

.node circle,
.node ellipse {
  stroke: #000;
  stroke-width: 3px;
  cursor: var(--cursor);
  transition: all 0.2s;
  image-rendering: pixelated;
}

.node:hover circle,
.node:hover ellipse {
  stroke-width: 5px;
  filter: drop-shadow(4px 4px 0px rgba(0, 0, 0, 0.5));
}

.node text {
  font-family: 'Comic Sans MS', cursive;
  font-size: 13px;
  font-weight: bold;
  pointer-events: none;
  text-anchor: middle;
  fill: #000;
}

/* Colores por módulo */
.node.minerales-esenciales circle,
.node.minerales-esenciales ellipse {
  fill: #ffcc00;
}

.node.carbonatos circle,
.node.carbonatos ellipse {
  fill: #66ccff;
}

.node.sulfuros circle,
.node.sulfuros ellipse {
  fill: #ff6666;
}

.node.silicatos circle,
.node.silicatos ellipse {
  fill: #99ff99;
}

.node.oxidos circle,
.node.oxidos ellipse {
  fill: #ff99cc;
}

/* Enlaces entre nodos */
.link {
  stroke: #666;
  stroke-width: 2px;
  fill: none;
}

.link.variedad-de {
  stroke: #000;
  stroke-width: 3px;
}

.link.polimorfo-de {
  stroke: #ff0000;
  stroke-width: 2px;
  stroke-dasharray: 5, 5;
}

.link.asociado-con {
  stroke: #0000ff;
  stroke-width: 2px;
  stroke-dasharray: 2, 2;
}

/* ═══════════════════════════════════════════════════════════════
   PANTALLA DE BLOQUEO / HEADER
   ═══════════════════════════════════════════════════════════════ */

.pantalla-bloqueo {
  background: var(--text-secondary);
  color: #fff;
  padding: 16px;
  border-bottom: 4px solid #000;
  text-align: center;
}

.pantalla-bloqueo h1 {
  margin: 0;
  font-size: 28px;
  text-shadow: 2px 2px 0px #000;
}

.pantalla-bloqueo p {
  margin: 4px 0 0 0;
  font-size: 13px;
  font-family: 'Courier New', monospace;
}

/* ═══════════════════════════════════════════════════════════════
   CONTAINER PRINCIPAL
   ═══════════════════════════════════════════════════════════════ */

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.container-consola {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
}

/* ═══════════════════════════════════════════════════════════════
   CONTROLES DEL GRAFO
   ═══════════════════════════════════════════════════════════════ */

.graph-controls {
  position: fixed;
  top: 80px;
  left: 20px;
  background: #c0c0c0;
  border: 3px solid #000;
  padding: 12px;
  z-index: 900;
  box-shadow: 4px 4px 0px rgba(0, 0, 0, 0.3);
}

.graph-controls button {
  display: block;
  width: 100%;
  margin: 4px 0;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE (MÓVIL)
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  .crt-overlay {
    display: none;
  }
  
  .side-widget {
    display: none;
  }
  
  .graph-controls {
    position: static;
    width: 100%;
    margin: 12px 0;
  }
  
  .paper-note {
    position: fixed !important;
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%) rotate(0deg) !important;
    max-width: 90vw;
  }
  
  body {
    font-size: 14px;
  }
}

/* ═══════════════════════════════════════════════════════════════
   IMAGEN PIXELADA
   ═══════════════════════════════════════════════════════════════ */

img.pixel-art,
.pixel-art {
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
}

/* ═══════════════════════════════════════════════════════════════
   UTILIDADES
   ═══════════════════════════════════════════════════════════════ */

.text-center {
  text-align: center;
}

.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; }

.hidden {
  display: none !important;
}
