/* ============================================
   🎨 CE5 DASHBOARD - LAYOUT PROFESIONAL
   ============================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body { 
  font-family: 'Plus Jakarta Sans', sans-serif; 
  background-color: #F9F9F9;
  color: #1A1C1C;
  overflow: hidden;
}

.material-symbols-outlined { 
  font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 24; 
  vertical-align: middle;
}

/* ============================================
   🗂️ APP CONTENT - CONTENEDOR PRINCIPAL
   ============================================ */
#app-content {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ============================================
   📱 SIDEBAR - ESCRITORIO (≥1024px) - MÁXIMO COMPACTO
   ============================================ */
@media (min-width: 1024px) {
  #side-drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: 64px;
    height: 100vh;
    background: #FFFFFF;
    border-right: 1px solid rgba(226, 226, 226, 0.3);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: width 0.3s ease;
  }

  #side-drawer.expanded {
    width: 280px;
  }

  /* Header - Mínimo */
  #side-drawer .sticky.top-0 {
    position: sticky;
    top: 0;
    background: #FFFFFF;
    border-bottom: 1px solid rgba(226, 226, 226, 0.3);
    padding: 0.25rem 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    min-height: 40px; /* ✅ REDUCIDO */
  }

  #side-drawer.expanded .sticky.top-0 {
    padding: 0.5rem 1rem;
    justify-content: flex-start;
  }

  #side-drawer .menu-header-text {
    display: none !important;
  }

  #side-drawer.expanded .menu-header-text {
    display: block !important;
    margin-left: 0.75rem;
    color: #0A0793;
    font-weight: 800;
    font-size: 0.85rem;
  }

  /* Nav - Mínimo absoluto */
  #side-drawer nav {
    flex: 1;
    overflow: hidden;
    padding: 0.1rem 0; /* ✅ REDUCIDO al mínimo */
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 0.05rem; /* ✅ REDUCIDO al mínimo (0.8px) */
  }

  /* ITEMS - Mínimos */
  .menu-item-drawer {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 28px; /* ✅ REDUCIDO de 30px a 28px */
    min-width: 40px;
    border-radius: 5px; /* ✅ REDUCIDO */
    color: #000000;
    cursor: pointer;
    border: none;
    background: transparent;
    margin: 0 auto;
    transition: all 0.15s ease;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .menu-item-drawer:hover {
    background: #F3F4F6;
    color: #0A0793;
  }

  /* Iconos - Más pequeños */
  .menu-item-drawer .material-symbols-outlined {
    font-size: 25px; /* ✅ REDUCIDO de 22px a 20px */
    flex-shrink: 0;
    transition: transform 0.15s ease;
  }

  .menu-item-drawer:hover .material-symbols-outlined {
    transform: scale(1.05);
  }

  /* Texto */
  .menu-item-drawer .text-label {
    display: none;
    margin-left: 0.5rem; /* ✅ REDUCIDO */
    font-size: 0.75rem; /* ✅ REDUCIDO */
    font-weight: 600;
  }

  /* EXPANDED */
  #side-drawer.expanded .menu-item-drawer {
    width: calc(100% - 0.5rem); /* ✅ REDUCIDO */
    justify-content: flex-start;
    padding: 0 0.5rem;
    margin: 0 0.25rem;
  }

  #side-drawer.expanded .menu-item-drawer .text-label {
    display: inline;
  }

  /* ACTIVO */
  .drawer-item-active {
    background: #EEF2FF !important;
    color: #0A0793 !important;
  }

  /* SECCIONES - Mínimas */
  #side-drawer .section-title {
    display: none;
    padding: 0.15rem 0.5rem 0.05rem; /* ✅ REDUCIDO */
    font-size: 6.5px; /* ✅ REDUCIDO de 7px */
    font-weight: 700;
    text-transform: uppercase;
    color: #9CA3AF;
    margin: 0.05rem 0; /* ✅ REDUCIDO al mínimo */
    letter-spacing: 0.5px;
  }

  #side-drawer.expanded .section-title {
    display: block;
    padding: 0.15rem 1rem 0.05rem;
  }

  /* DIVISORES - Mínimos */
  #side-drawer .border-t {
    border-color: rgba(226, 226, 226, 0.2);
    margin: 0.15rem 0; /* ✅ REDUCIDO */
  }

  /* LOGOUT - Mínimo */
  #side-drawer > div:last-child {
    padding: 0.1rem; /* ✅ REDUCIDO */
    border-top: 1px solid rgba(226, 226, 226, 0.2);
    flex-shrink: 0;
    margin-top: auto;
    min-height: 32px; /* ✅ REDUCIDO de 36px */
  }

  #logout-btn-drawer {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 30px; /* ✅ REDUCIDO de 34px */
    border-radius: 6px; /* ✅ REDUCIDO */
    background: rgba(239, 68, 68, 0.05);
    cursor: pointer;
    width: 100%;
    transition: 0.15s;
    border: none;
    color: #ef4444;
  }

  #logout-btn-drawer:hover {
    background: rgba(239, 68, 68, 0.15);
  }

  #logout-btn-drawer .text-label {
    display: none;
    margin-left: 0.5rem;
    font-weight: 600;
    font-size: 0.75rem;
  }

  #side-drawer.expanded #logout-btn-drawer {
    justify-content: flex-start;
    padding: 0 0.5rem;
    width: calc(100% - 0.5rem);
    margin: 0 0.25rem;
  }

  #side-drawer.expanded #logout-btn-drawer .text-label {
    display: inline;
  }

  #open-drawer {
    display: none !important;
  }
}

