/* ═══════════════════════════════════════════════════════════════
   AI-Video · Design System v2 — "Bloom"
   Estética: superficies blancas y rosa pálido, degradados suaves,
   botones pill rosa/magenta, tarjetas muy redondeadas, tipografía
   redondeada y amable. Inspirado en el lenguaje visual de Fliki.
   ═══════════════════════════════════════════════════════════════ */

:root {
  /* Superficies */
  --paper: #fdfbfc;              /* fondo app: blanco cálido */
  --paper-raised: #ffffff;       /* tarjetas */
  --paper-sunken: #f7f2f5;       /* zonas hundidas / inputs */
  --pink-wash: #fdf0f5;          /* lavado rosa pálido */
  --pink-wash-2: #fbe4ee;        /* lavado rosa medio */

  /* Tinta */
  --ink: #1f1723;                /* texto principal */
  --ink-2: #4b3f52;              /* texto secundario */
  --ink-3: #8a7b91;              /* texto terciario */
  --ink-4: #b5a8bb;              /* texto sutil */

  /* Marca — rosa/magenta Fliki */
  --accent: #e0286f;
  --accent-2: #f0568f;
  --accent-deep: #b81657;
  --accent-soft: #fce7f0;
  --grad-brand: linear-gradient(96deg, #f0568f 0%, #e0286f 55%, #c9186a 100%);
  --grad-hero: linear-gradient(180deg, #fff5f9 0%, #fdfbfc 70%);

  /* Semáforo */
  --signal: #e8930c;             /* aviso */
  --signal-soft: #fdf3e3;
  --ok: #17a673;
  --ok-soft: #e5f7f0;
  --danger: #d93636;
  --danger-soft: #fdecec;

  /* Estructura */
  --line: #f0e6ec;
  --line-strong: #e4d5de;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 3px rgba(31, 23, 35, .05);
  --shadow-md: 0 6px 24px rgba(224, 40, 111, .08), 0 2px 6px rgba(31, 23, 35, .04);
  --shadow-lg: 0 18px 48px rgba(224, 40, 111, .13), 0 4px 12px rgba(31, 23, 35, .06);

  --font-ui: 'Nunito', 'Inter', system-ui, sans-serif;
  --font-display: 'Nunito', 'Inter', system-ui, sans-serif;
  --font-mono: 'Spline Sans Mono', ui-monospace, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body {
  font-family: var(--font-ui);
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }

/* ── Tipografía ─────────────────────────────── */
h1, h2, h3 { font-family: var(--font-display); font-weight: 800; letter-spacing: -0.015em; }
.display-xl { font-size: 42px; line-height: 1.08; font-weight: 800; }
.display-lg { font-size: 30px; line-height: 1.15; font-weight: 800; }
.display-md { font-size: 21px; line-height: 1.25; font-weight: 800; }
.eyebrow {
  font-family: var(--font-ui); font-size: 10.5px; font-weight: 800;
  letter-spacing: .14em; text-transform: uppercase; color: var(--ink-4);
}
.mono { font-family: var(--font-mono); font-size: 12px; }
.muted { color: var(--ink-3); }
.small { font-size: 12px; }

/* ── Layout base ────────────────────────────── */
.app-frame { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }

.sidebar {
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 18px 12px 16px;
  display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-display); font-weight: 900; font-size: 17px;
  letter-spacing: -0.01em; padding: 4px 10px 16px;
}
.brand .dot {
  width: 26px; height: 26px; border-radius: 9px;
  background: var(--grad-brand); align-self: center; flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(224, 40, 111, .35);
  position: relative;
}
.brand .dot::after {
  content: '▶'; position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 10px;
}
.brand .tag { font-family: var(--font-mono); font-size: 9.5px; color: var(--ink-4); letter-spacing: .08em; font-weight: 400; }

.nav-group { display: flex; flex-direction: column; gap: 1px; margin-top: 14px; }
.nav-group > .eyebrow { padding: 0 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 700; color: var(--ink-2);
  text-align: left; width: 100%; transition: background .12s, color .12s;
}
.nav-item i { width: 17px; text-align: center; font-size: 13px; color: var(--ink-4); transition: color .12s; }
.nav-item:hover { background: var(--pink-wash); color: var(--ink); }
.nav-item:hover i { color: var(--accent); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-deep); }
.nav-item.active i { color: var(--accent); }
.nav-item .badge {
  margin-left: auto; font-size: 9.5px; font-weight: 800; letter-spacing: .05em;
  background: var(--grad-brand); color: #fff; padding: 2px 8px; border-radius: var(--radius-pill);
}
.sidebar-footer {
  margin-top: auto; padding: 14px 12px 6px; border-top: 1px solid var(--line);
  background: var(--pink-wash); border-radius: var(--radius); margin-left: -2px; margin-right: -2px;
  padding: 14px;
}
.credit-meter { font-size: 12px; color: var(--ink-3); font-weight: 600; }
.credit-meter b { color: var(--accent-deep); font-weight: 800; }
.meter-bar { height: 6px; background: #fff; border-radius: var(--radius-pill); margin-top: 8px; overflow: hidden; }
.meter-bar > div { height: 100%; background: var(--grad-brand); border-radius: var(--radius-pill); }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 28px; border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.85); backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 20;
}
.topbar .crumb { font-size: 13px; color: var(--ink-3); font-weight: 600; }
.topbar .crumb b { color: var(--ink); font-weight: 800; }
.mode-switch {
  margin-left: auto; display: flex; background: var(--paper-sunken);
  border-radius: var(--radius-pill); padding: 3px; gap: 2px;
}
.mode-switch button {
  padding: 5px 16px; border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 800; color: var(--ink-3); transition: all .15s;
}
.mode-switch button.on { background: #fff; color: var(--accent-deep); box-shadow: var(--shadow-sm); }

.content { padding: 26px 32px 80px; max-width: 1180px; width: 100%; margin: 0 auto; }

/* ── Tarjetas ───────────────────────────────── */
.card {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: box-shadow .18s, transform .18s, border-color .18s;
}
.card-pad { padding: 20px; }
.card-header { padding: 14px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.card:hover { box-shadow: var(--shadow-md); border-color: var(--line-strong); }

/* ── Botones ────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 22px; border-radius: var(--radius-pill);
  font-size: 13.5px; font-weight: 800; letter-spacing: .01em;
  transition: all .15s; white-space: nowrap;
}
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: #38293f; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-accent { background: var(--grad-brand); color: #fff; box-shadow: 0 4px 14px rgba(224, 40, 111, .3); }
.btn-accent:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(224, 40, 111, .4); filter: brightness(1.05); }
.btn-ghost { background: #fff; border: 1.5px solid var(--line-strong); color: var(--ink-2); }
.btn-ghost:hover { border-color: var(--accent-2); color: var(--accent-deep); background: var(--pink-wash); }
.btn-sm { padding: 7px 15px; font-size: 12.5px; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none !important; }

/* ── Chips ──────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 12px; border-radius: var(--radius-pill);
  font-size: 11px; font-weight: 800; letter-spacing: .02em;
  background: var(--paper-sunken); color: var(--ink-2);
}
.chip.accent { background: var(--accent-soft); color: var(--accent-deep); }
.chip.signal { background: var(--signal-soft); color: #a36505; }
.chip.danger { background: var(--danger-soft); color: var(--danger); }
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ── Formularios ────────────────────────────── */
.input, textarea.input {
  width: 100%; padding: 11px 16px;
  background: #fff; border: 1.5px solid var(--line-strong);
  border-radius: 12px; font-family: inherit; font-size: 14px; color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { outline: none; border-color: var(--accent-2); box-shadow: 0 0 0 4px rgba(224, 40, 111, .1); }
.input::placeholder { color: var(--ink-4); }
.field-label { display: block; font-size: 12px; font-weight: 800; color: var(--ink-2); margin: 14px 0 6px; }

/* ── Tablas ─────────────────────────────────── */
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  text-align: left; font-size: 10.5px; font-weight: 800; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-4); padding: 9px 12px;
  border-bottom: 1.5px solid var(--line);
}
table.data td { padding: 11px 12px; border-bottom: 1px solid var(--line); color: var(--ink-2); font-weight: 600; }
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: var(--pink-wash); }

