/* ===========================================================================
   Dotaciones Dony — Sistema de diseño futurista
   Tema oscuro con gradientes neón, glassmorphism y micro-interacciones.
   =========================================================================== */

:root {
  /* Paleta base */
  --bg-0: #05060f;
  --bg-1: #0b0d1f;
  --bg-2: #111430;

  /* Gradientes neón */
  --grad-1: linear-gradient(135deg, #7c3aed 0%, #4f46e5 50%, #06b6d4 100%);
  --grad-2: linear-gradient(135deg, #ec4899 0%, #8b5cf6 50%, #22d3ee 100%);
  --grad-accent: linear-gradient(120deg, #a855f7, #6366f1, #06b6d4);
  --grad-glow: radial-gradient(circle at 20% 20%, rgba(124, 58, 237, 0.35), transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(6, 182, 212, 0.3), transparent 40%);

  /* Acentos */
  --violet: #8b5cf6;
  --cyan: #22d3ee;
  --pink: #ec4899;
  --indigo: #6366f1;

  /* Texto */
  --text-hi: #f4f5ff;
  --text-mid: #a5a8c9;
  --text-low: #6b6f92;

  /* Superficies */
  --glass: rgba(255, 255, 255, 0.04);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-hi: rgba(255, 255, 255, 0.08);

  /* Estados */
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #fb7185;
  --info: #38bdf8;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.6);
  --font-display: "Space Grotesk", "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--text-hi);
  background-color: var(--bg-0);
  background-image: var(--grad-glow);
  background-attachment: fixed;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  letter-spacing: 0.01em;
}

/* Fondo animado sutil */
.bg-aurora {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: var(--bg-0);
}
.bg-aurora::before,
.bg-aurora::after {
  content: "";
  position: absolute;
  width: 60vmax;
  height: 60vmax;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
  animation: float 18s ease-in-out infinite alternate;
}
.bg-aurora::before {
  background: radial-gradient(circle, rgba(124, 58, 237, 0.55), transparent 60%);
  top: -20%;
  left: -10%;
}
.bg-aurora::after {
  background: radial-gradient(circle, rgba(6, 182, 212, 0.5), transparent 60%);
  bottom: -20%;
  right: -10%;
  animation-delay: -9s;
}

@keyframes float {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(6%, -8%, 0) scale(1.15); }
}

h1, h2, h3, h4 { font-family: var(--font-display); letter-spacing: -0.01em; margin: 0 0 0.5rem; }

a { color: var(--cyan); text-decoration: none; transition: color 0.2s ease; }
a:hover { color: #7dd3fc; }

/* Texto con gradiente */
.text-grad {
  background: var(--grad-accent);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

/* ---------------------------------------------------------------------------
   Botones
   --------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.4rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease;
  text-align: center;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--grad-1);
  color: #fff;
  box-shadow: 0 10px 30px -10px rgba(99, 102, 241, 0.7);
}
.btn-primary:hover { filter: brightness(1.1); color: #fff; box-shadow: 0 14px 36px -10px rgba(99, 102, 241, 0.9); }

.btn-ghost {
  background: var(--glass);
  border-color: var(--glass-border);
  color: var(--text-hi);
  backdrop-filter: blur(12px);
}
.btn-ghost:hover { background: var(--glass-hi); color: var(--text-hi); }

.btn-sm { padding: 0.45rem 1rem; font-size: 0.85rem; }
.btn-block { width: 100%; justify-content: center; }

/* ---------------------------------------------------------------------------
   Tarjetas glassmorphism
   --------------------------------------------------------------------------- */
.card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.card:hover { border-color: rgba(139, 92, 246, 0.4); }
.card-hover:hover { transform: translateY(-4px); }

/* ---------------------------------------------------------------------------
   Layout del panel
   --------------------------------------------------------------------------- */
.shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }

.sidebar {
  padding: 1.5rem 1.25rem;
  border-right: 1px solid var(--glass-border);
  background: rgba(5, 6, 15, 0.6);
  backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.25rem 0.5rem 1.25rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
}
.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--grad-2);
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #fff;
  box-shadow: 0 8px 20px -6px rgba(236, 72, 153, 0.7);
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-sm);
  color: var(--text-mid);
  font-weight: 500;
}
.nav-link:hover { background: var(--glass-hi); color: var(--text-hi); }
.nav-link.active {
  background: linear-gradient(120deg, rgba(139, 92, 246, 0.18), rgba(6, 182, 212, 0.14));
  color: var(--text-hi);
  box-shadow: inset 0 0 0 1px rgba(139, 92, 246, 0.35);
}
.nav-link .ico { width: 20px; text-align: center; opacity: 0.85; }