/* ============================================
   📱 SIDEBAR - MÓVIL (<1024px) - CON SCROLL
   ============================================ */
@media (max-width: 1023px) {
  #side-drawer {
    position: fixed;
    left: 0;
    top: 0;
    width: 280px;
    height: 100vh;
    background: #FFFFFF;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 12px rgba(0, 0, 0, 0.1);
  }

  #side-drawer.active {
    transform: translateX(0);
  }

  /* Header del drawer móvil */
  #side-drawer .sticky.top-0 {
    background: #0A0793;
    color: white;
    padding: 1rem;
    justify-content: flex-start;
    flex-shrink: 0; /* ✅ No se comprime */
    min-height: 56px;
  }

  #side-drawer .sticky.top-0 .font-extrabold {
    display: block !important;
    color: white;
    margin-left: 0.5rem;
  }

  #side-drawer .sticky.top-0 #close-drawer {
    color: white;
    display: block !important;
  }

  /* ✅ Nav CON SCROLL en móvil */
  #side-drawer nav {
    flex: 1;
    overflow-y: auto; /* ✅ SCROLL VERTICAL */
    overflow-x: hidden;
    padding: 0.5rem 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 0.25rem;
    scrollbar-width: thin; /* Firefox */
    scrollbar-color: rgba(10, 7, 147, 0.3) transparent; /* Firefox */
  }

  /* ✅ Scrollbar personalizada para móvil */
  #side-drawer nav::-webkit-scrollbar {
    width: 4px; /* ✅ Scrollbar delgada */
  }

  #side-drawer nav::-webkit-scrollbar-track {
    background: transparent;
  }

  #side-drawer nav::-webkit-scrollbar-thumb {
    background: rgba(10, 7, 147, 0.3);
    border-radius: 4px;
  }

  #side-drawer nav::-webkit-scrollbar-thumb:hover {
    background: rgba(10, 7, 147, 0.5);
  }

  /* Items del menú */
  #side-drawer .menu-item-drawer {
    justify-content: flex-start;
    padding: 0.75rem 1rem;
    margin: 0.15rem 0.75rem;
    border-radius: 0.75rem;
    width: calc(100% - 1.5rem);
    height: auto;
    min-height: 44px; /* ✅ REDUCIDO para que quepan más */
  }

  #side-drawer .menu-item-drawer > span:last-child,
  #side-drawer .menu-item-drawer .text-label {
    display: inline !important;
    margin-left: 0.75rem;
  }

  #side-drawer .menu-item-drawer .material-symbols-outlined {
    margin-right: 0.75rem;
  }

  /* Item activo en móvil */
  #side-drawer .drawer-item-active {
    background: rgba(10, 7, 147, 0.08) !important;
    color: #0A0793 !important;
    font-weight: 600;
    border-left: 3px solid #0A0793 !important;
  }

  /* Secciones */
  #side-drawer p.text-zinc-950,
  #side-drawer .section-title {
    display: block !important;
    text-align: left;
    padding: 0.5rem 1rem 0.25rem;
    flex-shrink: 0; /* ✅ No se comprime */
  }

  /* Logout en móvil - FIJO ABAJO */
  #side-drawer #logout-btn-drawer {
    justify-content: flex-start;
    padding: 0.75rem 1rem;
    width: calc(100% - 1.5rem);
    margin: 0.5rem 0.75rem;
    flex-shrink: 0; /* ✅ No se comprime */
  }

  #side-drawer #logout-btn-drawer .text-label {
    display: inline !important;
  }

  /* Overlay */
  #drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }

  #drawer-overlay.active {
    opacity: 1;
    pointer-events: auto;
  }

  /* Mostrar botón de abrir */
  #open-drawer {
    display: block !important;
  }
}

