/* ============================================================
   Somos Estupendas · Brand Kit — v1.0
   ------------------------------------------------------------
   Sistema de diseño COMPARTIDO entre las herramientas internas
   (Panel SEO, Panel de copy, y las que vengan).

   Cómo usarlo en una herramienta nueva:
     1. Copia este archivo a  frontend/css/brand.css
     2. Enlázalo ANTES del CSS propio de la herramienta:
          <link rel="stylesheet" href="css/brand.css">
          <link rel="stylesheet" href="css/styles.css">
     3. Usa las mismas clases (.card, .btn-primary, .chip, .modal…)
        y las variables (var(--accent), var(--text)…).

   Qué hay aquí (lo COMÚN a todas las herramientas):
     · Tokens de marca: paleta, tipografías, radios, sombras.
     · Reset + base tipográfica.
     · Shell de aplicación: sidebar, navegación, topbar, contenido.
     · Componentes base: botones, tarjetas, tablas, chips/badges,
       modales, formularios, alertas, barras de progreso, filtros.

   Qué NO va aquí: las pantallas propias de cada herramienta
   (en el Panel SEO eso vive en styles.css). Regla: si otra
   herramienta lo reutilizaría igual, va en brand.css.

   Al actualizar la marca, edita ESTE archivo y cópialo a cada
   herramienta (fuente única de la identidad visual).
   ============================================================ */

/* Los tokens de marca (colores, tipografías, forma) viven en brand-tokens.css,
   la fuente única compartida con el resto de herramientas. */
@import url('brand-tokens.css');

/* ── Reset ────────────────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* Titular con la fuente de marca (Ovo). Aplícalo donde quieras
   un acento editorial: <h1 class="font-heading">…</h1> */
.font-heading { font-family: var(--font-heading); letter-spacing: -.04em; font-weight: 400; }

/* ── Shell de aplicación ──────────────────────────────────── */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 6px 8px 22px; }
.brand-dot {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #ff8f6b);
  flex-shrink: 0;
}
.brand-logo { width: 34px; height: 34px; border-radius: 10px; object-fit: cover; flex-shrink: 0; }
.brand strong { display: block; font-size: 15px; line-height: 1.2; }
.brand small { display: block; color: var(--text-dim); font-size: 12px; line-height: 1.2; }

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  background: none; border: none; color: var(--text);
  font-size: 14px; text-align: left; padding: 10px 12px;
  border-radius: 999px; cursor: pointer; transition: all .12s;
  font-family: inherit;
}
.nav-item span { width: 18px; display: inline-flex; align-items: center; justify-content: center; font-size: 15px; opacity: .85; }
.nav-item .nav-svg { width: 17px; height: 17px; }
.nav-item:hover { background: var(--bg-card); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.nav-divider { height: 1px; background: var(--border); margin: 10px 6px; }
.nav-secondary { opacity: .75; font-size: 13px; }

.sidebar-footer { margin-top: auto; padding-top: 18px; }
.sources-status { display: flex; flex-direction: column; gap: 6px; }
.source-pill { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-dim); }
.source-pill .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.source-pill .dot.live { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.source-pill .dot.sample { background: var(--text-faint); }

.main { flex: 1; min-width: 0; }
.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 18px 30px; border-bottom: 1px solid var(--border); flex-wrap: wrap;
  position: sticky; top: 0; background: rgba(244,245,247,.85); backdrop-filter: blur(8px); z-index: 10;
}
.topbar-left { min-width: 0; }
.topbar h1 { font-size: 20px; font-weight: 650; white-space: nowrap; }
.subtitle { color: var(--text-dim); font-size: 13px; margin-top: 3px; }
.topbar-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

.content { padding: 26px 30px 60px; }
.loading { color: var(--text-dim); padding: 40px; text-align: center; }

/* ── Grid & tarjetas ──────────────────────────────────────── */
.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1100px) { .cols-3, .cols-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 760px) { .cols-2, .cols-3, .cols-4 { grid-template-columns: 1fr; } }

.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px;
}
.card h2 { font-size: 15px; font-weight: 620; margin-bottom: 4px; }
.card h2 .hint { font-weight: 400; color: var(--text-faint); font-size: 12px; }
.card .card-sub { color: var(--text-dim); font-size: 12px; margin-bottom: 14px; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.span-2 { grid-column: span 2; }
@media (max-width: 760px) { .span-2 { grid-column: span 1; } }

.section-block { margin-bottom: 28px; }
.section-block > h3 {
  font-size: 13px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-faint); margin-bottom: 12px;
}
.section-intro { color: var(--text-dim); font-size: 13.5px; line-height: 1.6; margin-bottom: 14px; max-width: 820px; }
.mini-summary { font-size: 13px; color: var(--text-dim); margin-bottom: 16px; }

/* ── Badges / estados ─────────────────────────────────────── */
.dot-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 3px 9px; border-radius: 20px; }
.status-green  { color: var(--green);  background: var(--green-soft); }
.status-yellow { color: var(--yellow); background: var(--yellow-soft); }
.status-red    { color: var(--red);    background: var(--red-soft); }
.status-info   { color: var(--lila);   background: var(--lila-soft); }
.status-none   { color: var(--text-faint); background: rgba(0,0,0,.04); }
.bar-green { background: var(--green); } .bar-yellow { background: var(--yellow); }
.bar-red { background: var(--red); } .bar-info { background: var(--blue); } .bar-none { background: var(--border); }