.sidebar-foot { margin-top: auto; border-top: 1px solid var(--glass-border); padding-top: 1rem; }

.main { padding: 2rem; max-width: 1200px; width: 100%; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  gap: 1rem;
}

/* Chips / badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  color: var(--text-mid);
}
.badge-ok { color: var(--ok); border-color: rgba(52, 211, 153, 0.35); background: rgba(52, 211, 153, 0.08); }
.badge-warn { color: var(--warn); border-color: rgba(251, 191, 36, 0.35); background: rgba(251, 191, 36, 0.08); }
.badge-danger { color: var(--danger); border-color: rgba(251, 113, 133, 0.35); background: rgba(251, 113, 133, 0.08); }
.badge-info { color: var(--info); border-color: rgba(56, 189, 248, 0.35); background: rgba(56, 189, 248, 0.08); }

/* Grid responsive */
.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* Stat cards */
.stat .stat-label { color: var(--text-mid); font-size: 0.85rem; }
.stat .stat-value { font-family: var(--font-display); font-size: 2rem; font-weight: 700; margin-top: 0.25rem; }
.stat .stat-delta { font-size: 0.8rem; }

/* ---------------------------------------------------------------------------
   Tablas
   --------------------------------------------------------------------------- */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left;
  color: var(--text-low);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--glass-border);
}
.table td { padding: 0.85rem 0.9rem; border-bottom: 1px solid rgba(255, 255, 255, 0.04); font-size: 0.92rem; }
.table tbody tr { transition: background 0.15s ease; }
.table tbody tr:hover { background: var(--glass); }

/* ---------------------------------------------------------------------------
   Formularios
   --------------------------------------------------------------------------- */
.field { margin-bottom: 1.1rem; }
.label { display: block; font-size: 0.85rem; color: var(--text-mid); margin-bottom: 0.4rem; font-weight: 500; }
.input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-hi);
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.input::placeholder { color: var(--text-low); }
.input:focus {
  outline: none;
  border-color: var(--violet);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.25);
}

/* ---------------------------------------------------------------------------
   Página de login / landing
   --------------------------------------------------------------------------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.auth-card { width: 100%; max-width: 420px; }
.auth-logo { text-align: center; margin-bottom: 1.5rem; }

.hero { min-height: 100vh; display: flex; align-items: center; padding: 2rem; }
.hero-inner { max-width: 640px; }
.hero-title { font-size: clamp(2.4rem, 6vw, 4.2rem); line-height: 1.05; font-weight: 800; }
.hero-sub { color: var(--text-mid); font-size: 1.15rem; margin: 1.25rem 0 2rem; }

/* Mensajes de Django */
.messages { list-style: none; padding: 0; margin: 0 0 1.25rem; }
.messages li {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  font-size: 0.9rem;
}
.messages li.error { color: var(--danger); border-color: rgba(251, 113, 133, 0.4); }
.messages li.success { color: var(--ok); border-color: rgba(52, 211, 153, 0.4); }

/* Errores de formulario */
.errorlist { list-style: none; padding: 0; margin: 0 0 1rem; color: var(--danger); font-size: 0.85rem; }

