/* ============================================================
   MODERN DASHBOARD — Glassmorphism + Neumorphism
   Paleta Pastel Premium | Animaciones suaves
   ============================================================ */

/* ─── 1. PALETA DE COLORES PASTEL ──────────────────────────── */
:root {
  /* Primario */
  --primary: #7c5dfa;
  --primary-hover: #6d50e8;
  --primary-light: #b794f6;
  --primary-soft: rgba(124, 93, 250, 0.12);
  --primary-glow: rgba(124, 93, 250, 0.35);
  
  /* Acentos pastel */
  --accent-pink: #ff6b9d;
  --accent-pink-light: #ff9dd1;
  --accent-blue: #4facf1;
  --accent-blue-light: #7dd3fc;
  --accent-green: #51cf66;
  --accent-yellow: #ffa94d;
  
  /* Gradientes premium */
  --gradient-main: linear-gradient(135deg, #7c5dfa 0%, #ff6b9d 50%, #4facf1 100%);
  --gradient-purple: linear-gradient(135deg, #7c5dfa, #9f7aea);
  --gradient-pink: linear-gradient(135deg, #ff6b9d, #ff9dd1);
  --gradient-blue: linear-gradient(135deg, #4facf1, #7dd3fc);
  --gradient-soft: linear-gradient(135deg, rgba(124, 93, 250, 0.08), rgba(255, 107, 157, 0.08));
  
  /* Neutrales */
  --bg-primary: #fafbfe;
  --bg-secondary: #f5f7fb;
  --bg-tertiary: #f0f2f8;
  --fg-primary: #1a1f3a;
  --fg-secondary: #4b5563;
  --fg-muted: #9ca3af;
  
  /* Cards y componentes */
  --card-bg: #ffffff;
  --card-border: rgba(124, 93, 250, 0.1);
  --muted: #f3f4f6;
  --border: #e5e7eb;
  
  /* Sombras suaves (neumorphism) */
  --shadow-xs: 0 1px 2px rgba(124, 93, 250, 0.04);
  --shadow-sm: 0 2px 8px rgba(124, 93, 250, 0.08);
  --shadow-md: 0 8px 16px rgba(124, 93, 250, 0.12);
  --shadow-lg: 0 12px 32px rgba(124, 93, 250, 0.15);
  --shadow-xl: 0 20px 48px rgba(124, 93, 250, 0.18);
  
  /* Radios */
  --radius-xs: 0.5rem;
  --radius-sm: 0.875rem;
  --radius-md: 1.25rem;
  --radius-lg: 1.75rem;
  --radius-full: 9999px;
  
  /* Tipografía */
  --font-sans: 'Lexend', -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', monospace;
}

.dark {
  --bg-primary: #0f1117;
  --bg-secondary: #1a1f2e;
  --bg-tertiary: #2d3748;
  --fg-primary: #e5e7eb;
  --fg-secondary: #d1d5db;
  --fg-muted: #9ca3af;
  --card-bg: #1a1f2e;
  --card-border: rgba(183, 148, 246, 0.1);
  --muted: #2d3748;
  --border: #404854;
  --shadow-sm: 0 2px 8px rgba(124, 93, 250, 0.12);
  --shadow-md: 0 8px 16px rgba(124, 93, 250, 0.15);
}

/* ─── 2. RESET Y ESTILOS BASE ──────────────────────────────── */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  color: var(--fg-primary);
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 50%, var(--bg-tertiary) 100%);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Fondo con ondas animadas sutiles */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 120"%3E%3Cpath d="M0,64 Q360,16 720,64 T1440,64 L1440,120 L0,120 Z" fill="rgba(124,93,250,0.04)"/%3E%3C/svg%3E');
  background-size: 100% auto;
  background-position: 0 0;
  pointer-events: none;
  z-index: -1;
  opacity: 0.8;
  animation: wave 20s ease-in-out infinite;
}

@keyframes wave {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(3px); }
}

/* ─── 3. TIPOGRAFÍA Y UTILIDADES ──────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

h1 { font-size: 2.25rem; }
h2 { font-size: 1.875rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--primary-hover);
}

ul, ol {
  list-style: none;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  font-size: inherit;
  transition: all 0.2s ease;
}

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

/* ─── 4. COMPONENTES DE ANIMACIÓN ──────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-8px); }
}

.animate-fadeInUp {
  animation: fadeInUp 0.6s ease-out forwards;
}

.animate-pulse {
  animation: pulse 2s ease-in-out infinite;
}

.animate-float {
  animation: float 3s ease-in-out infinite;
}

/* ─── 5. GLASSMORPHISM Y NEUMORPHISM ──────────────────────── */
.glass {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(124, 93, 250, 0.1);
}

.dark .glass {
  background: rgba(26, 31, 46, 0.85);
  border: 1px solid rgba(183, 148, 246, 0.1);
}

.neumorphic {
  box-shadow: 
    6px 6px 14px rgba(124, 93, 250, 0.1),
    -6px -6px 14px rgba(255, 255, 255, 0.8);
}

.dark .neumorphic {
  box-shadow: 
    6px 6px 14px rgba(0, 0, 0, 0.3),
    -6px -6px 14px rgba(183, 148, 246, 0.08);
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

/* ─── 6. BOTONES MODERNOS ─────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.875rem;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
  outline: none;
}

.btn-primary {
  background: var(--gradient-purple);
  color: white;
  box-shadow: var(--shadow-md);
}

.btn-primary:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: var(--shadow-lg);
  filter: brightness(1.1);
}

.btn-primary:active {
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--muted);
  color: var(--fg-primary);
  border: 2px solid var(--border);
}

.btn-secondary:hover {
  background: var(--primary-soft);
  border-color: var(--primary);
  transform: translateY(-2px);
}

.btn-ghost {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
}

.btn-ghost:hover {
  background: var(--primary-soft);
}

.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--radius-sm);
  background: var(--muted);
  color: var(--fg-primary);
}

.btn-icon:hover {
  background: var(--primary-soft);
  color: var(--primary);
  transform: translateY(-2px);
}

/* ─── 7. INPUTS Y FORMULARIOS ──────────────────────────────– */
.input, .textarea, .select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  color: var(--fg-primary);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  transition: all 0.2s ease;
  outline: none;
}

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

.input:focus,
.textarea:focus,
.select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

/* ─── 8. LAYOUT PRINCIPAL ──────────────────────────────────– */
.app {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
  gap: 0;
}

.sidebar {
  grid-column: 1;
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--card-bg);
  border-right: 1px solid var(--card-border);
  overflow-y: auto;
  z-index: 40;
}

