/* ==========================================================================
   BLACKCAT UI v1.0.0 - design system canonico de THE BLACKCAT Studios
   Fuente de verdad: portal/design/blackcat-ui.css
   Cada Studio lleva una COPIA en su static/ (vendoreada); al actualizar esta
   version, re-copiar a los studios (ver docs/runbooks/add-a-studio.md).

   Direccion aprobada (2026-07-06): dark cinematic total, magenta como acento
   quirurgico, tipografia liviana (Rubik 500 titulos, 400 uppercase chico;
   el unico 700 es el h1 del portal).
   ========================================================================== */

:root {
  color-scheme: dark;

  /* Marca (brand-profile.json de THE BLACKCAT Media) */
  --bc-magenta: #d90467;
  --bc-magenta-soft: rgba(217, 4, 103, 0.14);
  --bc-magenta-line: rgba(217, 4, 103, 0.4);
  --bc-gray: #6d6162;
  --bc-warm-white: #f7f5f5;
  --bc-near-black: #1a1718;

  /* Superficies */
  --bc-shell: #141213;
  --bc-panel: #242021;
  --bc-panel-2: #2e2829;
  --bc-border: rgba(247, 245, 245, 0.11);
  --bc-muted: #b7adaf;

  /* Estados */
  --bc-ok: #4ecf8d;
  --bc-warn: #f3b95c;
  --bc-fail: #ff7a6b;

  --radius: 8px;
  --font-head: Rubik, Arial, sans-serif;
  --font-body: "Myriad Pro", "Open Sans", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bc-near-black);
  color: var(--bc-warm-white);
  font-family: var(--font-body);
}

h1, h2, h3, h4 { font-family: var(--font-head); margin: 0; font-weight: 500; }

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a, button, select, input { touch-action: manipulation; }

a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(217, 4, 103, 0.45);
  outline-offset: 2px;
}

/* --- Tipos utilitarios ---------------------------------------------------- */

.kicker {
  font-family: var(--font-head);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 500;
  color: var(--bc-magenta);
}

.muted { color: var(--bc-muted); }

/* --- Shell de Studio (sidebar + area de trabajo) -------------------------- */

.studio-app {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  background: var(--bc-shell);
  border-right: 1px solid var(--bc-border);
  padding: 22px 16px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 26px;
}

.sb-brand {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.sb-brand img { width: 42px; height: 42px; border-radius: var(--radius); }

.sb-brand-name {
  font-family: var(--font-head);
  font-weight: 500;
  font-size: 12px;
  line-height: 1.18;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--bc-warm-white);
}

.sb-brand-name span { color: var(--bc-magenta); }

.nav { display: grid; align-content: start; gap: 8px; }

.nav a, .nav button {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--bc-muted);
  text-decoration: none;
  text-align: left;
  font-size: 14.5px;
}

.nav a.active, .nav button.active {
  color: var(--bc-warm-white);
  border-color: var(--bc-magenta-line);
  background: var(--bc-magenta-soft);
}

.nav a:hover, .nav button:hover {
  color: var(--bc-warm-white);
  background: rgba(247, 245, 245, 0.05);
}

.back-portal {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--bc-border);
  border-radius: var(--radius);
  color: var(--bc-muted);
  text-decoration: none;
  font-size: 13px;
}

.back-portal:hover { color: var(--bc-magenta); border-color: var(--bc-magenta-line); }

.studio-main {
  padding: 30px 34px 48px;
  display: grid;
  align-content: start;
  gap: 22px;
}

.studio-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--bc-border);
  padding-bottom: 18px;
}

.studio-head h2 { font-size: 30px; }
.studio-head p { margin: 6px 0 0; color: var(--bc-muted); font-size: 15px; }

/* --- Paneles y formularios ------------------------------------------------ */

.panel {
  border: 1px solid var(--bc-border);
  border-radius: var(--radius);
  background: var(--bc-panel);
  padding: 18px;
  display: grid;
  gap: 14px;
  align-content: start;
}

.panel h3 { font-size: 16px; }

.field { display: grid; gap: 6px; }

.field label {
  font-family: var(--font-head);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--bc-muted);
}

.field select, .field input, .field textarea {
  min-height: 42px;
  border: 1px solid var(--bc-border);
  border-radius: var(--radius);
  background: var(--bc-panel-2);
  color: var(--bc-warm-white);
  padding: 8px 12px;
}

.dropzone {
  min-height: 150px;
  border: 1.5px dashed var(--bc-magenta-line);
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  gap: 6px;
  text-align: center;
  color: var(--bc-muted);
  background: rgba(217, 4, 103, 0.04);
  padding: 18px;
}

.dropzone strong { color: var(--bc-warm-white); font-family: var(--font-head); font-weight: 500; }

/* --- Botones --------------------------------------------------------------- */

.btn-primary {
  min-height: 46px;
  border: 0;
  border-radius: var(--radius);
  background: var(--bc-magenta);
  color: #fff;
  font-family: var(--font-head);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0 18px;
  box-shadow: 0 14px 30px rgba(217, 4, 103, 0.28);
}

.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }

.btn-secondary {
  min-height: 42px;
  border: 1px solid var(--bc-magenta-line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--bc-magenta);
  font-weight: 600;
  font-size: 13px;
  padding: 0 14px;
  text-decoration: none;
  display: inline-grid;
  place-items: center;
}

.btn-secondary:hover { background: var(--bc-magenta-soft); }

/* --- Badges, chips y estado ------------------------------------------------ */

.badge {
  font-family: var(--font-head);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 999px;
}

.badge.ok { color: var(--bc-ok); background: rgba(78, 207, 141, 0.12); }
.badge.warn { color: var(--bc-warn); background: rgba(243, 185, 92, 0.12); }
.badge.fail { color: var(--bc-fail); background: rgba(255, 122, 107, 0.12); }
.badge.run { color: var(--bc-magenta); background: var(--bc-magenta-soft); }

.chip {
  display: inline-grid;
  place-items: center;
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid var(--bc-magenta-line);
  border-radius: 999px;
  font-family: var(--font-head);
  font-size: 10.5px;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-head);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--bc-ok);
}

.status-dot::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.status-dot.off { color: var(--bc-muted); }
.status-dot.fail { color: var(--bc-fail); }

/* --- Progreso y logs -------------------------------------------------------- */

.progress {
  height: 8px;
  border-radius: 999px;
  background: var(--bc-panel-2);
  overflow: hidden;
}

.progress > span {
  display: block;
  height: 100%;
  background: var(--bc-magenta);
  border-radius: 999px;
}

.log-box {
  background: var(--bc-shell);
  border: 1px solid var(--bc-border);
  border-radius: var(--radius);
  padding: 12px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  line-height: 1.55;
  color: var(--bc-muted);
  max-height: 260px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* --- Listas de archivos/jobs ------------------------------------------------ */

.job {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  align-items: center;
  border: 1px solid var(--bc-border);
  border-radius: var(--radius);
  background: var(--bc-panel-2);
  padding: 12px 14px;
}

.job strong { font-size: 14px; font-weight: 600; }
.job small { grid-column: 1; color: var(--bc-muted); font-size: 12.5px; }

/* --- Responsive -------------------------------------------------------------- */

@media (max-width: 900px) {
  .studio-app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; grid-template-rows: auto; }
  .studio-main { padding: 22px 18px 40px; }
  .studio-head { flex-direction: column; align-items: start; }
}