/* ── Grid utils ─────────────────────────────── */
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 10px; }

/* ── Command Center ─────────────────────────── */
.command-hero {
  padding: 48px 0 30px; text-align: center;
  background: var(--grad-hero);
  margin: -26px -32px 8px; padding-left: 32px; padding-right: 32px;
}
.command-box {
  background: #fff; border: 2px solid var(--line-strong);
  border-radius: 20px; box-shadow: var(--shadow-md);
  transition: border-color .18s, box-shadow .18s;
  max-width: 760px; margin: 22px auto 0; text-align: left;
}
.command-box:focus-within { border-color: var(--accent-2); box-shadow: var(--shadow-lg); }
.command-box textarea {
  width: 100%; border: none; background: transparent; resize: none;
  padding: 18px 20px 6px; font-family: inherit; font-size: 15.5px; font-weight: 600;
  color: var(--ink); min-height: 76px;
}
.command-box textarea:focus { outline: none; }
.command-box textarea::placeholder { color: var(--ink-4); font-weight: 500; }
.command-actions { display: flex; align-items: center; gap: 10px; padding: 8px 12px 12px; }
.command-actions .hint { font-size: 11.5px; color: var(--ink-4); margin-right: auto; padding-left: 8px; font-weight: 600; }
.quick-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; justify-content: center; }
.quick-chip {
  padding: 7px 16px; border-radius: var(--radius-pill);
  background: #fff; border: 1.5px solid var(--line-strong);
  font-size: 12.5px; font-weight: 700; color: var(--ink-2); transition: all .13s;
}
.quick-chip:hover { border-color: var(--accent-2); color: var(--accent-deep); background: var(--accent-soft); transform: translateY(-1px); }