.main {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.main-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--card-bg);
  border-bottom: 1px solid var(--card-border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.main-content {
  flex: 1;
  padding: 2rem;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

/* ─── 9. SIDEBAR MODERNO MINIMALISTA ──────────────────────── */
.sidebar-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.75rem 1.5rem;
  border-bottom: 1px solid var(--card-border);
}

.sidebar-logo {
  width: 80px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: var(--gradient-purple);
  display: grid;
  place-items: center;
  color: white;
  font-weight: 800;
  font-size: 1.25rem;
  box-shadow: var(--shadow-sm);
  letter-spacing: -0.05em;
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sidebar-brand-name {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.sidebar-brand-role {
  font-size: 0.65rem;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-secondary);
  opacity: 0.6;
}

.sidebar-nav {
  padding: 1.25rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.nav-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.nav-section-title {
  font-size: 0.6rem;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--fg-muted);
  padding: 0.75rem 1rem;
  font-weight: 600;
  opacity: 0.6;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  color: var(--fg-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.25s ease;
  cursor: pointer;
  white-space: nowrap;
}

.nav-item:hover {
  color: var(--primary);
  background: var(--primary-soft);
  transform: translateX(3px);
}

.nav-item.active {
  color: var(--primary);
  background: linear-gradient(90deg, var(--primary-soft), transparent);
  border-left: 3px solid var(--primary);
  padding-left: calc(1rem - 3px);
  font-weight: 600;
}

.nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.nav-item:hover .nav-icon {
  opacity: 1;
  transform: scale(1.05);
}

.nav-badge {
  font-size: 0.6rem;
  font-family: var(--font-mono);
  font-weight: 700;
  background: var(--primary);
  color: white;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-full);
  line-height: 1;
  margin-left: auto;
}

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

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sidebar-user:hover {
  opacity: 0.8;
}

.sidebar-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--gradient-pink);
  display: grid;
  place-items: center;
  color: white;
  font-weight: 700;
  font-size: 0.875rem;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 0.65rem;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.6;
}