/* ============================================
   📱 MAIN WRAPPER
   ============================================ */
#main-wrapper-ce5 {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin-left: 64px;
  transition: margin-left 0.3s ease;
  overflow: hidden;
}

#side-drawer.expanded ~ #main-wrapper-ce5 {
  margin-left: 280px;
}

@media (max-width: 1023px) {
  #main-wrapper-ce5 {
    margin-left: 0 !important;
  }
}

/* ============================================
   📱 HEADER SUPERIOR
   ============================================ */
header.fixed.top-0 {
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(226, 226, 226, 0.5);
  z-index: 100;
  padding: 0.75rem 1.5rem;
  flex-shrink: 0;
}

/* ============================================
   📄 MAIN CONTENT - DASHBOARD/INICIO
   ============================================ */
#main-content {
  flex: 1;
  overflow-y: auto;
}

#main-content > div {
  padding: 1.5rem;
  width: 100%;
  max-width: 100%;
}

/* ============================================
   📊 CONTENIDO INTERNO
   ============================================ */
#main-content .max-w-7xl,
#main-content .max-w-6xl,
#main-content .max-w-5xl,
#main-content .max-w-4xl {
  max-width: 100%;
  margin: 0 auto;
  width: 100%;
}

#main-content .space-y-8 {
  gap: 1.5rem;
}

#main-content section.relative.overflow-hidden {
  padding: 2rem;
  margin-bottom: 1.5rem;
}

#main-content #frase-texto {
  font-size: 1.5rem;
  line-height: 1.4;
}

#main-content .grid.grid-cols-1.sm\:grid-cols-2.lg\:grid-cols-3 {
  gap: 1rem;
  margin-bottom: 1.5rem;
}

#main-content .bg-surface.p-4 {
  padding: 1.25rem;
}

#main-content #stat-nuevos,
#main-content #stat-activos,
#main-content #stat-progreso {
  font-size: 2rem;
}

#main-content .grid.grid-cols-1.lg\:grid-cols-12 {
  gap: 1.5rem;
}

#main-content .bg-surface.p-4.md\:p-6 {
  padding: 1.25rem;
  margin-bottom: 1rem;
}

#main-content h3.text-lg,
#main-content h4 {
  font-size: 1rem;
  margin-bottom: 1rem;
}

.scrollable-section {
  display: flex;
  overflow-x: auto;
  gap: 1rem;
  scrollbar-width: none;
  padding-bottom: 0.5rem;
}

.scrollable-section::-webkit-scrollbar { 
  display: none; 
}

.scrollable-card {
  flex: 0 0 280px;
  padding: 1rem;
}

/* ============================================
   📄 MÓDULOS DINÁMICOS
   ============================================ */
.page-section,
#contenedor-perfil,
#contenedor-top,
#contenedor-miembros,
#contenedor-cuentas,
#contenedor-permisos,
#contenedor-dashboard-admin,
#contenedor-reuniones,
#contenedor-actividades,
#contenedor-dinamicas,
#contenedor-admpuntos,
#contenedor-actas,
#contenedor-educacion,
#contenedor-nuevos-ingresos,
#contenedor-miembro-ausencias {
  display: none;
  flex: 1;
  overflow-y: auto;
  width: 100%;
  height: 100%;
}

.page-section.active,
#contenedor-perfil.active,
#contenedor-top.active,
#contenedor-miembros.active,
#contenedor-cuentas.active,
#contenedor-permisos.active,
#contenedor-dashboard-admin.active,
#contenedor-reuniones.active,
#contenedor-actividades.active,
#contenedor-dinamicas.active,
#contenedor-admpuntos.active,
#contenedor-actas.active,
#contenedor-educacion.active,
#contenedor-nuevos-ingresos.active,
#contenedor-miembro-ausencias.active {
  display: flex !important;
  flex-direction: column;
}

.page-section > div,
[id^="contenedor-"] > div {
  flex: 1;
  padding: 1.5rem;
  width: 100%;
  max-width: 100%;
  overflow-y: auto;
}

.page-section .max-w-7xl,
.page-section .max-w-6xl,
[id^="contenedor-"] .max-w-7xl,
[id^="contenedor-"] .max-w-6xl {
  margin: 0 auto;
  width: 100%;
  max-width: 100%;
}

