/* Reset básico */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Variables CSS globales */
:root {
  --primary-color: #667eea;
  --secondary-color: #764ba2;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --error-color: #ef4444;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --bg-primary: #ffffff;
  --bg-secondary: #f9fafb;
  --bg-tertiary: #f3f4f6;
  --border-color: #e5e7eb;
  --border-light: #f3f4f6;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
}

/* Estilos base */
html {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

body {
  min-height: 100vh;
  background: transparent;
}

/* Utilidades comunes */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.text-center {
  text-align: center;
}

.text-left {
  text-align: left;
}

.text-right {
  text-align: right;
}

/* Botones */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-tertiary);
}

.btn-danger {
  background: var(--error-color);
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
}

/* Formularios */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.form-input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  transition: border-color 0.2s ease;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Cards */
.card {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
}

.card-header {
  margin-bottom: 1rem;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

/* Utilidades de espaciado */
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }

.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 0 0.5rem;
  }
  
  .card {
    padding: 1rem;
  }
}

/* ===== ESTILOS DEL DASHBOARD ===== */
.dashboard-container {
  padding: 2rem;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  min-height: 100vh;
}

/* Header del Dashboard */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e2e8f0;
}

.header-content h1 {
  font-size: 2rem;
  font-weight: 700;
  color: #1f2937;
  margin: 0 0 0.5rem 0;
}

.welcome-text {
  color: #6b7280;
  font-size: 1rem;
  margin: 0;
}

/* Grid de Estadísticas */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: white;
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  border: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: all 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.stat-icon {
  background: linear-gradient(135deg,#667eea 0%,#764ba2 100%);
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
}
.stat-icon svg {
  width: 20px;
  height: 20px;
}

.stat-content h3 {
  font-size: 2rem;
  font-weight: 700;
  color: #1f2937;
  margin: 0 0 0.25rem 0;
}

.stat-content p {
  color: #6b7280;
  font-size: 0.875rem;
  margin: 0;
}

/* Actividad Reciente */
.recent-activity {
  background: white;
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  border: 1px solid #e5e7eb;
  margin-bottom: 2rem;
}

.recent-activity h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #1f2937;
  margin: 0 0 1rem 0;
}

.activity-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border-radius: 0.75rem;
  background: #f9fafb;
  transition: all 0.2s ease;
}

.activity-item:hover {
  background: #f3f4f6;
}

.activity-icon {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.activity-content h4 {
  font-size: 0.875rem;
  font-weight: 600;
  color: #1f2937;
  margin: 0 0 0.25rem 0;
}

.activity-content p {
  font-size: 0.75rem;
  color: #6b7280;
  margin: 0 0 0.25rem 0;
}

.activity-time {
  font-size: 0.75rem;
  color: #9ca3af;
}

/* Acciones Rápidas */
.quick-actions {
  background: white;
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  border: 1px solid #e5e7eb;
}

.quick-actions h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #1f2937;
  margin: 0 0 1rem 0;
}

.actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.action-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1.5rem;
  border-radius: 0.75rem;
  background: #f9fafb;
  text-decoration: none;
  color: inherit;
  transition: all 0.3s ease;
  border: 1px solid #e5e7eb;
}

.action-card:hover {
  background: #f3f4f6;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.action-icon {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  margin-bottom: 10px;

}


.action-card h3 {
  font-size: 1rem;
  font-weight: 600;
  color: #1f2937;
  margin: 0 0 0.5rem 0;
}

.action-card p {
  font-size: 0.875rem;
  color: #6b7280;
  margin: 0;
}

/* Responsive del Dashboard */
@media (max-width: 768px) {
  .dashboard-container {
    padding: 1rem;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .actions-grid {
    grid-template-columns: 1fr;
  }
  
  .header-content h1 {
    font-size: 1.5rem;
  }
}

/* ===== ESTILOS DEL SIDEBAR ===== */
.sidebar {
  width: 280px;
  min-width: 280px;
  height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 50;
  transition: all 0.3s ease-in-out;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

/* Estado colapsado del sidebar */
.sidebar.collapsed {
  width: 60px !important;
  min-width: 60px !important;
}

.sidebar.collapsed .sidebar-text {
  display: none !important;
}

.sidebar.collapsed .sidebar-user-text {
  display: none !important;
}

.sidebar.collapsed .nav-text {
  display: none !important;
}

.sidebar.collapsed .nav-chevron {
  display: none !important;
}

.sidebar.collapsed .nav-submenu {
  display: none !important;
}

.sidebar.collapsed .nav-button {
  justify-content: center !important;
  padding: 0.75rem !important;
  width: 100% !important;
}

.sidebar.collapsed .nav-subitem {
  justify-content: center !important;
  padding: 0.75rem !important;
  width: 100% !important;
}

/* Estilos para el layout principal */
.main-layout {
  display: flex;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  margin-left: 280px;
  padding: 1rem;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  transition: margin-left 0.3s ease-in-out;
  min-height: 100vh;
}

.main-content.sidebar-collapsed {
  margin-left: 60px !important;
}

/* Estilos para el contenido del sidebar */
.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
}

/* Estilos para el header del sidebar */
.sidebar-header {
  padding: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
}

/* Estilos para el footer del sidebar */
.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
}

/* Estilos para el botón de toggle */
.sidebar-toggle-btn {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  color: white;
  font-size: 12px;
}