.intent-panel { margin-top: 20px; animation: rise .3s ease; max-width: 760px; margin-left: auto; margin-right: auto; text-align: left; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.plan-step { display: flex; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.plan-step:last-child { border-bottom: none; }
.plan-step .n {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  background: var(--accent-soft); color: var(--accent-deep);
  font-size: 11px; font-weight: 800; display: flex; align-items: center; justify-content: center;
}

/* ── Jobs / feed ────────────────────────────── */
.job-row { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.job-row:last-child { border-bottom: none; }
.job-thumb {
  width: 58px; height: 34px; border-radius: 8px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--pink-wash-2), var(--accent-soft));
  display: flex; align-items: center; justify-content: center; color: var(--accent); font-size: 12px;
}
.progress { height: 5px; background: var(--paper-sunken); border-radius: var(--radius-pill); overflow: hidden; flex: 1; }
.progress > div { height: 100%; background: var(--grad-brand); border-radius: var(--radius-pill); transition: width .4s; }

/* ── Stats ──────────────────────────────────── */
.stat { padding: 18px 20px; }
.stat .v { font-family: var(--font-display); font-size: 27px; font-weight: 800; letter-spacing: -0.02em; }
.stat .l { font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-4); margin-top: 3px; }
.stat .d { font-size: 12px; margin-top: 6px; color: var(--ink-3); font-weight: 600; }
.up { color: var(--ok); }
.mono.down, .down { color: var(--danger); }

/* ── Flow cards (Create) ────────────────────── */
.flow-card { position: relative; overflow: hidden; cursor: pointer; }
.flow-card::before {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 4px;
  background: var(--grad-brand); opacity: 0; transition: opacity .15s;
}
.flow-card:hover::before { opacity: 1; }
.flow-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