/* ============================================
   🔐 LOGIN
   ============================================ */
#login-screen { 
  position: fixed; 
  inset: 0; 
  background: #F9F9F9; 
  z-index: 9999; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
}

/* ============================================
   🪟 MODALES
   ============================================ */
.modal { 
  position: fixed; 
  inset: 0; 
  z-index: 2000; 
  display: none; 
  align-items: center; 
  justify-content: center; 
}

.modal.active { display: flex; }

.modal-overlay { 
  position: absolute; 
  inset: 0; 
  background: rgba(0,0,0,0.5); 
}

.modal-content { 
  position: relative; 
  background: white; 
  width: 90%; 
  max-width: 500px; 
  border-radius: 1rem; 
  padding: 1.5rem; 
  max-height: 90vh; 
  overflow-y: auto; 
}

/* ============================================
   🔔 NOTIFICACIONES
   ============================================ */
.notification { 
  position: fixed; 
  top: 20px; 
  right: 20px; 
  z-index: 3000; 
  background: white; 
  border-left: 4px solid #0A0793; 
  padding: 1rem; 
  border-radius: 0.5rem; 
  box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); 
  display: none; 
  transform: translateX(120%); 
  transition: transform 0.3s ease; 
}

.notification.show { 
  display: block; 
  transform: translateX(0); 
}

@keyframes fadeIn { 
  from { opacity: 0; transform: translateY(10px); } 
  to { opacity: 1; transform: translateY(0); } 
}

/* ============================================
   🎨 COLORES
   ============================================ */