/* ---------------------------------------------------------------------------
   Responsive
   --------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; gap: 0.4rem; }
  .sidebar .nav-link { flex: 1 1 auto; }
  .brand { width: 100%; }
  .sidebar-foot { width: 100%; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .main { padding: 1.25rem; }
}

/* ---------------------------------------------------------------------------
   Componentes de formulario
   --------------------------------------------------------------------------- */
.help { font-size: 0.78rem; color: var(--text-low); margin-top: 0.3rem; }
.field-error { font-size: 0.8rem; color: var(--danger); margin-top: 0.3rem; }
.required-mark { color: var(--pink); }

.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 1.25rem; }
.form-grid .full { grid-column: 1 / -1; }

.section-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  margin: 1.5rem 0 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--glass-border); }

/* Checkbox grid (atributos / valores) */
.checkbox-grid { display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 0; margin: 0; }
.checkbox-grid li { list-style: none; }
.checkbox-grid label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  background: var(--glass);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.15s ease;
}
.checkbox-grid label:hover { border-color: var(--violet); }
.checkbox-grid input { accent-color: var(--violet); }

/* Switch / toggle */
.switch-wrap { display: inline-flex; align-items: center; gap: 0.6rem; cursor: pointer; user-select: none; }
.switch-wrap input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 44px; height: 24px;
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
  position: relative;
  cursor: pointer;
  transition: background 0.2s ease;
  flex-shrink: 0;
}
.switch-wrap input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s ease;
}
.switch-wrap input[type="checkbox"]:checked { background: var(--grad-1); }
.switch-wrap input[type="checkbox"]:checked::after { transform: translateX(20px); }

/* Card de variante */
.variant-card {
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  background: rgba(0,0,0,0.15);
  margin-bottom: 1rem;
}
.variant-card .variant-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
}

.textarea { width: 100%; padding: 0.75rem 1rem; background: rgba(0,0,0,0.25); border: 1px solid var(--glass-border); border-radius: var(--radius-sm); color: var(--text-hi); font-family: var(--font-body); font-size: 0.95rem; }
.textarea:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 3px rgba(139,92,246,0.25); }

.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-mid); }
.empty-state .ico { font-size: 2.5rem; display: block; margin-bottom: 0.75rem; opacity: 0.6; }

/* Grupo de navegación en el sidebar */
.nav-group { display: flex; flex-direction: column; gap: 0.15rem; margin: 0.4rem 0; }
.nav-group-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-low);
  padding: 0.5rem 0.9rem 0.25rem;
}
.nav-group .nav-link { padding-left: 1.1rem; font-size: 0.9rem; }

/* ---------------------------------------------------------------------------
   Gráficas (barras CSS)
   --------------------------------------------------------------------------- */
.chart-v { display: flex; align-items: flex-end; gap: 6px; height: 180px; padding-top: 0.5rem; }
.chart-v .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.chart-v .bar { width: 100%; max-width: 34px; background: var(--grad-1); border-radius: 6px 6px 0 0; min-height: 2px; transition: height 0.3s ease; }
.chart-v .col:hover .bar { filter: brightness(1.25); }
.chart-v .lbl { font-size: 0.62rem; color: var(--text-low); writing-mode: vertical-rl; transform: rotate(180deg); }
.chart-v .val { font-size: 0.62rem; color: var(--text-mid); }

.hbar-row { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.6rem; }
.hbar-row .name { width: 160px; font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { flex: 1; height: 10px; background: rgba(255,255,255,0.06); border-radius: 999px; overflow: hidden; }
.hbar-fill { height: 100%; background: var(--grad-2); border-radius: 999px; }
.hbar-row .qty { width: 48px; text-align: right; font-size: 0.85rem; color: var(--text-mid); }

.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.25rem; }
@media (max-width: 900px) { .kpi-grid { grid-template-columns: 1fr 1fr; } }