.sidebar-logout {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--fg-muted);
  transition: all 0.2s ease;
  opacity: 0.6;
  flex-shrink: 0;
}

.sidebar-logout:hover {
  opacity: 1;
  background: var(--primary-soft);
  color: var(--primary);
}

/* ─── 10. HEADER MODERNO ───────────────────────────────────– */
.header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1rem 2rem;
  height: 70px;
  overflow: hidden;
}

.header-search {
  flex: 1;
  max-width: 500px;
  position: relative;
}

.header-search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--fg-muted);
  pointer-events: none;
  opacity: 0.5;
}

.header-search-icon svg {
  width: 18px;
  height: 18px;
}

.header-search-input {
  width: 100%;
  height: 44px;
  padding: 0 1rem 0 2.75rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--muted);
  color: var(--fg-primary);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
  outline: none;
}

.header-search-input::placeholder {
  color: var(--fg-muted);
}

.header-search-input:focus {
  border-color: var(--primary);
  background: var(--card-bg);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.header-notif-btn {
  position: relative;
}

.notif-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-pink);
  border: 2px solid var(--card-bg);
  box-shadow: 0 0 8px var(--accent-pink);
  animation: pulse 2s ease-in-out infinite;
}

/* ─── 11. GRID Y TARJETAS ──────────────────────────────────– */
.grid {
  display: grid;
  gap: 1.25rem;
}

.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }

.grid-span-2 { grid-column: span 2; }
.grid-span-3 { grid-column: span 3; }

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.5rem;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--gradient-main);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

.stat-card:hover::before {
  opacity: 1;
}

.stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: var(--gradient-purple);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
}

.stat-subtext {
  font-size: 0.875rem;
  color: var(--fg-muted);
}

/* ─── 12. SECCIONES Y TÍTULOS ──────────────────────────────– */
.section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--fg-primary);
}

.section-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-family: var(--font-mono);
  background: var(--primary-soft);
  color: var(--primary);
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-full);
  font-weight: 600;
}

.section-body {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

/* ─── 13. LISTAS Y ITEMS ──────────────────────────────────– */
.list-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  transition: all 0.2s ease;
}

.list-item:last-child {
  border-bottom: none;
}

.list-item:hover {
  background: var(--muted);
}

.list-item-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--primary-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  flex-shrink: 0;
}

.list-item-content {
  flex: 1;
  min-width: 0;
}

.list-item-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--fg-primary);
}

.list-item-subtitle {
  font-size: 0.75rem;
  color: var(--fg-muted);
  margin-top: 0.25rem;
}

.list-item-meta {
  font-size: 0.75rem;
  color: var(--fg-muted);
  white-space: nowrap;
}

/* ─── 14. MODALES Y OVERLAYS ──────────────────────────────– */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(8px);
  z-index: 50;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  max-width: 500px;
  width: 100%;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

/* ─── 15. RESPONSIVE ──────────────────────────────────────– */
@media (max-width: 1024px) {
  .grid-cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
  .app {
    grid-template-columns: 1fr;
  }
  
  .sidebar {
    position: fixed;
    left: -280px;
    width: 280px;
    height: 100vh;
    transition: left 0.3s ease;
    box-shadow: var(--shadow-lg);
    z-index: 41;
  }
  
  .sidebar.active {
    left: 0;
  }
  
  .header {
    gap: 1rem;
    padding: 0.75rem 1rem;
  }
  
  .header-search {
    max-width: none;
  }
  
  .main-content {
    padding: 1.5rem 1rem;
  }
  
  .grid-cols-4,
  .grid-cols-3,
  .grid-cols-2 {
    grid-template-columns: 1fr;
  }
  
  .grid-span-2,
  .grid-span-3 {
    grid-column: span 1;
  }
  
  .section-title {
    font-size: 1.25rem;
  }
  
  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.5rem; }
}

@media (max-width: 480px) {
  .btn {
    padding: 0.625rem 1.25rem;
    font-size: 0.8rem;
  }
  
  .stat-value {
    font-size: 1.5rem;
  }
  
  .section-title {
    font-size: 1.125rem;
  }
}

/* ─── 16. SCROLLBAR PERSONALIZADA ──────────────────────────– */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 999px;
  opacity: 0.3;
}

::-webkit-scrollbar-thumb:hover {
  opacity: 0.6;
}
