/* ═══════════════════════════════════════════════════════════════
   SISTEMA DE GESTIÓN COMUNITARIA — ESTILOS GLOBALES
   Paleta: Slate oscuro + Teal vibrante + Amber de acento
   Tipografía: Sora (display) + DM Sans (body)
═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;600;700;800&family=DM+Sans:wght@300;400;500;600&display=swap');

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --bg-base:       #0d1117;
  --bg-surface:    #161b22;
  --bg-card:       #1c2230;
  --bg-hover:      #242b3b;
  --border:        #2d3748;
  --border-light:  #374151;

  --teal-400:      #2dd4bf;
  --teal-500:      #14b8a6;
  --teal-600:      #0d9488;
  --teal-glow:     rgba(45,212,191,.18);

  --amber-400:     #fbbf24;
  --amber-500:     #f59e0b;

  --text-primary:  #f0f6fc;
  --text-secondary:#8b949e;
  --text-muted:    #484f58;

  --success:       #22c55e;
  --warning:       #f59e0b;
  --danger:        #ef4444;
  --info:          #3b82f6;

  --radius-sm:     6px;
  --radius:        10px;
  --radius-lg:     16px;
  --radius-xl:     24px;

  --shadow-sm:     0 1px 3px rgba(0,0,0,.4);
  --shadow:        0 4px 16px rgba(0,0,0,.5);
  --shadow-lg:     0 8px 32px rgba(0,0,0,.6);
  --shadow-teal:   0 0 24px rgba(45,212,191,.25);

  --sidebar-w:     260px;
  --topbar-h:      64px;
  --transition:    .22s ease;
}

/* ── Reset & base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

h1,h2,h3,h4,h5,h6 { font-family: 'Sora', sans-serif; line-height: 1.3; }

a { color: var(--teal-400); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--teal-500); }

img { max-width: 100%; display: block; }

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 99px; }

/* ═══════════════════════════════════════════════════════════════
   LAYOUT PRINCIPAL (sidebar + contenido)
═══════════════════════════════════════════════════════════════ */
.layout { display: flex; min-height: 100vh; }

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}

.brand-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--teal-500), var(--teal-600));
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  font-size: 18px;
  box-shadow: var(--shadow-teal);
}

.brand-text strong {
  display: block;
  font-family: 'Sora', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}
.brand-text span { font-size: 11px; color: var(--text-secondary); }

.sidebar-nav { flex: 1; padding: 16px 0; overflow-y: auto; }

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-muted);
  padding: 12px 20px 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: var(--text-secondary);
  border-radius: 0;
  transition: all var(--transition);
  font-size: 14px;
  font-weight: 500;
  position: relative;
}

.nav-link:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-link.active {
  background: var(--teal-glow);
  color: var(--teal-400);
  border-right: 2px solid var(--teal-400);
}

.nav-link .nav-icon {
  width: 20px;
  text-align: center;
  font-size: 16px;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 99px;
  min-width: 18px;
  text-align: center;
}

.nav-link.logout {
  color: var(--danger);
  margin-top: 8px;
}
.nav-link.logout:hover { background: rgba(239,68,68,.12); }

/* ── Topbar ────────────────────────────────────────────────── */
.main-wrapper {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: var(--topbar-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title {
  font-family: 'Sora', sans-serif;
  font-size: 18px;
  font-weight: 700;
}

.topbar-actions { display: flex; align-items: center; gap: 12px; }

.avatar {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--teal-500), var(--amber-500));
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
}

/* ── Page content ──────────────────────────────────────────── */
.page-content {
  flex: 1;
  padding: 28px;
  max-width: 1400px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
  flex-wrap: wrap;
}

.page-title { font-size: 26px; font-weight: 800; }
.page-subtitle { font-size: 14px; color: var(--text-secondary); margin-top: 4px; }

/* ═══════════════════════════════════════════════════════════════
   COMPONENTES
═══════════════════════════════════════════════════════════════ */

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), border-color var(--transition);
}
.card:hover { border-color: var(--border-light); }

