/* Conexiala — Plataforma. Misma línea gráfica que conexiala.cl (ver web/elementor-sections/01-header.html) */

:root {
  --bg-primary: #071525;
  --bg-secondary: #0B1D3A;
  --surface: #132A44;
  --surface-hover: #1A3454;
  --primary: #2563EB;
  --accent: #06C6E0;
  --text-primary: #F1F5F9;
  --text-secondary: #94A3B8;
  --border: #263B50;
  --gradient: linear-gradient(135deg, #2563EB 0%, #06C6E0 100%);
  --font-display: 'Poppins', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Inter', 'Segoe UI', system-ui, sans-serif;

  --ok: #22C55E;
  --proximo: #EAB308;
  --importante: #F97316;
  --urgente: #EF4444;
  --neutro: #64748B;

  --sidebar-w: 240px;
  --topbar-h: 68px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
.accent-text { color: var(--accent); }

h1, h2, h3 { font-family: var(--font-display); margin: 0 0 8px; }

/* ---------- Layout ---------- */

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  padding: 20px 0;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  overflow-y: auto;
}

.sidebar__logo {
  display: block;
  padding: 0 24px 24px;
}
.sidebar__logo-text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  color: var(--text-primary);
}

.sidebar__nav ul { list-style: none; margin: 0; padding: 0; }
.sidebar__nav a,
.sidebar__nav-soon {
  display: block;
  padding: 11px 24px;
  font-weight: 500;
  font-size: 14.5px;
  color: var(--text-secondary);
  border-left: 3px solid transparent;
}
.sidebar__nav a:hover { color: var(--text-primary); background: var(--surface); }
.sidebar__nav a.is-active {
  color: var(--text-primary);
  background: var(--surface);
  border-left-color: var(--accent);
  font-weight: 600;
}
.sidebar__nav-soon { color: #4B5A6B; cursor: default; }

.app-main {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(20px, 3vw, 36px);
  border-bottom: 1px solid var(--border);
  background: var(--bg-primary);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar__title { font-size: 20px; font-weight: 600; }
.topbar__user { display: flex; align-items: center; gap: 14px; }
.topbar__user-name { color: var(--text-secondary); font-size: 14px; }

.app-content {
  padding: clamp(20px, 3vw, 36px);
  max-width: 1200px;
  width: 100%;
}

@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  .app-main { margin-left: 0; }
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  padding: 11px 22px;
  border-radius: 9px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease, background-color .15s ease;
  white-space: nowrap;
}
.btn--sm { padding: 7px 14px; font-size: 13px; }
.btn--primary { background: var(--gradient); color: #fff; box-shadow: 0 6px 18px -8px rgba(37,99,235,.55); }
.btn--primary:hover { transform: translateY(-1px); }
.btn--secondary { background: transparent; color: var(--text-primary); border-color: var(--border); }
.btn--secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn--danger { background: transparent; color: var(--urgente); border-color: var(--urgente); }
.btn--danger:hover { background: rgba(239,68,68,.1); }

/* ---------- Cards / KPIs ---------- */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
}
a.kpi-card { display: block; transition: border-color .15s ease; }
a.kpi-card:hover { border-color: var(--accent); }
.kpi-card__value { font-family: var(--font-display); font-size: 32px; font-weight: 700; }
.kpi-card__value.is-alert { color: var(--urgente); }
.kpi-card__label { color: var(--text-secondary); font-size: 13.5px; margin-top: 4px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px 24px;
  margin-bottom: 24px;
}
.card__header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card__title { font-size: 16px; font-weight: 600; margin: 0; }

/* ---------- Listas de "próximos" ---------- */

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  display: flex;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.timeline li:last-child { border-bottom: none; }
.timeline__date { color: var(--text-secondary); min-width: 84px; font-variant-numeric: tabular-nums; }
.timeline__empty { color: var(--text-secondary); padding: 8px 0; }

/* ---------- Tablas ---------- */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); }
th { color: var(--text-secondary); font-weight: 500; font-size: 13px; text-transform: uppercase; letter-spacing: .03em; }
tbody tr:hover { background: var(--surface-hover); }
td.actions { display: flex; gap: 8px; justify-content: flex-end; }
td.text-right, th.text-right { text-align: right; }

/* ---------- Badges ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
}
.badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge--ok { color: var(--ok); background: rgba(34,197,94,.12); }
.badge--proximo { color: var(--proximo); background: rgba(234,179,8,.12); }
.badge--importante { color: var(--importante); background: rgba(249,115,22,.12); }
.badge--urgente { color: var(--urgente); background: rgba(239,68,68,.12); }
.badge--neutro { color: var(--neutro); background: rgba(100,116,139,.15); }

/* ---------- Formularios ---------- */

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field--full { grid-column: 1 / -1; }
.field label { font-size: 13.5px; font-weight: 500; color: var(--text-secondary); }
.field input,
.field select,
.field textarea {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}
.field textarea { resize: vertical; min-height: 90px; }
.form-actions { display: flex; gap: 12px; margin-top: 24px; }

/* ---------- Alertas de sistema (flash messages) ---------- */

.alert { padding: 12px 16px; border-radius: 8px; font-size: 14px; margin-bottom: 20px; }
.alert--error { background: rgba(239,68,68,.12); color: #FCA5A5; border: 1px solid rgba(239,68,68,.35); }
.alert--success { background: rgba(34,197,94,.12); color: #86EFAC; border: 1px solid rgba(34,197,94,.35); }

/* ---------- Utilidades ---------- */

.empty-state { color: var(--text-secondary); text-align: center; padding: 40px 0; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.text-muted { color: var(--text-secondary); }

/* ---------- Calendario ---------- */

.calendar__nav { display: flex; align-items: center; gap: 12px; }
.calendar__nav-label { font-family: var(--font-display); font-weight: 600; font-size: 16px; min-width: 150px; text-align: center; }

.calendar-wrap { overflow-x: auto; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(110px, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.calendar-grid__weekday { background: var(--bg-secondary); color: var(--text-secondary); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; padding: 8px 10px; text-align: center; }
.calendar-day { background: var(--surface); min-height: 96px; padding: 8px; display: flex; flex-direction: column; gap: 4px; }
.calendar-day--muted { background: var(--bg-secondary); }
.calendar-day--today { box-shadow: inset 0 0 0 2px var(--accent); }
.calendar-day__number { font-size: 13px; color: var(--text-secondary); font-weight: 600; }
.calendar-day--muted .calendar-day__number { color: #4B5A6B; }
.calendar-day__event { display: block; font-size: 11.5px; padding: 2px 6px; border-radius: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calendar-day__event--ok { background: rgba(34,197,94,.15); color: var(--ok); }
.calendar-day__event--proximo { background: rgba(234,179,8,.15); color: var(--proximo); }
.calendar-day__event--importante { background: rgba(249,115,22,.15); color: var(--importante); }
.calendar-day__event--urgente { background: rgba(239,68,68,.15); color: var(--urgente); }
.calendar-day__more { font-size: 11px; color: var(--text-secondary); }

/* ---------- Login ---------- */

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(circle at 15% 20%, rgba(37,99,235,.25), transparent 45%),
    radial-gradient(circle at 85% 80%, rgba(6,198,224,.18), transparent 45%),
    var(--bg-primary);
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px 32px;
}
.login-card__logo { font-family: var(--font-display); font-weight: 700; font-size: 24px; text-align: center; display: block; margin-bottom: 28px; }
.login-card .field { margin-bottom: 18px; }
.login-card .btn { width: 100%; margin-top: 8px; }
