/* =========================================================================
   Automatización BASE FINAL - hoja de estilos
   Paleta tipo terminal (Dracula) para el registro de ejecución.
   ========================================================================= */

:root {
  --bg: #12141c;
  --bg-soft: #1a1d29;
  --panel: #1e2130;
  --panel-2: #252a3b;
  --border: #333850;
  --text: #e6e8f0;
  --text-dim: #98a0bd;

  --console-bg: #1e1e1e;
  --console-text: #dcdcdc;
  --c-alerta: #ffb86c;
  --c-error: #ff5555;
  --c-exito: #50fa7b;
  --c-fase: #8be9fd;
  --c-info: #dcdcdc;

  --accent: #6c8cff;
  --accent-2: #4f6fe0;
  --radius: 12px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background: radial-gradient(1200px 600px at 15% -10%, #1c2340 0%, var(--bg) 55%) fixed;
  color: var(--text);
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
}

/* ---------------------------------------------------------------- topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 26px;
  border-bottom: 1px solid var(--border);
  background: rgba(20, 23, 34, .8);
  backdrop-filter: blur(6px);
  flex-wrap: wrap;
}

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

.logo {
  font-size: 28px;
  color: var(--accent);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 48px; height: 48px;
  display: grid; place-items: center;
}

.topbar h1 { margin: 0; font-size: 19px; letter-spacing: .2px; }
.topbar p { margin: 2px 0 0; font-size: 13px; color: var(--text-dim); }

.session-chip {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-family: ui-monospace, Consolas, monospace;
  color: var(--text-dim);
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 7px 12px;
  border-radius: 999px;
}

.session-chip .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--c-exito);
  box-shadow: 0 0 8px var(--c-exito);
}

/* ---------------------------------------------------------------- layout */
.layout {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(340px, 460px) 1fr;
  gap: 20px;
  padding: 20px 26px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.console-panel {
  display: flex;
  flex-direction: column;
  min-height: 640px;
  position: sticky;
  top: 20px;
}

.panel-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 14px; text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--text-dim);
  margin: 0 0 14px;
}

.panel-title.no-margin { margin: 0; }
.panel-title.mt { margin-top: 26px; }

.step {
  width: 22px; height: 22px; border-radius: 6px;
  background: var(--accent); color: #0d1020;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700;
}

/* ------------------------------------------------------------ dropzones */
.dropzones { display: grid; gap: 10px; }

.dropzone {
  position: relative;
  border: 1.5px dashed var(--border);
  border-radius: 10px;
  background: var(--bg-soft);
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .08s;
  display: flex; align-items: center; gap: 12px;
}