/* ── Stat cards ────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all var(--transition);
  cursor: default;
}

.stat-card:hover {
  border-color: var(--teal-500);
  box-shadow: var(--shadow-teal);
  transform: translateY(-2px);
}

.stat-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-icon.teal   { background: rgba(45,212,191,.15); color: var(--teal-400); }
.stat-icon.amber  { background: rgba(251,191,36,.15);  color: var(--amber-400); }
.stat-icon.danger { background: rgba(239,68,68,.15);   color: var(--danger); }
.stat-icon.info   { background: rgba(59,130,246,.15);  color: var(--info); }
.stat-icon.success{ background: rgba(34,197,94,.15);   color: var(--success); }
.stat-icon.purple { background: rgba(168,85,247,.15);  color: #a855f7; }

.stat-value {
  font-family: 'Sora', sans-serif;
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 3px;
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius);
  border: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary {
  background: var(--teal-500);
  color: #fff;
  box-shadow: 0 0 16px rgba(20,184,166,.35);
}
.btn-primary:hover {
  background: var(--teal-400);
  color: #fff;
  box-shadow: 0 0 24px rgba(20,184,166,.5);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-hover);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
}
.btn-secondary:hover { background: var(--border); color: var(--text-primary); }

.btn-danger  { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-warning { background: var(--warning); color: #000; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); }

/* ── Badges / Estado ───────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.badge-pendiente { background: rgba(251,191,36,.15); color: var(--amber-400); }
.badge-revision  { background: rgba(59,130,246,.15);  color: var(--info); }
.badge-aprobado  { background: rgba(34,197,94,.15);   color: var(--success); }
.badge-rechazado { background: rgba(239,68,68,.15);   color: var(--danger); }
.badge-publicado { background: rgba(34,197,94,.15);   color: var(--success); }
.badge-borrador  { background: rgba(139,148,158,.15); color: var(--text-secondary); }

/* ── Tabla ─────────────────────────────────────────────────── */
.table-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.table-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-wrap: wrap;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-hover); }

tbody td {
  padding: 13px 16px;
  font-size: 14px;
  color: var(--text-secondary);
  vertical-align: middle;
}

.td-id { color: var(--text-muted); font-size: 12px; font-family: monospace; }
.td-name { color: var(--text-primary); font-weight: 500; }

/* ── Formularios ───────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

input[type=text],
input[type=email],
input[type=password],
input[type=number],
input[type=tel],
input[type=date],
input[type=time],
select,
textarea {
  width: 100%;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--teal-500);
  box-shadow: 0 0 0 3px rgba(20,184,166,.18);
}

input::placeholder, textarea::placeholder { color: var(--text-muted); }

textarea { resize: vertical; min-height: 100px; }

select { cursor: pointer; }
select option { background: var(--bg-card); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.input-icon-wrap { position: relative; }
.input-icon-wrap .icon {
  position: absolute;
  left: 13px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 16px;
}
.input-icon-wrap input { padding-left: 42px; }

/* ── Alerts / Flash ────────────────────────────────────────── */
.flash-container { padding: 0 28px; margin-top: 16px; }

.alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 10px;
  border-left: 3px solid currentColor;
  animation: slideDown .3s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.alert-success { background: rgba(34,197,94,.12); color: var(--success); }
.alert-error   { background: rgba(239,68,68,.12);  color: var(--danger); }
.alert-info    { background: rgba(59,130,246,.12); color: var(--info); }

/* ── Filtros ───────────────────────────────────────────────── */
.filters-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.filters-bar select,
.filters-bar input { width: auto; min-width: 140px; }

/* ── Empty state ───────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; opacity: .5; }
.empty-state p { font-size: 15px; }

/* ── Detail sections ───────────────────────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-top: 20px;
}

.detail-field { margin-bottom: 16px; }
.detail-field .label { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-bottom: 4px; }
.detail-field .value { font-size: 15px; color: var(--text-primary); }

/* ── Pagination ────────────────────────────────────────────── */
.pagination {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}
.page-btn {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-hover);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  transition: all var(--transition);
}
.page-btn.active { background: var(--teal-500); border-color: var(--teal-500); color: #fff; }
.page-btn:hover:not(.active) { border-color: var(--teal-500); color: var(--teal-400); }

/* ── Mobile hamburger ──────────────────────────────────────── */
.hamburger { display: none; cursor: pointer; font-size: 22px; }

/* ── Overlay ───────────────────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 99;
}

/* ═══════════════════════════════════════════════════════════════
   AUTH PAGES
═══════════════════════════════════════════════════════════════ */
.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.auth-brand-panel {
  background: linear-gradient(145deg, #0d1117 0%, #0f2027 50%, #0d1117 100%);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
  position: relative;
  overflow: hidden;
}

.auth-brand-panel::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(45,212,191,.08) 0%, transparent 70%);
  top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  pointer-events: none;
}