/* ── Editor ─────────────────────────────────── */
.editor-frame { display: grid; grid-template-rows: auto 1fr auto; height: calc(100vh - 57px); background: var(--paper); }
.editor-main { display: grid; grid-template-columns: 200px 1fr 320px; min-height: 0; }
.editor-col { border-right: 1px solid var(--line); overflow-y: auto; padding: 14px; background: #fff; }
.editor-col:last-child { border-right: none; }
.editor-canvas-wrap {
  display: flex; align-items: center; justify-content: center; padding: 24px;
  background: radial-gradient(circle at 50% 30%, #fdf0f5 0%, var(--paper) 70%);
}
.editor-canvas {
  aspect-ratio: 9/16; height: min(100%, 520px);
  background: linear-gradient(160deg, #2a1e30, #4b2440);
  border-radius: 18px; box-shadow: var(--shadow-lg);
  display: flex; align-items: center; justify-content: center; color: #f0d5e2;
  position: relative; overflow: hidden;
}
.scene-rail-item {
  border: 2px solid transparent; border-radius: 12px; padding: 6px;
  cursor: pointer; transition: all .13s; margin-bottom: 8px;
}
.scene-rail-item:hover { background: var(--pink-wash); }
.scene-rail-item.on { border-color: var(--accent-2); background: var(--accent-soft); }
.scene-thumb {
  aspect-ratio: 16/9; border-radius: 8px;
  background: linear-gradient(135deg, var(--pink-wash-2), #e9d3e6);
  display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--ink-3);
}
.timeline { border-top: 1px solid var(--line); background: #fff; padding: 12px 18px 16px; }
.tl-track { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.tl-label { width: 74px; font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-4); flex-shrink: 0; }
.tl-lane { flex: 1; height: 26px; background: var(--paper-sunken); border-radius: 8px; position: relative; display: flex; gap: 2px; padding: 2px; }
.tl-clip { height: 100%; border-radius: 6px; font-size: 10px; font-weight: 700; display: flex; align-items: center; padding: 0 8px; overflow: hidden; white-space: nowrap; color: #fff; cursor: grab; }
.tl-clip.video { background: linear-gradient(120deg, #e0286f, #b81657); }
.tl-clip.voice { background: linear-gradient(120deg, #8b5cf6, #6d3fd8); }
.tl-clip.music { background: linear-gradient(120deg, #0ea5b7, #0b8194); }
.tl-clip.sub { background: linear-gradient(120deg, #e8930c, #c77a06); }

/* ── Estados ────────────────────────────────── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--ink-3); }
.empty-state i { font-size: 34px; color: var(--pink-wash-2); display: block; margin-bottom: 14px; }
.spinner {
  width: 18px; height: 18px; border: 2.5px solid var(--accent-soft);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin .7s linear infinite; display: inline-block; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton {
  background: linear-gradient(90deg, var(--paper-sunken) 25%, var(--pink-wash) 50%, var(--paper-sunken) 75%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 8px;
}
@keyframes shimmer { to { background-position: -200% 0; } }

.notice {
  padding: 12px 16px; border-radius: 12px; font-size: 13px; font-weight: 600;
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--pink-wash); color: var(--ink-2); border: 1px solid var(--pink-wash-2);
}
.notice.warn { background: var(--signal-soft); border-color: #f5dcae; color: #7a4c04; }
.notice.err { background: var(--danger-soft); border-color: #f3bcbc; color: #9c2020; }
.notice.ok { background: var(--ok-soft); border-color: #b5e6d4; color: #0d6b4a; }

.cost-line {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 11.5px; color: var(--accent-deep);
  background: var(--accent-soft); padding: 3px 10px; border-radius: var(--radius-pill);
}

/* ── Blueprint doc ──────────────────────────── */
.doc { max-width: 860px; margin: 0 auto; padding: 48px 32px 120px; }
.doc h1 { font-size: 40px; line-height: 1.1; margin: 8px 0 6px; }
.doc h2 { font-size: 25px; margin: 52px 0 14px; padding-top: 28px; border-top: 1px solid var(--line); }
.doc h3 { font-size: 16.5px; font-weight: 800; margin: 28px 0 8px; letter-spacing: 0; }
.doc p, .doc li { font-size: 14.5px; line-height: 1.72; color: var(--ink-2); }
.doc li { margin: 3px 0; }
.doc strong { color: var(--ink); font-weight: 800; }
.doc table.data { margin: 12px 0; }
.doc pre {
  background: #241b28; color: #f2dbe7; border-radius: 14px;
  padding: 18px 20px; font-family: var(--font-mono); font-size: 12px;
  line-height: 1.65; overflow-x: auto; margin: 14px 0;
}
.doc-toc { position: fixed; right: 24px; top: 90px; width: 210px; font-size: 12px; max-height: 75vh; overflow-y: auto; }
.doc-toc a { display: block; color: var(--ink-3); padding: 3px 0; font-weight: 600; }
.doc-toc a:hover { color: var(--accent); }
@media (max-width: 1280px) { .doc-toc { display: none; } }

/* ── Responsive ─────────────────────────────── */
@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, 1fr); }
  .g3 { grid-template-columns: repeat(2, 1fr); }
  .editor-main { grid-template-columns: 160px 1fr 260px; }
}
@media (max-width: 820px) {
  .app-frame { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: -260px; z-index: 50; transition: left .2s; width: 236px; }
  .sidebar.open { left: 0; box-shadow: var(--shadow-lg); }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .content { padding: 18px 16px 60px; }
  .command-hero { margin: -18px -16px 8px; padding-left: 16px; padding-right: 16px; }
  .editor-main { grid-template-columns: 1fr; }
  .editor-col { border-right: none; border-bottom: 1px solid var(--line); }
  .doc { padding: 32px 18px 80px; }
}