.text-primary { color: #0A0793 !important; }
.text-secondary { color: #FFFF00 !important; }
.bg-primary { background-color: #0A0793 !important; }
.bg-secondary { 
  background-color: #0A0793 !important;
  border: 3px solid #0A0793;
  box-shadow: 0 4px 12px rgba(10, 7, 147, 0.3);
}

/* ============================================
   📱 RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  #main-content > div,
  .page-section > div,
  [id^="contenedor-"] > div {
    padding: 1rem;
  }
  
  #main-content #frase-texto {
    font-size: 1.25rem;
  }
  
  #main-content #stat-nuevos,
  #main-content #stat-activos,
  #main-content #stat-progreso {
    font-size: 1.5rem;
  }
  
  .scrollable-card { 
    flex: 0 0 240px; 
  }
}

/* Scrollbar invisible */
.hide-scrollbar::-webkit-scrollbar { display: none; }
.hide-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* Tabla de usuarios - layout fijo */
.module-table {
  width: 100%;
  table-layout: fixed; /* ✅ Evita que las columnas se expandan */
}

.module-table th,
.module-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  vertical-align: middle;
}

/* Anchos específicos para columnas */
.module-table th:nth-child(1),
.module-table td:nth-child(1) {
  width: 80px; /* Foto */
}

.module-table th:nth-child(2),
.module-table td:nth-child(2) {
  width: 25%; /* Usuario */
}

.module-table th:nth-child(3),
.module-table td:nth-child(3) {
  width: 200px; /* Rol */
}

.module-table th:nth-child(4),
.module-table td:nth-child(4) {
  width: 100px; /* Estado */
}

.module-table th:nth-child(5),
.module-table td:nth-child(5) {
  width: 80px; /* Puntos */
}

.module-table th:nth-child(6),
.module-table td:nth-child(6) {
  width: 120px; /* Acciones */
  text-align: right;
}

/* Efecto hover sutil para items del sidebar */
@media (min-width: 1024px) {
  .menu-item-drawer {
    position: relative;
  }
  
  .menu-item-drawer::after {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: #0A0793;
    border-radius: 0 2px 2px 0;
    opacity: 0;
    transition: opacity 0.15s ease;
  }
  
  .menu-item-drawer:hover::after,
  .drawer-item-active::after {
    opacity: 1;
  }
}

/* Line clamp para truncar texto */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Modal animations */
.modal.active {
  display: flex !important;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { 
    opacity: 0;
    transform: translateY(20px);
  }
  to { 
    opacity: 1;
    transform: translateY(0);
  }
}

/* Prose para contenido rico */
.prose {
  color: #1A1C1C;
  line-height: 1.75;
}

.prose p {
  margin-bottom: 1rem;
}

/* ============================================
   🌓 DARK MODE
   ============================================ */
.dark body { background-color: #0F172A; color: #F1F5F9; }
.dark #side-drawer { background: linear-gradient(180deg, #1E293B 0%, #0F172A 100%); border-right-color: #334155; }
.dark #side-drawer .sticky.top-0 { background: linear-gradient(180deg, #1E293B 0%, #0F172A 100%); border-bottom-color: #334155; }
.dark #side-drawer .menu-header-text { color: #60A5FA; }
.dark .menu-item-drawer { color: #94A3B8; }
.dark .menu-item-drawer:hover { color: #60A5FA; background: rgba(59, 130, 246, 0.1); }
.dark .menu-item-drawer.drawer-item-active { background: rgba(59, 130, 246, 0.2) !important; color: #60A5FA !important; border-left-color: #60A5FA !important; }
.dark .section-title { color: #64748B; }
.dark header.fixed.top-0 { background: rgba(30, 41, 59, 0.95); border-bottom-color: #334155; }
.dark header .text-primary { color: #60A5FA !important; }
.dark .bg-surface { background-color: #1E293B; }
.dark .border-border { border-color: #334155; }
.dark .text-zinc-950, .dark .text-slate-500, .dark .text-on-surface-variant { color: #94A3B8 !important; }
.dark .text-primary { color: #60A5FA !important; }
.dark .text-secondary { color: #FCD34D !important; }
.dark .border-b-4.border-primary { border-bottom-color: #60A5FA !important; }
.dark .bg-primary\/5 { background-color: rgba(59, 130, 246, 0.1); }
.dark .bg-gradient-to-br.from-white.to-slate-50 { background: linear-gradient(to bottom right, #1E293B, #0F172A); }
.dark .border-primary\/20 { border-color: rgba(59, 130, 246, 0.2); }
.dark button.bg-slate-100 { background-color: #334155; }
.dark button.bg-slate-100:hover { background-color: #60A5FA; color: white; }
.dark .modal-content { background-color: #1E293B; border: 1px solid #334155; }
.dark .modal-overlay { background: rgba(0, 0, 0, 0.7); }
.dark input, .dark textarea, .dark select { background-color: #0F172A; border-color: #334155; color: #F1F5F9; }
.dark input::placeholder, .dark textarea::placeholder { color: #64748B; }
.dark input:focus, .dark textarea:focus, .dark select:focus { border-color: #60A5FA; outline: none; box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2); }
.dark #login-screen { background: #0F172A; }
.dark #login-screen .bg-white { background-color: #1E293B; }
.dark #login-screen .text-gray-500 { color: #94A3B8; }
.dark ::-webkit-scrollbar { width: 8px; height: 8px; }
.dark ::-webkit-scrollbar-track { background: #0F172A; }
.dark ::-webkit-scrollbar-thumb { background: #334155; border-radius: 4px; }
.dark ::-webkit-scrollbar-thumb:hover { background: #475569; }
.dark #dropdown-notificaciones { background-color: #1E293B; border-color: #334155; }
.dark #dropdown-notificaciones .border-b { border-color: #334155; }
.dark #lista-notificaciones > div:hover { background-color: #0F172A; }
.dark #notificaciones-badge { background-color: #EF4444; }

/* Animación para modales */
#modal-historial-notificaciones {
  transition: opacity 0.2s ease;
}

#modal-historial-notificaciones.hidden {
  opacity: 0;
  pointer-events: none;
}

#modal-historial-notificaciones:not(.hidden) {
  opacity: 1;
  pointer-events: auto;
}

#modal-historial-notificaciones .relative {
  transition: transform 0.2s ease, opacity 0.2s ease;
}

#modal-historial-notificaciones.hidden .relative {
  transform: scale(0.95);
  opacity: 0;
}

#modal-historial-notificaciones:not(.hidden) .relative {
  transform: scale(1);
  opacity: 1;
}

/* ✅ Evento seleccionado con borde verde brillante */
.evento-card.selected {
  border-color: #22c55e !important;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.3);
  transform: scale(1.02);
}

.dark .evento-card.selected {
  border-color: #4ade80 !important;
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.3);
}

/* ✅ Evento con participantes (borde verde por defecto) */
.evento-con-participantes {
  border-color: #22c55e !important;
}

.dark .evento-con-participantes {
  border-color: #4ade80 !important;
}

/* Agregar a tu CSS si quieres mejor estilo */
button[title*="eliminar"] {
  transition: all 0.2s ease;
}
button[title*="eliminar"]:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

/* ✅ FORZAR que el modal de recuperación esté SIEMPRE oculto por defecto */
#modal-recuperar {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* ✅ Solo mostrar cuando tenga la clase 'activo' */
#modal-recuperar.activo {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}