.auth-brand-logo {
  width: 80px; height: 80px;
  background: linear-gradient(135deg, var(--teal-500), var(--teal-600));
  border-radius: var(--radius-xl);
  display: grid;
  place-items: center;
  font-size: 36px;
  box-shadow: 0 0 60px rgba(45,212,191,.35);
  margin-bottom: 24px;
  animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
  0%,100% { box-shadow: 0 0 40px rgba(45,212,191,.3); }
  50%      { box-shadow: 0 0 80px rgba(45,212,191,.55); }
}

.auth-brand-title {
  font-family: 'Sora', sans-serif;
  font-size: 32px;
  font-weight: 800;
  text-align: center;
  line-height: 1.2;
  margin-bottom: 16px;
}

.auth-brand-title span { color: var(--teal-400); }

.auth-brand-desc {
  color: var(--text-secondary);
  text-align: center;
  font-size: 15px;
  max-width: 340px;
  line-height: 1.7;
}

.auth-features { margin-top: 36px; display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 340px; }
.auth-feature {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--text-secondary);
}
.auth-feature-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--teal-400);
  flex-shrink: 0;
  box-shadow: 0 0 8px var(--teal-400);
}

.auth-form-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 32px;
  overflow-y: auto;
}

.auth-form-box { width: 100%; max-width: 420px; }

.auth-form-header { margin-bottom: 32px; }
.auth-form-header h2 { font-size: 28px; font-weight: 800; }
.auth-form-header p { color: var(--text-secondary); margin-top: 6px; font-size: 15px; }

.auth-divider {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  margin: 20px 0;
  position: relative;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: calc(50% - 24px);
  height: 1px;
  background: var(--border);
}
.auth-divider::before { left: 0; }
.auth-divider::after  { right: 0; }

.auth-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 14px;
  color: var(--text-secondary);
}

.remember-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.remember-row label { margin: 0; display: flex; align-items: center; gap: 7px; cursor: pointer; font-size: 13px; }
.remember-row input[type=checkbox] { width: auto; }
.forgot-link { font-size: 13px; }

/* Paso recuperación */
.step-indicator {
  display: flex;
  gap: 8px;
  margin-bottom: 28px;
  align-items: center;
}
.step-dot {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  border: 2px solid var(--border);
  color: var(--text-muted);
  background: transparent;
  transition: all var(--transition);
}
.step-dot.active { border-color: var(--teal-500); color: var(--teal-400); background: var(--teal-glow); }
.step-dot.done   { border-color: var(--success); color: #fff; background: var(--success); }
.step-line { flex: 1; height: 2px; background: var(--border); border-radius: 99px; }

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-brand-panel { display: none; }
  .form-row { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .hamburger { display: block; }

  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-overlay.visible { display: block; }

  .main-wrapper { margin-left: 0; }

  .page-content { padding: 16px; }

  .stats-grid { grid-template-columns: 1fr 1fr; }

  .topbar { padding: 0 16px; }

  .table-top { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .auth-form-panel { padding: 24px 16px; }
}

/* ── Misc utilities ────────────────────────────────────────── */
.text-muted    { color: var(--text-secondary); }
.text-teal     { color: var(--teal-400); }
.text-amber    { color: var(--amber-400); }
.text-danger   { color: var(--danger); }
.text-success  { color: var(--success); }
.text-sm       { font-size: 13px; }
.fw-bold       { font-weight: 700; }
.mb-0          { margin-bottom: 0; }
.mt-1          { margin-top: 8px; }
.mt-2          { margin-top: 16px; }
.mt-3          { margin-top: 24px; }
.flex          { display: flex; }
.flex-center   { display: flex; align-items: center; justify-content: center; }
.gap-2         { gap: 8px; }
.gap-3         { gap: 12px; }
.w-full        { width: 100%; }
.d-none        { display: none; }
