/* ═══════════════════════════════════════════════════════════════
   Social Analysis Platform — ciberimaginario.cloud editorial
   Fonts : Bebas Neue (display) + Inter (body) + DM Mono (mono)
   Palette: red #b1040e, red-dark #8f1000, gold #fcbd00,
            black #111, gray #aaa, off #f9f9f9
   ═══════════════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Inter:wght@300;400;500;600&family=DM+Mono:wght@400;500&display=swap');

:root {
  --red:       #b1040e;
  --red-dark:  #8f1000;
  --gold:      #fcbd00;
  --gray:      #aaaaaa;
  --black:     #111111;
  --off:       #f9f9f9;
  --white:     #ffffff;
  --border:    rgba(0,0,0,.08);

  --font-display: 'Bebas Neue', sans-serif;
  --font-body:    'Inter', sans-serif;
  --font-mono:    'DM Mono', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--white);
  color: var(--black);
  line-height: 1.65;
  min-height: 100vh;
  overflow-x: hidden;
}
body::before {
  content: '';
  position: fixed; inset: 0;
  background-image:
    linear-gradient(rgba(0,0,0,.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,0,0,.03) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none; z-index: 0;
}
a { color: var(--red); text-decoration: none; transition: color .3s; }
a:hover { color: var(--red-dark); }

.accent-line {
  position: fixed; top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--red-dark), var(--red), var(--gold));
  z-index: 200;
}

/* ── layout ────────────────────────────────────────────────── */
.page-wrap { display: flex; min-height: 100vh; position: relative; z-index: 1; }
.sidebar {
  position: fixed; top: 3px; left: 0; bottom: 0;
  width: 240px; z-index: 100;
  background: var(--white);
  border-right: 1px solid var(--border);
  padding: 28px 24px 24px;
  display: flex; flex-direction: column;
  overflow-y: auto;
}
.main { margin-left: 240px; flex: 1; }

/* ── sidebar ───────────────────────────────────────────────── */
.sidebar__logo {
  font-family: var(--font-display);
  font-size: 1.6rem; letter-spacing: .04em;
  color: var(--black); line-height: 1; margin-bottom: 2px;
}
.sidebar__sub {
  font-family: var(--font-mono);
  font-size: .6rem; letter-spacing: .15em;
  text-transform: uppercase; color: var(--gray); margin-bottom: 24px;
}
.sidebar__divider { height: 1px; background: var(--border); margin: 16px 0; }
.sidebar__section-label {
  font-family: var(--font-mono);
  font-size: .58rem; letter-spacing: .25em;
  text-transform: uppercase; color: var(--gray); margin-bottom: 12px;
}
.sidebar__nav { list-style: none; }
.sidebar__nav li { margin-bottom: 1px; }
.sidebar__nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; color: #555; font-size: .85rem;
  transition: all .25s; border-left: 2px solid transparent;
}
.sidebar__nav a:hover { background: var(--off); color: var(--black); border-left-color: var(--gray); }
.sidebar__nav a.active { background: var(--off); color: var(--red); font-weight: 600; border-left-color: var(--red); }
.sidebar__nav a .nav-icon { width: 16px; height: 16px; opacity: .5; flex-shrink: 0; }
.sidebar__nav a.active .nav-icon { opacity: .8; }

.status-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.status-dot--ok { background: #27ae60; }
.status-dot--err { background: var(--red); }
.status-label { font-family: var(--font-mono); font-size: .6rem; letter-spacing: .1em; color: var(--gray); }

.sidebar__footer { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--border); }
.sidebar__footer p { font-family: var(--font-mono); font-size: .56rem; letter-spacing: .1em; color: var(--gray); line-height: 1.6; text-transform: uppercase; }

