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

/* ==========================================
   CHIVAFEST — Design System
   Feria de Flores Medellín
   ========================================== */

:root {
  /* Brand Colors */
  --primary: #e91e7a;
  --primary-dark: #b5135d;
  --primary-light: #ff4fa3;
  --primary-glow: rgba(233, 30, 122, 0.25);

  --secondary: #ff9800;
  --secondary-dark: #e65100;
  --accent: #9c27b0;
  --accent-dark: #6a0080;

  /* Status Colors */
  --success: #00e676;
  --success-bg: rgba(0, 230, 118, 0.12);
  --warning: #ffd740;
  --warning-bg: rgba(255, 215, 64, 0.12);
  --danger: #ff5252;
  --danger-bg: rgba(255, 82, 82, 0.12);
  --info: #40c4ff;
  --info-bg: rgba(64, 196, 255, 0.12);

  /* Dark Backgrounds */
  --bg-base: #0a0a0f;
  --bg-card: #12121a;
  --bg-card-hover: #1a1a26;
  --bg-sidebar: #0d0d16;
  --bg-glass: rgba(18, 18, 26, 0.85);
  --bg-input: rgba(255,255,255,0.06);
  --bg-input-focus: rgba(255,255,255,0.1);

  /* Borders */
  --border: rgba(255,255,255,0.08);
  --border-bright: rgba(255,255,255,0.15);
  --border-primary: rgba(233, 30, 122, 0.4);

  /* Text */
  --text-primary: #f0f0f8;
  --text-secondary: #9090b0;
  --text-muted: #5a5a7a;
  --text-inverse: #0a0a0f;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 24px rgba(0,0,0,0.5);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.6);
  --shadow-glow: 0 0 30px var(--primary-glow);

  /* Sidebar */
  --sidebar-width: 260px;
  --topbar-height: 64px;

  /* Transitions */
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================
   RESET & BASE
   ========================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0;}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ==========================================
   TYPOGRAPHY
   ========================================== */
h1, h2, h3, h4, h5, h6 { font-weight: 700; line-height: 1.2; }
h1 { font-size: clamp(1.8rem, 4vw, 2.5rem); }
h2 { font-size: clamp(1.4rem, 3vw, 1.8rem); }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }
p { color: var(--text-secondary); }
a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-light); }

/* ==========================================
   SCROLLBAR
   ========================================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.3); }

/* ==========================================
   LAYOUT
   ========================================== */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform var(--transition-slow);
  overflow-y: auto;
}

.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  height: var(--topbar-height);
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-xl);
  z-index: 50;
}

.page-content {
  flex: 1;
  padding: var(--space-xl);
  max-width: 1400px;
  width: 100%;
}

/* ==========================================
   SIDEBAR COMPONENTS
   ========================================== */
.sidebar-logo {
  padding: var(--space-xl) var(--space-lg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.sidebar-logo .logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  box-shadow: var(--shadow-glow);
  flex-shrink: 0;
}

.sidebar-logo .logo-text {
  display: flex;
  flex-direction: column;
}
.sidebar-logo .logo-text strong {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}
.sidebar-logo .logo-text span {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sidebar-nav {
  flex: 1;
  padding: var(--space-md) 0;
}

.nav-section-title {
  padding: var(--space-md) var(--space-lg) var(--space-xs);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px var(--space-lg);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition);
  cursor: pointer;
  border-left: 3px solid transparent;
  text-decoration: none;
  position: relative;
}

.nav-link:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.04);
}

.nav-link.active {
  color: var(--primary-light);
  background: rgba(233, 30, 122, 0.1);
  border-left-color: var(--primary);
}

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

.nav-badge {
  margin-left: auto;
  background: var(--primary);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  min-width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--border);
}

.user-card {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition);
}
.user-card:hover { background: var(--bg-input); }

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: white;
  flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }
.user-info strong {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-info span {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: capitalize;
}

/* ==========================================
   CARDS
   ========================================== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}
.card:hover {
  border-color: var(--border-bright);
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* Stat Cards */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.stat-card.primary::before { background: linear-gradient(90deg, var(--primary), var(--primary-light)); }
.stat-card.secondary::before { background: linear-gradient(90deg, var(--secondary), #ffcc80); }
.stat-card.success::before { background: linear-gradient(90deg, var(--success), #69f0ae); }
.stat-card.danger::before { background: linear-gradient(90deg, var(--danger), #ff8a80); }
.stat-card.accent::before { background: linear-gradient(90deg, var(--accent), #ce93d8); }

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

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.stat-icon.primary { background: rgba(233,30,122,0.15); }
.stat-icon.secondary { background: rgba(255,152,0,0.15); }
.stat-icon.success { background: rgba(0,230,118,0.15); }
.stat-icon.danger { background: rgba(255,82,82,0.15); }
.stat-icon.accent { background: rgba(156,39,176,0.15); }

.stat-info { flex: 1; }
.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 4px;
}
.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ==========================================
   BUTTONS
   ========================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 10px var(--space-md);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 0 4px 15px var(--primary-glow);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--primary-glow);
}

.btn-secondary {
  background: rgba(255,255,255,0.08);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover:not(:disabled) {
  background: rgba(255,255,255,0.12);
  border-color: var(--border-bright);
}

.btn-success {
  background: linear-gradient(135deg, #00c853, #00e676);
  color: var(--text-inverse);
}
.btn-success:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 4px 15px rgba(0,230,118,0.3); }

.btn-danger {
  background: linear-gradient(135deg, #c62828, var(--danger));
  color: white;
}
.btn-danger:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 4px 15px rgba(255,82,82,0.3); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) { color: var(--text-primary); background: var(--bg-input); }

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-lg { padding: 14px 24px; font-size: 1rem; }
.btn-icon { padding: 8px; width: 36px; height: 36px; justify-content: center; }
.btn-full { width: 100%; justify-content: center; }

/* ==========================================
   FORMS
   ========================================== */
.form-group { margin-bottom: var(--space-md); }
.form-row { display: grid; gap: var(--space-md); grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-control {
  width: 100%;
  padding: 10px var(--space-md);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  transition: all var(--transition);
  appearance: none;
}

.form-control:focus {
  outline: none;
  background: var(--bg-input-focus);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-control::placeholder { color: var(--text-muted); }

select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239090b0' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

textarea.form-control { min-height: 80px; resize: vertical; }

.form-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 0.75rem; color: var(--danger); margin-top: 4px; display: none; }
.form-control.error { border-color: var(--danger); }
.form-control.error + .form-error { display: block; }

/* ==========================================
   TABLES
   ========================================== */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.table thead th {
  background: rgba(255,255,255,0.04);
  padding: 12px var(--space-md);
  text-align: left;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

.table tbody tr:last-child { border-bottom: none; }
.table tbody tr:hover { background: rgba(255,255,255,0.03); }

.table tbody td {
  padding: 14px var(--space-md);
  color: var(--text-primary);
  vertical-align: middle;
}

/* ==========================================
   BADGES & STATUS
   ========================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.badge-pendiente { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(255,215,64,0.3); }
.badge-aprobada { background: var(--success-bg); color: var(--success); border: 1px solid rgba(0,230,118,0.3); }
.badge-rechazada { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(255,82,82,0.3); }
.badge-cancelada { background: rgba(255,255,255,0.05); color: var(--text-muted); border: 1px solid var(--border); }
.badge-pagado { background: var(--success-bg); color: var(--success); border: 1px solid rgba(0,230,118,0.3); }
.badge-parcial { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(255,215,64,0.3); }

/* Availability indicator */
.avail-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 4px;
}
.avail-full { background: var(--danger); box-shadow: 0 0 6px var(--danger); }
.avail-low { background: var(--warning); box-shadow: 0 0 6px var(--warning); }
.avail-good { background: var(--success); box-shadow: 0 0 6px var(--success); }

/* ==========================================
   MODALS
   ========================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(20px) scale(0.98);
  transition: transform var(--transition);
  box-shadow: var(--shadow-lg);
}

.modal-overlay.active .modal {
  transform: translateY(0) scale(1);
}

.modal-lg { max-width: 720px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  width: 32px; height: 32px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 1rem;
  transition: all var(--transition);
}
.modal-close:hover { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border);
}

/* ==========================================
   ALERTS / TOASTS
   ========================================== */
.toast-container {
  position: fixed;
  bottom: var(--space-xl);
  right: var(--space-xl);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 12px var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-md);
  min-width: 280px;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  pointer-events: all;
  animation: slideInToast 0.3s ease;
  font-size: 0.875rem;
  font-weight: 500;
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.warning { border-left: 4px solid var(--warning); }
.toast.info { border-left: 4px solid var(--info); }

@keyframes slideInToast {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ==========================================
   PAGE HEADER
   ========================================== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.page-header-left h1 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.page-header-left p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ==========================================
   GRID UTILITIES
   ========================================== */
.grid { display: grid; gap: var(--space-lg); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid-stats { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

/* ==========================================
   AVAILABILITY CARDS (Comercial View)
   ========================================== */
.chiva-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition);
}

.chiva-card:hover {
  border-color: var(--border-bright);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.chiva-card-header {
  padding: var(--space-md) var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  border-bottom: 1px solid var(--border);
}

.chiva-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.horario-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px var(--space-lg);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

.horario-item:last-child { border-bottom: none; }
.horario-item:hover { background: rgba(255,255,255,0.02); }

.horario-time {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.cupos-bar {
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin: 4px 0;
}

.cupos-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.5s ease;
}

.cupos-bar-fill.good { background: var(--success); }
.cupos-bar-fill.low { background: var(--warning); }
.cupos-bar-fill.full { background: var(--danger); }

/* ==========================================
   FILTERS BAR
   ========================================== */
.filters-bar {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-bottom: var(--space-lg);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
}

.filters-bar .form-control {
  flex: 1;
  min-width: 140px;
}

/* ==========================================
   EMPTY STATE
   ========================================== */
.empty-state {
  text-align: center;
  padding: var(--space-3xl) var(--space-xl);
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: var(--space-md); opacity: 0.5; }
.empty-state h3 { color: var(--text-secondary); margin-bottom: var(--space-xs); }
.empty-state p { font-size: 0.875rem; }

/* ==========================================
   LOADING
   ========================================== */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.15);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-3xl);
}

/* ==========================================
   LOGIN PAGE
   ========================================== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  position: relative;
  overflow: hidden;
}

.login-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(233,30,122,0.15) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(156,39,176,0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 60% 80%, rgba(255,152,0,0.08) 0%, transparent 50%);
  pointer-events: none;
}

.login-card {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
  box-shadow: var(--shadow-lg);
}

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  :root { --sidebar-width: 0px; }

  .sidebar {
    transform: translateX(-260px);
    width: 260px;
  }

  .sidebar.open {
    transform: translateX(0);
  }

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

  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .grid-stats { grid-template-columns: repeat(2, 1fr); }

  .page-content { padding: var(--space-md); }

  .page-header { flex-direction: column; align-items: flex-start; }

  .topbar { padding: 0 var(--space-md); }
}

@media (max-width: 480px) {
  .grid-stats { grid-template-columns: 1fr; }
  .login-card { margin: var(--space-md); padding: var(--space-lg); }
}

/* ==========================================
   ANIMATIONS
   ========================================== */
@keyframes fadeIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.animate-in { animation: fadeIn 0.3s ease both; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.animate-pulse { animation: pulse 2s ease infinite; }

/* Stagger children */
.stagger-children > * {
  animation: fadeIn 0.3s ease both;
}
.stagger-children > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.1s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.2s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.25s; }
.stagger-children > *:nth-child(6) { animation-delay: 0.3s; }

/* Gradient text */
.gradient-text {
  background: linear-gradient(135deg, var(--primary-light), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Divider */
.divider {
  height: 1px;
  background: var(--border);
  margin: var(--space-lg) 0;
}

/* Hidden */
.hidden { display: none !important; }
.visible { display: flex !important; }

/* Mobile menu toggle */
.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--bg-input);
  border: 1px solid var(--border);
  cursor: pointer;
  color: var(--text-primary);
  font-size: 1.1rem;
  transition: all var(--transition);
}

@media (max-width: 768px) {
  .menu-toggle { display: flex; }
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
  backdrop-filter: blur(2px);
}

.sidebar-overlay.active { display: block; }


/* ==========================================
   LIGHT THEME — ChivaFest
   ========================================== */
[data-theme="light"] {
  --bg-base:        #f0f0f8;
  --bg-card:        #ffffff;
  --bg-card-hover:  #f5f5fc;
  --bg-glass:       rgba(255,255,255,0.92);
  --bg-input:       rgba(0,0,0,0.05);
  --bg-input-focus: rgba(0,0,0,0.09);
  --border:         rgba(0,0,0,0.09);
  --border-bright:  rgba(0,0,0,0.16);
  --text-primary:   #14142a;
  --text-secondary: #44446a;
  --text-muted:     #7a7a9a;
  --text-inverse:   #ffffff;
  --shadow-sm:  0 2px 8px  rgba(0,0,0,0.06);
  --shadow-md:  0 4px 24px rgba(0,0,0,0.08);
  --shadow-lg:  0 8px 40px rgba(0,0,0,0.10);
  --shadow-glow:0 0 30px rgba(233,30,122,0.12);
  --success-bg: rgba(0,200,83,0.10);
  --warning-bg: rgba(255,152,0,0.10);
  --danger-bg:  rgba(255,82,82,0.10);
  --info-bg:    rgba(64,196,255,0.10);
}

/* Fondo del área de contenido */
[data-theme="light"] .main-content,
[data-theme="light"] .topbar,
[data-theme="light"] .page-content { background: var(--bg-base); }

/* Tabla */
[data-theme="light"] .table thead th {
  background: rgba(0,0,0,0.04);
  color: var(--text-secondary);
  border-color: var(--border);
}
[data-theme="light"] .table td { border-color: var(--border); }
[data-theme="light"] .table tbody tr:hover td { background: rgba(233,30,122,0.04); }

/* Inputs y selects */
[data-theme="light"] input:not([type=checkbox]):not([type=radio]),
[data-theme="light"] select,
[data-theme="light"] textarea {
  background: #fff !important;
  color: var(--text-primary) !important;
  border-color: var(--border) !important;
}
[data-theme="light"] input::placeholder,
[data-theme="light"] textarea::placeholder { color: var(--text-muted) !important; }

/* Nav links */
[data-theme="light"] .nav-link { color: rgba(255,255,255,0.7); }
[data-theme="light"] .nav-link.active,
[data-theme="light"] .nav-link:hover { color: #fff; }

/* Badge & chips */
[data-theme="light"] .badge-pendiente  { background:rgba(255,152,0,0.15);  color:#e65100; }
[data-theme="light"] .badge-aprobada   { background:rgba(0,200,83,0.15);   color:#00873d; }
[data-theme="light"] .badge-rechazada  { background:rgba(255,82,82,0.15);  color:#c62828; }
[data-theme="light"] .badge-cancelada  { background:rgba(90,90,90,0.12);   color:#555; }

/* Modal */
[data-theme="light"] .modal {
  background: #fff;
  color: var(--text-primary);
}
[data-theme="light"] .modal-header { border-color: var(--border); }

/* Scrollbar */
[data-theme="light"] ::-webkit-scrollbar-track { background: #e8e8f0; }
[data-theme="light"] ::-webkit-scrollbar-thumb { background: #c0c0d0; }

/* ── Sidebar en modo claro ───────────────────── */
[data-theme="light"] .sidebar {
  background: #ffffff;
  border-right: 1px solid rgba(0,0,0,0.08);
}
[data-theme="light"] .sidebar-logo strong { color: #14142a; }
[data-theme="light"] .sidebar-logo span   { color: #7a7a9a; }
[data-theme="light"] .nav-section-title   { color: #9a9aba; }
[data-theme="light"] .nav-link            { color: #44446a; }
[data-theme="light"] .nav-link:hover      {
  background: rgba(233,30,122,0.08);
  color: var(--primary);
}
[data-theme="light"] .nav-link.active {
  background: rgba(233,30,122,0.12);
  color: var(--primary);
}
[data-theme="light"] .sidebar-footer {
  border-top: 1px solid rgba(0,0,0,0.08);
}
[data-theme="light"] #user-name   { color: #14142a; }
[data-theme="light"] #user-role   { color: #7a7a9a; }
[data-theme="light"] .sidebar-overlay { background: rgba(0,0,0,0.3); }

/* Fix dropdown options en dark mode */
select option {
  background: var(--bg-card, #1e1e3a);
  color: var(--text-primary, #e0e0f0);
}
[data-theme="light"] select option {
  background: #ffffff;
  color: #1a1a2e;
}


/* ==========================================
   RESPONSIVE TABLES - Card layout mobile
   ========================================== */
.table-wrapper { -webkit-overflow-scrolling: touch; max-width: 100%; }
.table { min-width: 580px; }

@media (max-width: 640px) {
  .table { min-width: unset; }
  .table-wrapper { border-radius: 0; border-left: none; border-right: none; }
  .table-card-mobile thead { display: none; }
  .table-card-mobile tbody tr {
    display: block;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 10px;
    background: var(--bg-card);
    overflow: hidden;
  }
  .table-card-mobile tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
    gap: 12px;
    min-height: 42px;
  }
  .table-card-mobile tbody td:last-child { border-bottom: none; }
  .table-card-mobile tbody td::before {
    content: attr(data-label);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    flex-shrink: 0;
    min-width: 90px;
  }
  .table-card-mobile tbody td[data-label="Acciones"] { justify-content: flex-end; }
  .table-card-mobile tbody td[data-label="Acciones"]::before { display: none; }
}

/* Fix overflow en cards responsive */
@media (max-width: 640px) {
  .table-card-mobile tbody td > * {
    min-width: 0;
    max-width: 100%;
  }
  /* Pago: columna vertical en móvil para que los precios no desborden */
  .table-card-mobile tbody td[data-label="Pago"] {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .table-card-mobile tbody td[data-label="Pago"]::before {
    min-width: unset;
  }
  /* Precio detail oculto en móvil */
  .table-card-mobile tbody td[data-label="Pago"] > div[style*="background:#f9f9f9"] {
    display: none;
  }
  /* Acciones: wrap de botones */
  .table-card-mobile tbody td[data-label="Acciones"] > div {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
}

/* ==========================================
   FIX: Grids inline en modales → 1 columna en móvil
   ========================================== */
@media (max-width: 640px) {
  /* Colapsar grids de 2 columnas en modales */
  div[style*="grid-template-columns:1fr 1fr"],
  div[style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
  div[style*="grid-template-columns:auto 1fr"],
  div[style*="grid-template-columns: auto 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* Modales: asegurar que no excedan la pantalla */
  .modal {
    margin: var(--space-sm);
    max-height: 92vh;
    overflow-y: auto;
  }

  /* Tabla de lista pasajeros dentro de los modales */
  #lista-view-modal table,
  #lista-view-modal-mr table {
    font-size: 0.78rem;
  }
  /* Ocultar columnas menos importantes en móvil */
  #lista-view-modal table th:nth-child(3),
  #lista-view-modal table td:nth-child(3),
  #lista-view-modal table th:nth-child(5),
  #lista-view-modal table td:nth-child(5),
  #lista-view-modal table th:nth-child(6),
  #lista-view-modal table td:nth-child(6),
  #lista-view-modal-mr table th:nth-child(3),
  #lista-view-modal-mr table td:nth-child(3),
  #lista-view-modal-mr table th:nth-child(5),
  #lista-view-modal-mr table td:nth-child(5),
  #lista-view-modal-mr table th:nth-child(6),
  #lista-view-modal-mr table td:nth-child(6) { display: none; }

  /* Modal footer en móvil */
  .modal-footer { flex-wrap: wrap; gap: 8px; }
  .modal-footer .btn { flex: 1; min-width: 120px; }
}