.dropzone:hover { border-color: var(--accent); background: var(--panel-2); }
.dropzone.dragover { border-color: var(--c-fase); background: #22314a; transform: scale(1.01); }
.dropzone.filled { border-style: solid; border-color: var(--c-exito); }
.dropzone input[type=file] { display: none; }

.dz-icon {
  width: 34px; height: 34px; flex: 0 0 34px;
  border-radius: 8px;
  background: var(--panel-2);
  display: grid; place-items: center;
  font-size: 15px; color: var(--accent);
}

.dropzone.filled .dz-icon { color: var(--c-exito); }

.dz-body { min-width: 0; flex: 1; }
.dz-title { font-size: 13.5px; font-weight: 600; }
.dz-hint {
  font-size: 12px; color: var(--text-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dropzone.filled .dz-hint { color: var(--c-exito); }
.dz-opt { font-size: 10px; color: var(--text-dim); border: 1px solid var(--border); padding: 1px 6px; border-radius: 999px; }

.template-note {
  margin: 12px 0 14px;
  font-size: 12.5px;
  color: var(--text-dim);
  padding: 10px 12px;
  border-left: 3px solid var(--accent);
  background: var(--bg-soft);
  border-radius: 0 8px 8px 0;
  display: none;
}
.template-note.show { display: block; }

/* --------------------------------------------------------------- botones */
.btn {
  font: inherit;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .06s, opacity .15s;
}

.btn:hover:not(:disabled) { border-color: var(--accent); background: #2c3350; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .42; cursor: not-allowed; }

.btn-block { width: 100%; }
.btn-secondary { margin-top: 14px; font-weight: 600; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #0c1024;
  font-weight: 700;
  letter-spacing: .4px;
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); background: linear-gradient(135deg, var(--accent), var(--accent-2)); }

.btn-run { margin-top: 14px; padding: 15px; font-size: 15px; }

.fase-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.btn-fase {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 12px 14px; text-align: left;
}
.fase-num { font-weight: 700; font-size: 13px; color: var(--c-fase); letter-spacing: .5px; }
.fase-desc { font-size: 11.5px; color: var(--text-dim); }

.btn-fase.done { border-color: var(--c-exito); }
.btn-fase.done .fase-num::after { content: " ✓"; color: var(--c-exito); }
.btn-fase.failed { border-color: var(--c-error); }
.btn-fase.busy { border-color: var(--c-alerta); }

.btn-download { background: #21402e; border-color: #2f6a45; color: var(--c-exito); font-weight: 600; }
.btn-download:hover:not(:disabled) { background: #2a5139; border-color: var(--c-exito); }
.btn-ghost { background: transparent; font-size: 13px; padding: 8px 12px; }

/* -------------------------------------------------------------- progreso */
.progress-wrap { display: flex; align-items: center; gap: 12px; margin-top: 16px; }

.progress {
  flex: 1; height: 9px; border-radius: 999px;
  background: var(--bg-soft); border: 1px solid var(--border);
  overflow: hidden;
}

.progress-bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--c-fase), var(--c-exito));
  transition: width .35s ease;
}

.progress-label { font-size: 12px; color: var(--text-dim); font-variant-numeric: tabular-nums; min-width: 38px; text-align: right; }

/* --------------------------------------------------------------- consola */
.console-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 12px; flex-wrap: wrap;
}

.counters { display: flex; gap: 8px; }

.badge {
  font-size: 11.5px; padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--bg-soft); color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.badge-warn.active { color: var(--c-alerta); border-color: var(--c-alerta); }
.badge-error.active { color: var(--c-error); border-color: var(--c-error); }

.console {
  flex: 1;
  min-height: 380px;
  max-height: calc(100vh - 300px);
  overflow-y: auto;
  overflow-x: auto;
  background: var(--console-bg);
  color: var(--console-text);
  border: 1px solid #000;
  border-radius: 10px;
  padding: 14px 16px;
  font-family: ui-monospace, "Cascadia Mono", Consolas, "Courier New", monospace;
  font-size: 12.7px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.console::-webkit-scrollbar { width: 10px; height: 10px; }
.console::-webkit-scrollbar-track { background: #161616; }
.console::-webkit-scrollbar-thumb { background: #3a3a3a; border-radius: 6px; }
.console::-webkit-scrollbar-thumb:hover { background: #4d4d4d; }

.line { display: block; }
.line .ts { color: #6a6a6a; margin-right: 8px; }
.line-info { color: var(--c-info); }
.line-alerta { color: var(--c-alerta); }
.line-error { color: var(--c-error); font-weight: 600; }
.line-exito { color: var(--c-exito); }
.line-fase { color: var(--c-fase); font-weight: 600; }

.console-empty { color: #6a6a6a; font-style: italic; }

/* -------------------------------------------------------------- acciones */
.actions {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border);
}

.alert-downloads { display: flex; gap: 6px; flex-wrap: wrap; }
.actions #btnLimpiar { margin-left: auto; }

/* --------------------------------------------------------------- footer */
.footer {
  padding: 14px 26px 22px;
  color: var(--text-dim);
  font-size: 12px;
  text-align: center;
}

/* --------------------------------------------------------------- toasts */
.toast-stack {
  position: fixed; right: 20px; bottom: 20px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 50;
}

.toast {
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  padding: 12px 16px;
  box-shadow: var(--shadow);
  font-size: 13.5px;
  max-width: 380px;
  animation: slide-in .2s ease;
}

.toast.ok { border-left-color: var(--c-exito); }
.toast.warn { border-left-color: var(--c-alerta); }
.toast.err { border-left-color: var(--c-error); }

@keyframes slide-in {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: none; }
}

/* ------------------------------------------------------------ responsive */
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .console-panel { position: static; min-height: 0; }
  .console { max-height: 55vh; }
}

@media (max-width: 560px) {
  .topbar { padding: 14px 16px; }
  .layout { padding: 14px 16px; gap: 14px; }
  .fase-grid { grid-template-columns: 1fr; }
  .actions #btnLimpiar { margin-left: 0; }
}