.sidebar-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.toggle-icon {
  transition: transform 0.2s ease-in-out;
}

/* Estilos para la navegación principal */
.nav-main {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.5rem;
}

.nav-item {
  width: 100%;
}

.nav-group {
  width: 100%;
}

/* Estilos para los botones de navegación - UNIFICADOS */
.nav-button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  color: white;
  transition: all 0.2s ease-in-out;
  cursor: pointer;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(5px);
  min-height: 44px;
  box-sizing: border-box;
}

.nav-button:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateX(5px);
}

.nav-button.active {
  background: rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.nav-text {
  flex: 1;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: white;
}

.nav-chevron {
  margin-left: auto;
  transition: transform 0.2s ease-in-out;
  color: white;
}

.nav-chevron.rotate-90 {
  transform: rotate(90deg);
}

/* Estilos para los submenús */
.nav-submenu {
  margin-left: 1rem;
  margin-top: 0.25rem;
  padding-left: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-submenu.hidden {
  display: none;
}

/* Estilos para los subitems - UNIFICADOS con nav-button */
.nav-subitem {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.8);
  transition: all 0.2s ease-in-out;
  cursor: pointer;
  border: none;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(5px);
  min-height: 44px;
  box-sizing: border-box;
}

.nav-subitem:hover {
  background: rgba(255, 255, 255, 0.15);
  color: white;
  transform: translateX(3px);
}

.nav-subitem.active {
  background: rgba(255, 255, 255, 0.25);
  color: white;
}

/* Estilos para el dropdown del usuario - ARREGLADO */
.user-dropdown {
  position: absolute;
  bottom: 100%;
  right: 0;
  margin-bottom: 0.5rem;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  min-width: 200px;
  z-index: 1000;
  backdrop-filter: blur(10px);
  color: #333;
}

.user-dropdown.hidden {
  display: none;
}

.user-dropdown .px-3 {
  color: #333;
}

.user-dropdown .text-sm {
  color: #333;
}

.user-dropdown .text-xs {
  color: #666;
}

.user-dropdown a,
.user-dropdown button {
  color: #333;
}

.user-dropdown a:hover,
.user-dropdown button:hover {
  background-color: #f3f4f6;
  color: #111827;
}

/* Estilos para el usuario en el sidebar */
.sidebar-footer .flex {
  color: white;
}

.sidebar-footer .text-sm {
  color: rgba(255, 255, 255, 0.9);
}

.sidebar-footer .text-xs {
  color: rgba(255, 255, 255, 0.7);
}

/* Estilos para las páginas principales */
.page-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

.page-header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.page-title {
  font-size: 2rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 0.5rem;
}

.page-subtitle {
  font-size: 1rem;
  color: #6b7280;
  font-weight: 400;
}

.content-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.content-card {
  background: white;
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  border: 1px solid #e5e7eb;
  transition: all 0.3s ease;
}

.content-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 0.5rem;
}

.card-content {
  color: #6b7280;
  line-height: 1.6;
}

/* Responsive design mejorado */
@media (max-width: 1024px) {
  .sidebar {
    width: 240px;
    min-width: 240px;
  }
  
  .main-content {
    margin-left: 240px;
  }
  
  .main-content.sidebar-collapsed {
    margin-left: 60px;
  }
  
  .page-container {
    padding: 1.5rem;
  }
  
  .content-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
  }
}

@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    min-width: 100%;
    position: fixed;
    left: -100%;
    transition: left 0.3s ease-in-out;
  }
  
  .sidebar.mobile-open {
    left: 0;
  }
  
  .main-content {
    margin-left: 0;
    padding: 1rem;
  }
  
  .sidebar-toggle-btn {
    color: black;
    display: block;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1001;
    background: rgba(102, 126, 234, 0.9);
    border: none;
    width: 40px;
    height: 40px;
  }
  
  .page-container {
    padding: 1rem;
    margin-top: 60px;
  }
  
  .page-title {
    font-size: 1.5rem;
  }
  
  .content-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .content-card {
    padding: 1rem;
  }
}

@media (max-width: 480px) {
  .page-container {
    padding: 0.5rem;
  }
  
  .page-title {
    font-size: 1.25rem;
  }
  
  .content-card {
    padding: 0.75rem;
  }
  
  /* Mejoras para mobile pequeño */
  .page-header {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }
  
  .content-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  /* Ajustes de tipografía para mobile */
  body {
    font-size: 14px;
  }
  
  h1, h2, h3, h4, h5, h6 {
    line-height: 1.3;
  }
  
  /* Mejoras de accesibilidad para touch */
  button, a, .nav-button, .nav-link {
    min-height: 44px;
    min-width: 44px;
  }
}

/* Animaciones adicionales */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.nav-item {
  animation: slideIn 0.3s ease-out;
}

/* Scrollbar personalizado para el sidebar */
.sidebar-content::-webkit-scrollbar {
  width: 6px;
}

.sidebar-content::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.sidebar-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
}

.sidebar-content::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

/* Overlay para mobile */
.mobile-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 49;
  display: none;
}

.mobile-overlay.active {
  display: block;
}

/* Estilos para los iconos de navegación */
.nav-icon {
  font-size: 1.125rem;
  min-width: 1.5rem;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Estilos para el contenido del sidebar */
.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0;
}

/* Estilos para el footer del sidebar */
.sidebar-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 1rem;
}