/* ── topbar ────────────────────────────────────────────────── */
.topbar {
  background: var(--white); border-bottom: 1px solid var(--border);
  padding: 16px 2.5rem; display: flex; align-items: center;
  justify-content: space-between; position: sticky; top: 3px; z-index: 50;
}
.topbar__title { font-family: var(--font-display); font-size: 1.5rem; letter-spacing: .04em; color: var(--black); }
.topbar__badge {
  font-family: var(--font-mono); font-size: .6rem; letter-spacing: .15em;
  text-transform: uppercase; color: var(--red);
  border: 1px solid var(--red); padding: .3rem .75rem; border-radius: 2px;
  display: inline-flex; align-items: center; gap: 6px;
}
.topbar__badge .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--red); }

.content { padding: 2.5rem; max-width: 1200px; }

/* ── hero card ─────────────────────────────────────────────── */
.hero-card {
  border: 1px solid var(--border); padding: 3rem;
  margin-bottom: 2.5rem; position: relative; background: var(--off);
}
.hero-card::before {
  content: ''; position: absolute; top: 0; left: 0;
  width: 100%; height: 3px;
  background: linear-gradient(90deg, var(--red-dark), var(--red), var(--gold));
}
.hero-card h1 {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 5vw, 3.5rem);
  letter-spacing: .03em; line-height: .95;
  color: var(--black); margin-bottom: .6rem;
}
.hero-card h1 em { font-style: normal; color: var(--red); }
.hero-card p { font-size: .88rem; line-height: 1.75; color: #555; font-weight: 300; max-width: 640px; }

/* ── tags ──────────────────────────────────────────────────── */
.tag-row { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: 1.25rem; }
.tag {
  font-family: var(--font-mono); font-size: .6rem; letter-spacing: .12em;
  text-transform: uppercase; padding: .3rem .75rem;
  border: 1px solid var(--border); color: #666; border-radius: 2px;
  background: rgba(0,0,0,.02);
}
.tag--red { color: var(--red); border-color: rgba(177,4,14,.25); background: rgba(177,4,14,.04); }
.tag--gold { color: #9a7600; border-color: rgba(252,189,0,.35); background: rgba(252,189,0,.06); }
.tag--active { background: var(--red); color: var(--white); border-color: var(--red); }

/* ── metrics ───────────────────────────────────────────────── */
.metrics-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1px; margin-bottom: 2.5rem;
  background: var(--border); border: 1px solid var(--border);
}
.metric { background: var(--white); padding: 1.5rem 1.75rem; }
.metric__label {
  font-family: var(--font-mono); font-size: .58rem; letter-spacing: .2em;
  text-transform: uppercase; color: var(--gray); margin-bottom: .35rem;
}
.metric__value { font-family: var(--font-display); font-size: 2.2rem; color: var(--black); line-height: 1; }
.metric__value--red { color: var(--red); }

/* ── cards ─────────────────────────────────────────────────── */
.card { background: var(--white); border: 1px solid var(--border); overflow: hidden; transition: background .3s; }
.card:hover { background: var(--off); }
.card__header { padding: 1.25rem 1.75rem; border-bottom: 1px solid var(--border); }
.card__header h3 { font-family: var(--font-display); font-size: 1.15rem; letter-spacing: .04em; color: var(--black); }
.card__body { padding: 1.75rem; }

/* ── forms ─────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }
.form-group label {
  display: block; font-family: var(--font-mono); font-size: .6rem;
  letter-spacing: .2em; text-transform: uppercase; color: var(--gray); margin-bottom: 6px;
}
.form-control {
  width: 100%; padding: 10px 14px; border: 1px solid var(--border);
  font-family: var(--font-body); font-size: .88rem;
  color: var(--black); background: var(--white); transition: border-color .25s;
}
.form-control:focus { outline: none; border-color: var(--red); }
select.form-control { cursor: pointer; border-radius: 0; -webkit-appearance: none; }
textarea.form-control { resize: vertical; min-height: 90px; }

.file-drop {
  border: 1px dashed var(--gray); padding: 2rem; text-align: center;
  cursor: pointer; transition: all .25s; background: var(--off);
}
.file-drop:hover, .file-drop.dragover { border-color: var(--red); background: rgba(177,4,14,.03); }
.file-drop__icon { font-size: 28px; margin-bottom: 6px; color: var(--gray); }
.file-drop__text {
  font-family: var(--font-mono); font-size: .65rem; letter-spacing: .1em;
  color: var(--gray); text-transform: uppercase;
}
.file-drop__text strong { color: var(--red); }
.file-drop input[type="file"] { display: none; }

/* ── buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: .65rem; font-weight: 500;
  letter-spacing: .15em; text-transform: uppercase;
  padding: 12px 24px; border: 1px solid transparent; cursor: pointer; transition: all .25s;
}
.btn--primary { background: var(--red); color: var(--white); border-color: var(--red); }
.btn--primary:hover { background: var(--red-dark); border-color: var(--red-dark); }
.btn--secondary { background: var(--black); color: var(--white); border-color: var(--black); }
.btn--secondary:hover { background: #333; }
.btn--outline { background: transparent; border-color: var(--border); color: var(--black); }
.btn--outline:hover { border-color: var(--red); color: var(--red); }
.btn--gold { background: var(--gold); color: var(--black); border-color: var(--gold); }
.btn--gold:hover { background: #e0a800; }
.btn--sm { padding: 8px 16px; font-size: .6rem; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn .spinner { width: 12px; height: 12px; border: 2px solid rgba(255,255,255,.3); border-top-color: var(--white); border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── tables ────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
table.data-table thead th {
  font-family: var(--font-mono); font-size: .6rem; letter-spacing: .15em;
  text-transform: uppercase; color: var(--gray); background: var(--off);
  padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); font-weight: 500;
}
table.data-table tbody td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data-table tbody tr:hover { background: var(--off); }

/* ── flash ─────────────────────────────────────────────────── */
.flash { padding: 12px 18px; margin-bottom: 1.25rem; font-size: .82rem; border-left: 3px solid; }
.flash--success { background: rgba(39,174,96,.06); color: #1a7a43; border-color: #27ae60; }
.flash--error   { background: rgba(177,4,14,.05); color: var(--red); border-color: var(--red); }
.flash--info    { background: rgba(0,0,0,.03); color: #555; border-color: var(--gray); }

/* ── charts ────────────────────────────────────────────────── */
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin-bottom: 2.5rem; background: var(--border); border: 1px solid var(--border); }
.chart-grid--full { grid-template-columns: 1fr; }
.chart-grid > .card { border: none; }
.chart-container { min-height: 240px; position: relative; }
.chart-container canvas { width: 100% !important; }

/* ── loading ───────────────────────────────────────────────── */
.loading-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(255,255,255,.85); display: flex;
  align-items: center; justify-content: center; backdrop-filter: blur(6px);
}
.loading-box { text-align: center; }
.loading-box .spinner-lg {
  width: 32px; height: 32px; margin: 0 auto 14px;
  border: 2px solid var(--border); border-top-color: var(--red);
  border-radius: 50%; animation: spin .8s linear infinite;
}
.loading-box p {
  font-family: var(--font-mono); font-size: .65rem; letter-spacing: .15em;
  text-transform: uppercase; color: var(--gray);
}

/* ── filter bar ────────────────────────────────────────────── */
.filter-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 2rem; flex-wrap: wrap; }
.filter-bar .tag { cursor: pointer; transition: all .25s; }
.filter-bar .tag:hover { border-color: var(--red); color: var(--red); }
.filter-bar .tag.active { background: var(--red); color: var(--white); border-color: var(--red); }

/* ── helpers ───────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.mb-16 { margin-bottom: 1rem; }
.mb-24 { margin-bottom: 1.5rem; }
.mb-32 { margin-bottom: 2rem; }

.empty-state { text-align: center; padding: 4rem 1.5rem; }
.empty-state__icon { font-size: 36px; margin-bottom: 12px; opacity: .3; }
.empty-state__text { font-size: .85rem; color: #666; max-width: 380px; margin: 0 auto; }

/* ── responsive ────────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { width: 200px; } .main { margin-left: 200px; }
  .content { padding: 1.5rem; } .grid-2, .chart-grid { grid-template-columns: 1fr; }
}
@media (max-width: 700px) { .sidebar { display: none; } .main { margin-left: 0; } }
