/* =====================================================================================
   ETL Dalmata — panel de operaciones de datos.

   Identidad: consola de control de datos, no un dashboard SaaS generico. Fondo
   grafito oscuro, acento ambar (lectura de instrumentos / puntos de datos —
   guiño a "Dalmata"), azul frio reservado para lo que el propio sistema marca
   en azul dentro del Excel (la sustitucion de Origen_Areas), para que el color
   tenga significado dentro de la propia herramienta.
   ===================================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  --bg: #14171c;
  --bg-raised: #1b1f26;
  --bg-inset: #0f1216;
  --line: #2a2f38;
  --line-soft: #23272f;
  --text: #e8eaed;
  --text-dim: #9aa1ac;
  --text-faint: #5c6470;

  --amber: #e8a33d;
  --amber-dim: #6b5327;
  --blue: #5aa9e6;
  --green: #6fbf8b;
  --red: #e07160;

  --radius: 10px;
  --font-ui: 'Manrope', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  padding: 40px 20px 80px;
  background-image:
    radial-gradient(circle at 15% -10%, rgba(232, 163, 61, 0.08), transparent 45%),
    radial-gradient(circle at 100% 0%, rgba(90, 169, 230, 0.06), transparent 40%);
}

.panel {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* ---------- header ---------- */

.panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.panel__brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.panel__mark {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--bg);
  background: var(--amber);
  padding: 5px 9px;
  border-radius: 6px;
  font-weight: 600;
}

.panel__brand h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.panel__subtitle {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--text-dim);
}

.panel__status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-dim);
  background: var(--bg-raised);
  border: 1px solid var(--line);
  padding: 8px 14px;
  border-radius: 100px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot--pending { background: var(--text-faint); }
.dot--ok { background: var(--green); box-shadow: 0 0 8px rgba(111, 191, 139, 0.6); }
.dot--warn { background: var(--amber); box-shadow: 0 0 8px rgba(232, 163, 61, 0.6); }
.dot--error { background: var(--red); box-shadow: 0 0 8px rgba(224, 113, 96, 0.6); }
.dot--busy { background: var(--blue); animation: pulse 1.1s ease-in-out infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

/* ---------- secciones genericas ---------- */

section {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
}

section h2 {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 700;
}

/* ---------- plantilla maestra ---------- */

.maestra {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.maestra__info p {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-dim);
  max-width: 56ch;
  line-height: 1.5;
}

.maestra__replace {
  font-size: 13px;
  color: var(--amber);
  border: 1px solid var(--amber-dim);
  padding: 9px 14px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.maestra__replace:hover {
  background: rgba(232, 163, 61, 0.08);
  border-color: var(--amber);
}

/* ---------- fuentes / dropzones ---------- */

.fuentes__hint {
  margin: 4px 0 18px;
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.5;
  max-width: 70ch;
}

.dropzones {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

@media (max-width: 720px) {
  .dropzones { grid-template-columns: 1fr; }
}

.dropzone {
  position: relative;
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  background: var(--bg-inset);
  padding: 20px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.dropzone:hover { border-color: var(--text-faint); }
.dropzone.is-dragover { border-color: var(--amber); background: rgba(232, 163, 61, 0.06); }
.dropzone.is-filled { border-style: solid; border-color: var(--green); background: rgba(111, 191, 139, 0.06); }

.dropzone__icon {
  font-family: var(--font-mono);
  font-size: 20px;
  color: var(--text-faint);
  margin-bottom: 8px;
}
.dropzone.is-filled .dropzone__icon { color: var(--green); }

.dropzone h3 {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 700;
}

.dropzone__desc {
  margin: 0 0 10px;
  font-size: 11.5px;
  color: var(--text-dim);
  line-height: 1.4;
  min-height: 30px;
}

.dropzone__file {
  margin: 0;
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-faint);
  word-break: break-all;
}
.dropzone.is-filled .dropzone__file { color: var(--green); }

.dropzone__clear {
  margin-top: 10px;
  font-size: 11px;
  color: var(--red);
  background: none;
  border: 1px solid transparent;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}
.dropzone__clear:hover { border-color: var(--red); }

.fuentes__accion {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.fuentes__accion-hint {
  font-size: 12.5px;
  color: var(--text-faint);
}

/* ---------- botones ---------- */

.boton {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 700;
  padding: 12px 22px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.1s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}
.boton:active { transform: scale(0.98); }

.boton--primario {
  background: var(--amber);
  color: #17130a;
}
.boton--primario:hover:not(:disabled) { box-shadow: 0 0 0 3px rgba(232, 163, 61, 0.25); }
.boton--primario:disabled { opacity: 0.4; cursor: not-allowed; }

.boton--descarga {
  background: var(--green);
  color: #0d1a12;
  margin-left: auto;
}
.boton--descarga:hover { box-shadow: 0 0 0 3px rgba(111, 191, 139, 0.25); }

/* ---------- consola ---------- */

.consola {
  padding: 0;
  overflow: hidden;
}

.consola__barra {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.consola__barra h2 { margin: 0; }

.consola__estado {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.consola__cuerpo {
  margin: 0;
  padding: 18px 20px;
  background: var(--bg-inset);
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.65;
  color: #c7ccd4;
  height: 340px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.consola__linea { display: block; }
.consola__linea--muted { color: var(--text-faint); }
.consola__linea--warn { color: var(--amber); }
.consola__linea--error { color: var(--red); }
.consola__linea--ok { color: var(--green); }

.consola__cuerpo::-webkit-scrollbar { width: 10px; }
.consola__cuerpo::-webkit-scrollbar-track { background: transparent; }
.consola__cuerpo::-webkit-scrollbar-thumb { background: var(--line); border-radius: 6px; }

/* ---------- resultado ---------- */

.resultado {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.resultado__icono {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(111, 191, 139, 0.15);
  color: var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.resultado.is-error .resultado__icono {
  background: rgba(224, 113, 96, 0.15);
  color: var(--red);
}

.resultado__texto { flex: 1; min-width: 220px; }
.resultado__texto h2 { margin: 0 0 4px; }
.resultado__texto p { margin: 0; font-size: 13px; color: var(--text-dim); line-height: 1.5; }