/* Chip genérico (etiqueta compacta). Cada herramienta define sus variantes de color. */
.chip { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 6px; white-space: nowrap; }
.tag { font-size: 11px; padding: 2px 8px; border-radius: 5px; background: var(--bg-elev); color: var(--text-dim); }

/* ── Tablas ───────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--text-faint); font-weight: 500; font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--border); }
td { padding: 9px 10px; border-bottom: 1px solid var(--border); color: var(--text); }
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-variant-numeric: tabular-nums; }
.up { color: var(--green); font-weight: 600; }
.down { color: var(--red); font-weight: 600; }
.pos-pill { display: inline-block; min-width: 26px; text-align: center; padding: 2px 8px; border-radius: 6px; background: var(--bg-elev); font-variant-numeric: tabular-nums; }

/* ── Gráficas (contenedor) ────────────────────────────────── */
.chart-wrap { position: relative; height: 280px; }
.chart-wrap.sm { height: 220px; }

/* ── Alertas ──────────────────────────────────────────────── */
.alert {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px;
  border-radius: 10px; background: var(--red-soft); border: 1px solid #ef5b6b44;
  font-size: 13px; margin-bottom: 10px;
}
.alert.warn { background: var(--yellow-soft); border-color: #f5c45144; }
.alert .ico { font-size: 15px; }
.banner-sample {
  background: var(--yellow-soft); border: 1px solid #f5c45144; color: var(--yellow);
  padding: 8px 14px; border-radius: 9px; font-size: 12px; margin-bottom: 18px;
  display: inline-flex; align-items: center; gap: 8px;
}

/* ── Barras de progreso ───────────────────────────────────── */
.progress { height: 9px; background: var(--bg-elev); border-radius: 6px; overflow: hidden; margin: 8px 0; }
.progress > span { display: block; height: 100%; border-radius: 6px; }
.kv { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.kv .val { color: var(--text-dim); }

/* ── Botones ──────────────────────────────────────────────── */
.btn-primary { background: var(--accent); color: var(--on-accent); border: none; border-radius: 999px; padding: 8px 16px; font-weight: 600; cursor: pointer; font-family: inherit; font-size: 13px; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: none; border: 1px solid var(--border); color: var(--text-dim); border-radius: 999px; padding: 8px 16px; cursor: pointer; font-family: inherit; font-size: 13px; }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 999px; }
/* Estado "enviado" (verde, clicable para revertir) */
.btn-primary.sent { background: var(--green-soft); color: var(--green); border: 1px solid var(--green); filter: none; }
.btn-primary.sent:hover { background: var(--red-soft, #ef444422); color: var(--red, #ef4444); border-color: var(--red, #ef4444); }

/* ── Subida de ficheros ───────────────────────────────────── */
.upload-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
input[type=file] { color: var(--text-dim); font-size: 13px; }

/* ── Filtros tipo pastilla ────────────────────────────────── */
.type-filter { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.type-filter button {
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text-dim);
  border-radius: 20px; padding: 6px 14px; font-size: 13px; cursor: pointer; font-family: inherit;
}
.type-filter button:hover { color: var(--text); }
.type-filter button.active { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

/* ── Modales ──────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal-overlay[hidden] { display: none; }
.modal { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; width: 380px; box-shadow: var(--shadow); }
.modal h3 { margin-bottom: 8px; font-size: 17px; }
.modal-desc { color: var(--text-dim); font-size: 13px; margin-bottom: 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
#modal-input {
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 8px 10px; font-size: 13px; font-family: inherit; width: 100%;
}

/* ── Formularios (campos reutilizables) ───────────────────── */
.tf-label { font-size: 12px; font-weight: 600; color: var(--text-dim); margin-top: 12px; }
.tf-label small { font-weight: 400; color: var(--text-faint); }
.tf-input {
  background: var(--bg-elev); border: 1px solid var(--border); color: var(--text);
  border-radius: 9px; padding: 9px 11px; font-size: 13px; font-family: inherit; width: 100%;
}
.tf-input:focus { outline: none; border-color: var(--accent); }
.tf-area { resize: vertical; line-height: 1.45; }
.tf-story { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 4px; }
.tf-story > div { display: flex; flex-direction: column; gap: 4px; }
.tf-story .tf-label { margin-top: 4px; }
@media (max-width: 560px) { .tf-story { grid-template-columns: 1fr; } }

/* ── Utilidades y estados vacíos ──────────────────────────── */
.muted { color: var(--text-faint); }
.empty { color: var(--text-faint); font-size: 13px; padding: 14px 0; }
.empty-state { text-align: center; padding: 70px 20px; color: var(--text-dim); }
.empty-state .empty-ico { font-size: 46px; color: var(--green); margin-bottom: 14px; }
.empty-state h3 { font-size: 18px; color: var(--text); margin-bottom: 8px; }
.empty-state p { margin-bottom: 18px; }
