/* --- VARIABLES GLOBALES --- */
:root {
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 70px;
  --header-height: 65px;
  --primary-color: #0d6efd;
  --bg-light: #f8f9fa;
  --text-muted: #64748b;
  --text-dark: #1e293b;
  --transition-speed: 0.3s;
}

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

body {
  background-color: var(--bg-light);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--text-dark);
  overflow: hidden; /* Mantiene el panel fijo */
}

/* --- CONTENEDOR MAESTRO --- */
.layout-wrapper {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* --- SIDEBAR (EL ESTILO QUE TE GUSTA) --- */
.sidebar-custom {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100vh;
  background: #ffffff;
  border-right: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  transition: all var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1030;
  overflow-x: hidden; /* Esto asegura que nada salga de los 70px */
}

/* Estado Colapsado */
.sidebar-custom.collapsed {
  width: var(--sidebar-collapsed-width);
  min-width: var(--sidebar-collapsed-width);
}

/* --- NAVEGACIÓN DENTRO DEL SIDEBAR --- */
.nav-links-group {
  display: flex;
  flex-direction: column;
}

.nav-link-custom {
  display: flex;
  align-items: center;
  padding: 0.8rem 1.25rem;
  color: var(--text-dark);
  text-decoration: none;
  transition: all 0.2s;
  border-radius: 0 50px 50px 0; /* Efecto pestaña */
  margin-right: 1rem;
  margin-bottom: 0.25rem;
}

.nav-link-custom i {
  font-size: 1.4rem;
  min-width: 25px;
  color: var(--text-muted);
  transition: color 0.2s;
}

.nav-link-custom:hover {
  background: #f1f5f9;
  color: var(--primary-color);
}

.nav-link-custom:hover i {
  color: var(--primary-color);
}

/* Busca este bloque y reemplázalo exactamente por este */
.sidebar-custom.collapsed .nav-text,
.sidebar-custom.collapsed .section-title,
.sidebar-custom.collapsed .border-top,
.sidebar-custom.collapsed .bg-light,
.sidebar-custom.collapsed .p-4 span,  /* Oculta el nombre "Economía Agraria" */
.sidebar-custom.collapsed .p-3.border-top { /* Oculta el pie del menú */
  display: none !important;
}
/* Centrar iconos cuando está colapsado */
.sidebar-custom.collapsed .nav-link-custom {
  justify-content: center;
  margin-right: 0;
  border-radius: 0;
}

.sidebar-custom.collapsed .nav-link-custom i {
  margin: 0 !important;
}

/* --- CONTENIDO PRINCIPAL (ELÁSTICO) --- */
.main-content {
  flex: 1;
  min-width: 0; /* Evita que el contenido desborde el viewport */
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* Header */
.header-public {
  height: var(--header-height);
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

/* Área de Scroll (Yield) */
.scrollable-area {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 2rem;
}

/* Personalización de la barra de scroll */
.scrollable-area::-webkit-scrollbar {
  width: 6px;
}

.scrollable-area::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 10px;
}

/* --- RESPONSIVIDAD (MÓVIL) --- */
@media (max-width: 768px) {
  .sidebar-custom {
    position: absolute;
    left: 0;
    margin-left: calc(var(--sidebar-width) * -1);
  }

  .sidebar-custom.mobile-show {
    margin-left: 0;
  }

  .scrollable-area {
    padding: 1rem;
  }
}


/* --- ESTILOS ESPECÍFICOS ADMIN --- */

/* Sidebar Admin: Fondo oscuro */
.sidebar-admin {
  background-color: #1e293b; /* Slate 800 */
  border-right: 1px solid #334155;
  transition: all var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
}

/* Header Admin */
.header-admin {
  height: var(--header-height);
  background: #0f172a; /* Slate 900 */
  color: white;
  border-bottom: 1px solid #1e293b;
}

/* Links del Menú Admin */
.sidebar-admin .nav-link {
  padding: 0.8rem 1rem;
  border-radius: 8px;
  margin-bottom: 0.2rem;
  transition: all 0.2s;
  white-space: nowrap; /* Evita el amontonamiento */
  display: flex;
  align-items: center;
}

.sidebar-admin .nav-link i {
  min-width: 25px;
  text-align: center;
}

/* Estado Colapsado del Admin */
.sidebar-admin.collapsed {
  width: var(--sidebar-collapsed-width) !important;
  min-width: var(--sidebar-collapsed-width) !important;
}

/* Ocultar textos del Admin al colapsar */
.sidebar-admin.collapsed span,
.sidebar-admin.collapsed small,
.sidebar-admin.collapsed .fw-bold.fs-5 {
  display: none !important;
}

/* Centrar iconos del Admin al colapsar */
.sidebar-admin.collapsed .nav-link {
  justify-content: center;
  padding: 0.8rem 0;
}

.sidebar-admin.collapsed .nav-link i {
  margin: 0 !important;
  font-size: 1.6rem;
}

/* Área de contenido Admin */
.scrollable-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

/* Custom Scrollbar para el estilo oscuro */
.custom-scrollbar::-webkit-scrollbar {
  width: 5px;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 10px;
}
