/* ════════════════════════════════════════════════════════════════
   PALETA (idéntica al GUI de escritorio)
   ═══════════════════════════════════════════════════════════════ */
:root {
  --bg:         #1e1e2e;
  --fg:         #cdd6f4;
  --accent:     #89b4fa;
  --accent-hov: #b4befe;
  --surface:    #313244;
  --surface-lt: #45475a;
  --surface-dk: #181825;
  --muted:      #6c7086;
  --red:        #f38ba8;
  --green:      #a6e3a1;
  --yellow:     #f9e2af;
  --ink:        #11111b;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }

/* ════════════════════════════════════════════════════════════════
   LAYOUT
   ═══════════════════════════════════════════════════════════════ */
.container { max-width: 900px; margin: 0 auto; padding: 24px 20px 60px; }

header.header {
  background: var(--bg);
  padding: 24px 20px 12px;
  border-bottom: 1px solid var(--surface-lt);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.header .title {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.3px;
}

.header .subtitle {
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
}

.btn-icon {
  background: var(--surface-lt);
  color: var(--fg);
  border: none;
  border-radius: 6px;
  width: 40px;
  height: 40px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}
.btn-icon:hover { background: var(--accent); color: var(--bg); }
.btn-icon.small { width: 32px; height: 32px; font-size: 14px; padding: 0; }

/* ════════════════════════════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════════════════════════ */
.card {
  background: var(--surface);
  border-radius: 10px;
  padding: 18px 20px;
  margin: 16px 0;
  border: 1px solid var(--surface-lt);
}

.card-label {
  font-weight: 700;
  font-size: 14px;
  color: var(--fg);
  margin-bottom: 10px;
}

.card-hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
}

.process-steps {
  font-size: 13px;
  color: var(--muted);
  font-family: "Consolas", "Courier New", monospace;
  letter-spacing: 0.2px;
}

/* ════════════════════════════════════════════════════════════════
   FILE INPUT
   ═══════════════════════════════════════════════════════════════ */
.file-row {
  display: flex;
  gap: 10px;
  align-items: center;
  background: var(--surface-dk);
  border: 1px solid var(--surface-lt);
  border-radius: 8px;
  padding: 10px 12px;
}

.file-row input[type="file"] {
  color: var(--fg);
  font-size: 13px;
  cursor: pointer;
}

.file-info {
  flex: 1;
  font-size: 13px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ════════════════════════════════════════════════════════════════
   PROGRESS
   ═══════════════════════════════════════════════════════════════ */
.progress-wrap {
  width: 100%;
  height: 14px;
  background: var(--surface-dk);
  border-radius: 7px;
  overflow: hidden;
  margin-bottom: 6px;
}

progress {
  width: 100%;
  height: 100%;
  border: none;
  appearance: none;
  background: var(--surface-dk);
  color: var(--accent);
}
progress::-webkit-progress-bar { background: var(--surface-dk); border-radius: 7px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 7px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 7px; }

.status-text {
  font-size: 13px;
  color: var(--muted);
}

/* ════════════════════════════════════════════════════════════════
   BOTONES
   ═══════════════════════════════════════════════════════════════ */
.btn-process {
  width: 100%;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 8px;
  padding: 14px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}
.btn-process:hover:not(:disabled) { background: var(--accent-hov); }
.btn-process:disabled {
  background: var(--surface-lt);
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.7;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 6px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.btn-primary:hover { background: var(--accent-hov); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-secondary {
  background: var(--surface-lt);
  color: var(--fg);
  border: none;
  border-radius: 6px;
  padding: 10px 18px;
  font-size: 14px;
  cursor: pointer;
}
.btn-secondary:hover { background: var(--surface); }

/* ════════════════════════════════════════════════════════════════
   LOGS
   ═══════════════════════════════════════════════════════════════ */
.log-card { background: var(--ink); }

.log-card .card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.log-card .card-title {
  font-weight: 700;
  font-size: 13px;
  color: var(--fg);
}

#logConsole {
  width: 100%;
  height: 260px;
  background: var(--ink);
  color: var(--fg);
  font-family: "Consolas", "Courier New", monospace;
  font-size: 12px;
  line-height: 1.5;
  padding: 10px;
  border: 1px solid var(--surface-lt);
  border-radius: 8px;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-y: auto;
  resize: vertical;
}

.log-alerta { color: var(--red); }
.log-ok { color: var(--green); }

/* ════════════════════════════════════════════════════════════════
   MODALES
   ═══════════════════════════════════════════════════════════════ */
.modal { display: none; position: fixed; inset: 0; z-index: 100; }
.modal.show { display: flex; align-items: center; justify-content: center; }

.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(2px);
}

.modal-content {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--surface-lt);
  border-radius: 12px;
  width: 92%;
  max-width: 860px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(0,0,0,0.4);
}

.modal-content.narrow { max-width: 520px; }

.modal-header {
  padding: 20px 24px 10px;
  border-bottom: 1px solid var(--surface-lt);
  display: flex;
  align-items: center;
  gap: 10px;
}
.modal-header h2 { font-size: 18px; font-weight: 700; color: var(--accent); }

.modal-body {
  padding: 16px 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-hint {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 16px;
}

.modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--surface-lt);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ════════════════════════════════════════════════════════════════
   FILAS DE MATERIAL (config)
   ═══════════════════════════════════════════════════════════════ */
.material-row {
  background: var(--surface);
  border: 1px solid var(--surface-lt);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 10px;
}

.material-row .row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.material-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--accent);
}

.btn-delete-mat {
  background: transparent;
  color: var(--red);
  border: none;
  font-size: 12px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}
.btn-delete-mat:hover { background: var(--red); color: #fff; }

.chips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.chip {
  background: var(--surface-lt);
  color: var(--fg);
  border-radius: 12px;
  padding: 2px 10px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.chip .chip-remove {
  color: var(--red);
  cursor: pointer;
  font-weight: 700;
  line-height: 1;
}
.chip .chip-remove:hover { color: #fff; }

.row-add {
  display: flex;
  gap: 8px;
}
.row-add input {
  flex: 1;
  background: var(--surface-lt);
  color: var(--fg);
  border: none;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
}
.row-add input::placeholder { color: var(--muted); }
.row-add .btn-add-chip {
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.row-add .btn-add-chip:hover { background: var(--accent-hov); }

.row-sep {
  height: 1px;
  background: var(--surface-lt);
  margin: 10px 0;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.scroll-area {
  border: 1px solid var(--surface-lt);
  border-radius: 8px;
  max-height: 340px;
  overflow-y: auto;
  background: var(--surface-dk);
}

.field-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 6px;
}
.field-hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

/* utilidad */
.hidden { display: none !important; }
