/* Importing Google Fonts - Poppins */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Poppins", sans-serif;
}

/* Modo Light (por defecto) */
:root {
  --bg-color: #f9f9f9; /*blanco fondo*/
  --bg-body-color:#d8d8d8; /*gris fondo*/
  --text-color: #333333; /*texto color*/
  --header-color: #5e41ff; /*Color de la barra header*/

  --sidebar-text: #E0E0E0; /* Texto del menú lateral en modo oscuro */
  --border-color: #DDDDDD;
  --primary-color: #151A2D;
  --hover-color: #0300b3;
  --sidebar-bg: #FFFFFF; /* Fondo del menú lateral en modo claro (blanco) */
  --sidebar-hover-bg: #f0f0f0; /* Fondo al pasar el mouse en modo claro */
  --sidebar-hover-text: #151A2D; /* Texto al pasar el mouse en modo claro */
  --footer-bg: #FFFFFF;
  --bg-boton: #f9f9f9;
  --hover-boton: #555555;
  --box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  --bg-boton-icon: rgba(0,0,0,0.04);
  --bg-logo: transparent;
}

/* Modo Dark */
.dark-mode {
  --bg-color: #282a2c; /*negro fuerte fondo*/
  --bg-body-color:#161616; /*negro claro fondo*/
  --text-color: #f9f9f9; /*texto color*/
  --header-color: #151A2D; /*Color de la barra header*/

  --border-color: #444444;
  --primary-color: #151A2D;
  --hover-color: #3700B3;
  --sidebar-bg: #151A2D; /* Conserva el azul fuerte en modo oscuro */
  --sidebar-hover-bg: #333333; /* Fondo al pasar el mouse en modo oscuro */
  --sidebar-hover-text: #E0E0E0; /* Texto al pasar el mouse en modo oscuro */
  --footer-bg: #282a2c;
  --bg-boton: #151A2D;
  --hover-boton: #E0E0E0;
  --box-shadow: 0 4px 10px rgba(255, 255, 255, 0.1);
  --bg-boton-icon: #E0E0E0;
  --bg-logo: #f9f9f9;
}

/* Estilos generales */
body {
  position: relative; /* Asegura que el body sea un contenedor posicionado */
  min-height: 100vh; /* Asegura que el body ocupe al menos toda la altura de la ventana */
  background-color: var(--bg-body-color);
  color: var(--text-color);
  overflow-y: auto;
}

/* Barra lateral */
.sidebar {
  position: fixed;
  width: 270px;
  margin: 16px;
  border-radius: 16px;
  background: var(--header-color);
  height: calc(100vh - 32px);
  transition: all 0.4s ease;
  z-index: 9000;
  display: flex;
  flex-direction: column; 
  overflow: hidden;
}

.sidebar.collapsed {
  width: 85px;
}

.sidebar .sidebar-header {
  display: flex;
  position: relative;
  padding: 25px 20px;
  align-items: center;
  justify-content: space-between;
}

.sidebar-header .header-logo img {
  width: 46px;
  height: 46px;
  display: block;
  object-fit: contain;
  border-radius: 10%;
}

.sidebar-header .toggler {
  height: 38px; /* ANTES: 35px */
  width: 38px;  /* ANTES: 35px */
  color: var(--text-color);
  border: none;
  cursor: pointer;
  display: flex;
  background: var(--bg-boton);
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: 0.4s ease;
}

.sidebar-header .sidebar-toggler {
  position: absolute;
  right: 20px;
}

.sidebar-header .menu-toggler {
  display: none;
}

.sidebar.collapsed .dark-mode-toggle span:not(.material-symbols-rounded) {
  opacity: 0;
  pointer-events: none;
  user-select: none;
}
/* Ocultar el texto "Sistema" para que no ocupe espacio invisible */
.sidebar.collapsed .dark-mode-toggle #dark-mode-label {
  display: none;
}

.sidebar.collapsed .dark-mode-toggle {
  justify-content: center; /* Centra el icono */
  padding-left: 0;         /* Quita relleno extra */
  padding-right: 0;
}

.sidebar.collapsed .sidebar-header .toggler {
  transform: translate(-4px, 65px);
}

.sidebar-header .toggler:hover {
  background: var(--sidebar-hover-bg);
}

.sidebar-header .toggler span {
  font-size: 1.8rem;
  transition: 0.4s ease;
}

.sidebar.collapsed .sidebar-header .toggler span {
  transform: rotate(180deg);
}

/*SCROLL EN EL SLIDEBAR*/

.sidebar-nav {
  height: 100%; /* Ocupa todo el alto del sidebar */
  display: flex;
  flex-direction: column; /* Organiza uno debajo del otro */
  justify-content: space-between; /* Empuja el contenido */
  padding-bottom: 20px;
  overflow: hidden; /* Limpieza general */
  padding-bottom: 0; /* Quitamos padding extra si molesta */
}

.primary-nav {
  flex: 1; /* Ocupa todo el espacio libre entre el Header y el Footer */
  overflow-y: auto; /* Aquí vive el scroll */
  overflow-x: hidden;
  /* Ajuste visual */
  padding-bottom: 10px; 
  /* Estilos de barra de desplazamiento fina */
  scrollbar-width: thin;
  scrollbar-color: var(--hover-color) transparent;
}

/* Estilo para la barra de scroll (Chrome/Safari) */
.primary-nav::-webkit-scrollbar {
  width: 6px;
}

.primary-nav::-webkit-scrollbar-thumb {
  background-color: var(--hover-color);
  border-radius: 3px;
}

.secondary-nav {
  flex-shrink: 0; /* IMPORTANTE: Impide que se achique o desaparezca */
  margin-top: auto; /* Empuja hacia abajo por seguridad */
  width: 100%;
  background: var(--header-color); /* Fondo sólido para tapar el scroll del menú de arriba */
  padding-bottom: 20px; /* Un poco de aire abajo */
  padding-top: 10px; /* Separación visual */
  z-index: 10;
}

/*-----------------------------------------*/

.sidebar-nav .nav-list {
  list-style: none;
  display: flex;
  gap: 4px;
  padding: 0 15px;
  flex-direction: column;
  transform: translateY(15px);
  transition: 0.4s ease;
}

.sidebar.collapsed .sidebar-nav .primary-nav {
  transform: none; 
  padding-top: 65px;
  
  /* 1. Reactivamos el scroll */
  overflow-y: auto; 
  overflow-x: hidden;
  
  /* 2. Ocultamos la barra de scroll visualmente para que quede limpio */
  scrollbar-width: none; /* Firefox */
}

.sidebar.collapsed .sidebar-nav .secondary-nav {
    transform: none !important;
}

/* Ocultar barra en Chrome/Edge/Safari */
.sidebar.collapsed .sidebar-nav .primary-nav::-webkit-scrollbar {
  display: none;
}

.sidebar.collapsed .nav-tooltip {
  display: block;
  
  /* TRUCO: Fixed nos permite "escapar" de la caja con scroll */
  position: fixed; 
  left: 90px; /* Separación desde la izquierda */
  
  /* IMPORTANTE: No definimos 'top'. Dejamos que el navegador decida la altura */
  margin-top: -10px; /* Ajuste manual fino para centrarlo con el icono */
  
  opacity: 0; 
  pointer-events: none;
  z-index: 99999;
  
  /* Estilos visuales */
  background: var(--sidebar-bg);
  color: var(--text-color); /* Asegúrate que el texto se lea */
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
  border-radius: 6px;
  padding: 6px 12px;
  width: max-content;
}

.sidebar.collapsed .sidebar-nav .nav-item:hover .nav-tooltip {
  opacity: 1;
  pointer-events: auto;
  
}

.sidebar-nav .nav-link {
  color: var(--sidebar-text); /* Usa la variable para el color del texto */
  display: flex;
  gap: 12px;
  white-space: nowrap;
  border-radius: 8px;
  padding: 12px 15px;
  align-items: center;
  text-decoration: none;
  transition: 0.4s ease;
}

.sidebar.collapsed .sidebar-nav .nav-link {
  border-radius: 12px;
  justify-content: center; /* Centra el icono horizontalmente */
  gap: 0; /* Elimina el espacio entre icono y texto invisible */
  padding-left: 0; /* Elimina paddings laterales para asegurar el centro */
  padding-right: 0;
}

.sidebar .sidebar-nav .nav-link .nav-label {
  transition: opacity 0.3s ease;
}

.sidebar.collapsed .sidebar-nav .nav-link .nav-label {
  opacity: 0;
  pointer-events: none;
  display: none !important;
}

.sidebar-nav .nav-link:hover {
  color: var(--sidebar-hover-text); /* Usa la variable para el texto al pasar el mouse */
  background: var(--sidebar-hover-bg); /* Usa la variable para el fondo al pasar el mouse */
}

.sidebar-nav .nav-item {
  position: relative;
}

.nav-tooltip {
  z-index: 1001; /* Mayor que el sidebar */
}

.sidebar-nav .nav-tooltip {
  position: absolute;
  top: -10px;
  opacity: 0;
  display: none;
  pointer-events: none;
  padding: 6px 12px;
  border-radius: 8px;
  white-space: nowrap;
  color: var(--text-color);
  background: var(--sidebar-bg);
  left: calc(100% + 25px);
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
  transition: 0s;
  z-index: 9999;
}

.sidebar.collapsed .sidebar-nav .nav-tooltip {
  display: block;
}

.sidebar-nav .nav-item:hover .nav-tooltip {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(50%);
  transition: all 0.4s ease;
}

.sidebar-nav .secondary-nav {
  bottom: 30px;
  width: 100%;
  padding-bottom: 30px;
  border-top: 2px solid var(--border-color);

}

/* Estilos para el botón de cambio de modo claro/oscuro */
.dark-mode-toggle {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 12px 15px; /* Mismo padding que los demás botones */
  border: 2px solid var(--border-color); /* Borde llamativo */
  background-color: transparent; /* Fondo transparente */
  color: var(--sidebar-text); /* Color del texto */
  cursor: pointer;
  width: 100%;
  border-radius: 8px; /* Mismo border-radius que los demás botones */
  margin-top: 4px; /* Espacio superior para separarlo del botón "Settings" */
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.dark-mode-toggle:hover {
  background-color: var(--sidebar-hover-bg); /* Fondo al pasar el mouse */
  color: var(--sidebar-hover-text); /* Color del texto al pasar el mouse */
  border-color: var(--hover-color); /* Cambia el color del borde al pasar el mouse */
}

.dark-mode-toggle span {
  font-size: 1rem; /* Tamaño del ícono */
}

/* Responsive para telefonos y tablets */
@media (max-width: 1024px) {
  .sidebar {
    height: 56px; 
    width: calc(100% - 26px) !important;
    display: block; 
    overflow-y: hidden; 
    padding-bottom: 15px;
    margin: 13px;
    
    /* MAGIA AL CERRAR: El scroll desaparece instantáneamente (0s) mientras la caja se encoge en 0.4s */
    transition: all 0.4s ease, overflow-y 0s 0s !important;
  }

  .sidebar.menu-active {
    max-height: calc(100vh - 26px); 
    display: flex; 
    flex-direction: column;
    overflow-y: auto; 
    
    /* MAGIA AL ABRIR: Espera exactamente 0.4s (lo que dura la animación) para habilitar la barra de scroll */
    transition: all 0.4s ease, overflow-y 0s 0.4s !important;
  }

  .sidebar .sidebar-header {
    position: sticky;
    top: 0;
    z-index: 20;
    border-radius: 16px;
    background: var(--header-color);
    padding: 8px 10px;
  }

  .sidebar-header .header-logo img {
    width: 40px;
    height: 40px;
  }

  .sidebar-header .sidebar-toggler,
  .sidebar-nav .nav-item:hover .nav-tooltip {
    display: none;
  }

  .sidebar-header .menu-toggler {
    display: flex;
    height: 38px;
    width: 38px;
    margin-left: auto; /* MAGIA: Esto lo ancla a la derecha aunque la flecha "volver" desaparezca */
  }

  .sidebar-header .menu-toggler span {
    font-size: 1.8rem;
  }

  .sidebar .sidebar-nav .nav-list {
    padding: 0 10px;
  }
  
  .primary-nav {
    flex: none; /* Quitamos la elasticidad en móvil */
  }

  .sidebar-nav {
    display: block; /* En móvil dejamos que fluya normal */
    height: auto;
    overflow: visible;
  }

  .sidebar-nav .nav-link {
    gap: 10px;
    padding: 10px;
    font-size: 0.94rem;
  }

  .sidebar-nav .nav-link .nav-icon {
    font-size: 1.37rem;
  }

  .sidebar-nav .secondary-nav {
    position: relative;
    bottom: 0;
    margin: 15px 0 0;
    /* MAGIA 3: Anulamos el relleno de 30px que heredaba de la versión de PC */
    padding-bottom: 10px;
  }

  .sidebar.menu-active .primary-nav {
    overflow-y: visible; /* Desactiva scroll interno en móvil (opcional) */
  }
}

/****** Estilos para la barra de búsqueda ******/
.search-container {
  display: flex;
  align-items: center;
  background: var(--sidebar-hover-bg);
  border-radius: 8px;
  padding: 8px 15px;
  margin-bottom: 20px;
  width: 100%;
  max-width: 400px;
  border: 1px solid var(--hover-boton);
}

.search-container .material-symbols-rounded {
  color: var(--text-color);
  margin-right: 10px;
  user-select: none;
}

#search-input {
  border: none;
  background: transparent;
  width: 100%;
  color: var(--text-color);
  font-size: 14px;
}

#search-input::placeholder {
  color: var(--text-color);
  opacity: 0.7;
}

#search-input:focus {
  outline: none;
}

.clear-button {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: var(--text-color);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.search-container:hover .clear-button,
#search-input:not(:placeholder-shown) + .clear-button {
  opacity: 0.7;
}

.clear-button:hover {
  opacity: 1 !important;
}

/****** Notificaciones ******/

.notification-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  
  /* MAGIA ANTI-SCROLL UNIFICADA */
  overflow-x: hidden !important; 
  overflow-y: hidden !important;
  padding-right: 15px !important;
  max-width: 320px !important; 
}

/* Oculta el contenedor si no hay notificaciones para que no estorbe los clics */
.notification-container:empty {
  display: none;
}

.notificacion {
  /* Estética original del Index */
  background: var(--header-color);
  color: var(--sidebar-text);
  border-left: 4px solid var(--sidebar-bg);
  border-radius: 8px;
  box-shadow: var(--box-shadow);
  
  display: flex;
  align-items: center;
  gap: 10px;
  
  /* Proporciones elegantes y blindadas */
  font-size: 0.95rem !important;
  font-family: "Poppins", sans-serif !important;
  line-height: 1.25 !important;
  padding: 10px 14px !important;
  min-width: 250px !important; 
  
  /* Animación base oculta */
  opacity: 0;
  transform: translateX(120%); 
  transition: all 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55) !important;
}

.notificacion {
  --icon-color: white; 
}

/* La llave para que la notificación entre a la pantalla */
.notificacion.show {
  transform: translateX(0) !important;
  opacity: 1 !important;
}

.notificacion .material-symbols-rounded {
  color: var(--icon-color) !important;
  user-select: none;
  
  /* Blindaje del ícono para que no se deforme */
  font-size: 24px !important;
  width: 24px !important;
  height: 24px !important;
  flex-shrink: 0 !important; 
  display: inline-block !important;
  overflow: hidden !important;
}

.notification-text {
  flex: 1;
}

/****** Nuevos estilos para el contenido principal ******/
.main-content {
  margin-left: 302px;
  height: 100vh; /* Ocupa toda la altura de la pantalla */
  display: flex;
  flex-direction: column;
  padding: 15px;
  transition: margin 0.4s ease;
  background-color: var(--bg-body-color);
  color: var(--text-color);
  overflow-x: hidden;
}

.sidebar.collapsed + .main-content {
  margin-left: 117px; /* Ancho de la barra lateral colapsada + margen */
}

main.main {
  flex: 1; /* Ocupa el espacio sobrante */
  margin-bottom: 20px;
}

.main-header {
  background-color: var(--bg-color);
  padding: 20px;
  border-radius: 16px;
  box-shadow: var(--box-shadow);
  color: var(--text-color);
  margin-bottom: 20px;
}

.main-header h1 {
  font-size: 2.3rem;
  margin: 0;
  text-transform:uppercase;
}

.main-nav ul {
  list-style: none;
  padding: 0;
  display: flex;
  gap: 20px;
  margin-top: 10px;
}

.main-nav ul li a {
  color: var(--text-color);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.4s ease;
}

.main-nav ul li a:hover {
  color: var(--hover-color);
  transition: color 0.4s ease;
}

.main {
  background-color: var(--bg-color);
  padding: 20px;
  border-radius: 16px;
  box-shadow: var(--box-shadow);
}

.intro {
  text-align: center;
  margin-bottom: 20px;
}

.intro h2 {
  font-size: 28px;
  color: var(--text-color);
  margin-bottom: 10px;
}

.intro p {
  font-size: 16px;
  color: var(--text-color);
  text-align: justify
}

/* Estilos para las instituciones */
.instituciones {
  margin-top: 20px;
}

.institucion-list {
  display: grid;
  gap: 15px;
  width: 100%;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); /* Valor base reducido */
}

.institucion {
  position: relative;
  background-color: var(--bg-color);
  padding-right: 50px; /* Reserva espacio para el favorito */

  border-radius: 12px;
  box-shadow: var(--box-shadow);
  transition: transform 0.3s ease;
  border: 1px solid var(--border-color);
  min-height: 120px;
  will-change: transform, grid-column;
  display: flex;
  flex-direction: column;

  min-width: 0; /* Rompe el límite mínimo heredado */
  width: 100%; /* Ocupa el ancho disponible */
  padding: 15px; /* Padding relativo */
  box-sizing: border-box; /* Asegura que el padding no sume al ancho */

  align-items: center; /* Centrado vertical */

}

/* Estilos para el logo */
.institucion-logo {
  width: 50px;
  height: 50px;
  object-fit: contain;
  border-radius: 8px;
  flex-shrink: 0;
  
}

/* Contenedor del contenido (título y descripción) */
.institucion-content {
  flex: 1; /* Ocupa todo el espacio disponible */
  min-width: 0; /* Permite que el texto se ajuste */
  max-width: calc(100% - 70px); /* Ajusta este valor según necesites */
  padding-right: 10px; /* Espacio de seguridad */
  align-self: center; /* Asegura centrado */

}

/* Área de favoritos */
.institucion-favorite-area {
  position: absolute;
  right: 20px; /* Igual al padding derecho de la caja */
  top: 50%;
  transform: translateY(-50%);
  width: auto; /* Ancho automático en lugar de porcentaje */
  display: flex;
  justify-content: center;
  align-items: center;
  border-left: 1px solid #444;
  z-index: 5;
}

/* Estilos para el título y descripción */
.institucion h3,
.institucion p {
  width: 100%; /* Ocupan todo el ancho disponible del contenedor */
  margin: 0;
  padding: 0;
}

.institucion h3 {
  font-size: 20px;
  margin-bottom: 8px;
}

.institucion p {
  font-size: 14px;
  line-height: 1.4;
}

.institucion:hover {
  transform: translateY(-5px);
  background-color: var(--sidebar-hover-bg);
}

.institucion-info {
  flex-grow: 1; /* Ocupa el 80% restante (aproximadamente) */
  cursor: pointer; /* Indica que es clickeable para ir al instituto */
  padding-right: 10px; /* Espacio entre el texto y el área de favorito */
}

.institucion-info h3 {
  font-size: 20px;
  color: var(--text-color);
  margin-bottom: 10px;
}

.institucion-info p {
  font-size: 14px;
  color: var(--text-color);
}

.institucion-favorite {
  width: 80px; /* Aproximadamente el 20% del ancho mínimo (280px) */
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer; /* Indica que es clickeable para el favorito */
}

@media (max-width: 480px) {
  .institucion-header {
      gap: 10px;
  }
  .institucion-logo {
      width: 36px;
      height: 36px;
  }

  .institucion-content h3, .institucion-content p {
    white-space: normal !important;
    max-width: 100% !important;
    overflow: visible !important;
    padding-right: 20px;
    padding-bottom: 5px;
  }

  /* Área táctil para móviles */
  .star-icon::after {
    width: 150% !important;
    height: 220% !important;
    top: -60% !important;
    left: -8% !important;
  }
}

/* Versión móvil */
@media (max-width: 768px) {
  .star-icon {
    width: 50px;
    height: 50px;
    font-size: 1.8rem;
  }
  
  .institucion {
    padding: 15px; /* Padding reducido */
    min-height: auto; /* Altura flexible */
  }
  .institucion-logo {
    width: 80px;
    height: 80px;
  }

  .institucion-content h3, .institucion-content p {
    white-space: normal !important;
    max-width: 100% !important;
    overflow: visible !important;
    padding-right: 20px;
    padding-bottom: 5px;
  }

  /* Área táctil para móviles */
  .star-icon::after {
    width: 150% !important;
    height: 220% !important;
    top: -60% !important;
    left: -8% !important;
  }
}

/* Media query para 3 columnas en pantallas más grandes */
@media (max-width: 900px) {

  .institucion-favorite {
    width: 56px; /* Ajustar según el nuevo minmax */
  }

  .institucion-content h3, .institucion-content p {
    white-space: normal !important;
    max-width: 100% !important;
    overflow: visible !important;
    padding-right: 20px;
    padding-bottom: 5px;
  }

  /* Área táctil para móviles */
  .star-icon::after {
    width: 150% !important;
    height: 260% !important;
    top: -80% !important;
    left: -8% !important;
  }
}

/* Media query para 4 columnas en pantallas grandes */
@media (max-width: 1200px) {

  .institucion-logo {
    height: 80px;
    width: 80px;
  }

  .institucion-favorite {
    width: 50px; /* Ajustar según el nuevo minmax */
  }

  .institucion-content h3, .institucion-content p {
    white-space: normal !important;
    max-width: 100% !important;
    overflow: visible !important;
    padding-right: 20px;
    padding-bottom: 5px;
  }

  /* Área táctil para móviles */
  .star-icon::after {
    width: 150% !important;
    height: 260% !important;
    top: -80% !important;
    left: -8% !important;
  }
}

@media (min-width: 1201px) {
  .institucion-content h3, .institucion-content p {
    white-space: normal !important;
    max-width: 100% !important;
    overflow: visible !important;
    padding-right: 20px;
    padding-bottom: 5px;
  }
  .institucion-logo {
    height: 80px;
    width: 80px;
  }
}

/* Estilos para la estrella */
.star-icon {
  position: relative;
  display: flex !important;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  width: 44px;
  height: 44px;
  font-variation-settings: 'FILL' 0;
  color: #777;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 1.5rem;
  background: transparent;
  border-radius: 50%;
  z-index: 10;
  pointer-events: auto; /* Solo la estrella recibe eventos táctiles */
}

.star-icon::after {
  content: '';
  position: absolute;
  width: 150%;
  height: 300%;
  top: -100%;
  left: -1%; /*Reduce la linea de separacion de favoritos*/
}

.star-icon.favorita {
  font-variation-settings: 'FILL' 1;
  color: #FFD700;
  background-color: rgba(255, 215, 0, 0.2) !important;
  padding: 0 !important;
}

.institucion.favorita {
  order: -1;
  border: 2px solid #FFD700;
  background-color: rgba(255, 215, 0, 0.05);
  position: relative;
  overflow: hidden;
  z-index: 1;
  box-shadow: 0 0 15px rgba(255, 215, 0, 0.3);
  animation: pulseBorder 2s infinite;
}

.institucion.favorita::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    135deg,
    rgba(255, 215, 0, 0.1) 0%,
    rgba(255, 215, 0, 0) 50%,
    rgba(255, 215, 0, 0.1) 100%
  );
  z-index: -1;
  border-radius: inherit;
}

@keyframes pulseBorder {
  0% { box-shadow: 0 0 0 0 rgba(255, 215, 0, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(255, 215, 0, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 215, 0, 0); }
}

.star-icon:active {
  transform: scale(1.2);
}

.star-icon:not(.favorita):hover {
  color: #999;
  background-color: rgba(0, 0, 0, 0.05);
}

/* Estilos para la estrella */
.star-icon {
  position: relative;
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  font-variation-settings: 'FILL' 0;
  color: #777;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 1.5rem;
  background: transparent;
  border-radius: 50%;
  z-index: 10;
}

/* Mejoras específicas para táctiles */
@media (pointer: coarse) {
  .institucion {
    user-select: none; /* Evitar selección de texto */
    -webkit-tap-highlight-color: transparent; /* Eliminar resaltado azul al tocar */
  }
  
  .star-icon {
    /* Efecto visual al tocar */
    &:active {
      transform: scale(1.2);
      background-color: rgba(255, 215, 0, 0.3) !important;
    }
  }
  
  /* Asegurar que no haya superposición de eventos */
  .institucion-info, 
  .institucion p {
    pointer-events: auto;
  }
}

.active-touch {
  transform: scale(1.3) !important;
  opacity: 0.8;
  transition: transform 0.1s ease;
}

.institucion-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  gap: 5px;
  max-width: calc(100% - 50px);
  width: 100%; /* Ocupa todo el espacio permitido */
}

.feedback-toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 12px 24px;
  background-color: var(--header-color);
  color: white;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  animation: fadeIn 0.3s, fadeOut 0.3s 2.7s;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

.institucion:not(.favorita) .star-icon.favorita {
  font-variation-settings: 'FILL' 0 !important;
  color: #777 !important;
  background-color: transparent !important;
}

.institucion.favorita .star-icon {
  font-variation-settings: 'FILL' 1;
  color: #FFD700;
  background-color: rgba(255, 215, 0, 0.2);
}

.favorita-loading {
  animation: pulse 0.5s ease;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

/* Corrección de color para enlaces de instituciones */
a.institucion,
a.institucion:visited,
a.institucion:hover,
a.institucion:active {
    color: var(--text-color); /* Usa tu variable de color (negro/blanco) */
    text-decoration: none;    /* Quita el subrayado */
}


/*RESPONSIVE para telefonos Super chicos (Caja instituciones miniaturas)*/

@media (max-width: 360px) {
  /* Propiedades combinadas */
  .institucion {
    width: 100%;
    max-width: 400px;
    min-width: 200px;
    margin: 0 auto;
    flex-direction: column;
    align-items: flex-start;
    padding-right: 0 !important;
  }

  .institucion-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
    justify-content: center;
  }

  /* Combinación de .institucion-favorite-area */
  .institucion-favorite-area {
    position: static !important;
    justify-content: flex-end;
    width: 95% !important;
    max-width: calc(100vw - 50px);
    border-left: none !important;
    border-top: 1px solid var(--border-color);
    margin-top: 24px;
    padding-top: 24px;
  }

  /* Combinación de .star-icon */
  .star-icon {
    width: 36px !important;
    height: 36px !important;
    font-size: 1.2rem !important;
    margin-top: 10px;
    margin-bottom: -12px;
    margin-right: 10px;
    padding: 12px !important;
  }

  /* Propiedades únicas del primer bloque */
  .star-icon::after {
    width: 200% !important;
    height: 160% !important;
    top: -50% !important;
    left: -50% !important;
  }

  /* Propiedades únicas del segundo bloque */
  .institucion-header {
    width: 100% !important;
    max-width: none !important;
  }

  .institucion-content {
    width: 100% !important;
    padding-right: 0 !important;
    transition: all 0.3s ease;
  }

  .institucion-content h3, .institucion-content p {
    white-space: normal !important;
    max-width: 100% !important;
    overflow: visible !important;
    padding-right: 20px;
    padding-bottom: 5px;
  }
}

.footer {
  background-color: var(--footer-bg);
  padding: 20px;
  border-radius: 16px;
  box-shadow: var(--box-shadow);
  text-align: center;
}

.sidebar.collapsed + .footer {
    margin-left: 117px;
}

.footer p {
  font-size: 14px;
  color: var(--text-color);
  margin-top: auto;
}

@media (max-width: 1024px) {
  .main-content {
    position: absolute;
    height: calc(100vh - 60px);
    top: 60px;
    left: 0;
    right: 0;
    margin: 0;
    z-index: 90;
    padding: 10px;
    padding-top: 20px;
  }
  .sidebar {
    width: calc(100% - 26px) !important; /* Ocupa todo el ancho menos el margen */
    margin: 13px; /* Mantenemos el margen */
    height: 56px;
    z-index: 9999;
  }
  .main-content {
    width: 100%;
    margin-left: 0;
  }

  .institucion-list {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); /* Valor base reducido */
  }

  .institucion-content h3, .institucion-content p {
    white-space: normal !important;
    max-width: 100% !important;
    overflow: visible !important;
    padding-right: 20px;
    padding-bottom: 5px;
  }

  /* Área táctil para móviles */
  .star-icon::after {
    width: 150% !important;
    height: 260% !important;
    top: -80% !important;
    left: -8% !important;
  }
}

/* --- TOAST DE ACTUALIZACIÓN DE VERSIÓN CON NUEVO DISEÑO --- */
.update-toast {
    position: fixed;
    /* Centrado exacto en la pantalla */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8); /* Arranca un poco más chico para la animación */
    
    /* Oculto por defecto */
    opacity: 0;
    visibility: hidden;
    
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    box-shadow: 0 15px 50px rgba(0,0,0,0.6); /* Sombra más fuerte para que resalte en el centro */
    border-radius: 16px;
    padding: 25px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 99999; 
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* Animación de "zoom" con rebote suave */
    width: 90%;
    max-width: 350px;
}

/* Clase que se agrega por JS para mostrarlo */
.update-toast.show {
    transform: translate(-50%, -50%) scale(1); /* Vuelve a su tamaño normal */
    opacity: 1;
    visibility: visible;
}

.update-toast-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.icon-update {
    font-size: 35px;
    color: var(--primary-color);
}

.update-text strong {
    display: block;
    font-size: 1.1rem;
    color: var(--text-color);
    margin-bottom: 4px;
}

.update-text p {
    font-size: 0.9rem;
    line-height: 1.4;
    /* MAGIA DEL COLOR: Usa el color de texto del tema actual */
    color: var(--text-color); 
    opacity: 0.85; /* Lo hace apenitas más suave que el título, pero muy blanco en modo oscuro */
}

.update-toast-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 5px;
}

.btn-update-now {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: opacity 0.3s;
}

.btn-update-now:hover {
    opacity: 0.8;
}

.btn-update-later {
    background-color: transparent;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-update-later:hover {
    background-color: var(--sidebar-hover-bg);
}

/* =========================================
   FONDO DIFUMINADO GLOBAL (Backdrop)
   ========================================= */
.backdrop-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5); /* Semi-transparente */
    z-index: 8000; /* Justo debajo del sidebar (9999) y debajo de notificaciones (10000) */
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(2px);
}

.backdrop-menu.active {
    opacity: 1;
    visibility: visible;
}

/* =========================================
   BOTÓN DE INSTALACIÓN FLOTANTE (PWA)
   ========================================= */
.install-container {
    position: fixed;
    /* --- Posición en PC: Arriba a la derecha --- */
    top: 20px;
    right: 20px;
    
    background: var(--header-color);
    padding: 8px 12px;
    border-radius: 50px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    align-items: center;
    gap: 12px;
    z-index: 99990; 
    border: 1px solid rgba(255,255,255,0.1);
    
    /* Animación desde la derecha */
    animation: slideInRight 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes slideInRight {
    from { right: -100px; opacity: 0; }
    to { right: 20px; opacity: 1; }
}

.btn-install {
    background: transparent;
    border: none;
    color: #ffffff; 
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 2px 5px;
    transition: opacity 0.3s;
}

.btn-install:hover {
    opacity: 0.8;
}

/* --- Botón de Info y Tooltip --- */
.install-info-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.btn-info {
    background: rgba(255,255,255,0.2);
    border: none;
    color: #ffffff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
}

.btn-info:hover {
    background: rgba(255,255,255,0.4);
    transform: scale(1.1);
}

/* Como ahora está arriba, el cartelito debe abrirse hacia ABAJO */
.install-tooltip {
    position: absolute;
    top: calc(100% + 15px); /* Aparece debajo del botón */
    right: 0; /* Alineado al borde derecho */
    background: var(--bg-color);
    color: var(--text-color);
    padding: 12px 15px;
    border-radius: 12px;
    font-size: 0.85rem;
    width: 240px;
    text-align: center;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    border: 1px solid var(--border-color);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
}

/* Triangulito apuntando hacia arriba */
.install-tooltip::after {
    content: '';
    position: absolute;
    bottom: 100%;
    right: 8px; /* Lo alinea con el botón de ayuda */
    border-width: 8px;
    border-style: solid;
    border-color: transparent transparent var(--bg-color) transparent;
}

.install-tooltip.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* =========================================
   ADAPTACIÓN PERFECTA PARA CELULAR
   ========================================= */
@media (max-width: 1024px) {
    .sidebar {
      height: 56px; 
      width: calc(100% - 26px) !important;
      display: block; 
      
      /* Oculto por defecto. Cuando el menú se cierra, el scroll desaparece instantáneamente */
      overflow-y: hidden; 
      
      padding-bottom: 40px;
      margin: 13px;
      transition: all 0.4s ease !important;
    }

    @keyframes delayScrollbar {
      0%   { overflow-y: hidden; }
      99%  { overflow-y: hidden; }
      100% { overflow-y: auto; }
    }

    .sidebar.menu-active {
      max-height: calc(100vh - 26px); 
      display: flex; 
      flex-direction: column;
      animation: delayScrollbar 0.4s forwards;
      transition: all 0.4s ease !important;
    }

    /* MAGIA: Movemos el botón de instalar a la izquierda en celulares */
    .install-container {
        right: 75px !important;
        top: 20px !important;
        animation: slideInRightMobile 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
    }

    @keyframes slideInRightMobile {
        from { right: -100px; opacity: 0; }
        to { right: 75px; opacity: 1; }
    }

    .btn-install {
        font-size: 0.8rem;
        gap: 4px;
    }

    .btn-install {
        font-size: 0.8rem;
        gap: 4px;
    }

    .btn-install .material-symbols-rounded {
        font-size: 1.1rem;
    }

    .btn-info {
        width: 24px;
        height: 24px;
    }
    
    .install-tooltip {
        /* Achicamos el cartelito un poco en móvil para que no se salga de la pantalla */
        width: 200px; 
        right: -10px;
    }
}

/* =========================================
   NUEVO BOTÓN VOLVER (Para Menú Carreras)
   ========================================= */
.btn-volver {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    color: var(--text-color);
    text-decoration: none;
    border-radius: 12px;
    transition: background 0.3s ease, transform 0.2s ease;
}

.btn-volver:hover {
    background: var(--sidebar-hover-bg);
}

.btn-volver:active {
    transform: scale(0.9);
}

.btn-volver .material-symbols-rounded {
    font-size: 1.8rem;
}

@media (max-width: 1024px) {
    .btn-volver {
        width: 40px;
        height: 40px;
    }
}

/* =========================================
   BOTÓN VOLVER (Menú Carreras e Institución)
   ========================================= */

/* 1. Diseño idéntico al botón menú y oculto por defecto en PC */
.sidebar-header .btn-volver {
    display: none; 
    align-items: center;
    justify-content: center;
    
    /* MAGIA: Actualizado a 38px para igualar al de Informática */
    width: 38px;
    height: 38px;
    color: var(--text-color);
    background: var(--bg-boton); 
    border-radius: 8px; 
    
    text-decoration: none;
    transition: 0.4s ease;
}

.sidebar-header .btn-volver:hover {
    background: var(--sidebar-hover-bg);
}

.sidebar-header .btn-volver:active {
    transform: scale(0.9);
}

.sidebar-header .btn-volver .material-symbols-rounded {
  font-size: 1.8rem; 
}

/* 2. Comportamiento en Celular / Tablet */
@media (max-width: 1024px) {
    
    /* MAGIA: Ocultamos el logo SOLO si la cabecera tiene un botón "Volver" (como en menu-carreras) */
    .sidebar-header:has(.btn-volver) .header-logo {
        display: none !important; 
    }
    
    /* Mostramos la flecha con su fondo blanco/oscuro */
    .sidebar-header .btn-volver {
        display: flex !important; 
    }

    /* Si el menú se abre, ocultamos la flecha */
    .sidebar.menu-active .sidebar-header .btn-volver {
        display: none !important;
    }
    
    /* Si el menú de Informática se abre, ocultamos la flecha */
    .sidebar.active .header-calc .btn-volver {
        display: none !important;
    }
}

/* =========================================
   TOAST DE INFORMACIÓN GLOBAL (PANTALLA COMPLETA)
   ========================================= */
.toast-pantalla-completa {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(150px); /* Escondido bien abajo por defecto */
    
    background-color: var(--bg-color);
    color: var(--text-color);
    border: 2px solid var(--header-color);
    border-radius: 12px;
    padding: 12px 16px;
    
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    z-index: 100000; /* Siempre por encima de todo */
    width: 90%;
    max-width: 400px;
    
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Clase que activa el JS para hacerlo subir a la pantalla */
.toast-pantalla-completa.mostrar {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    visibility: visible;
}

.toast-pc-contenido {
    display: flex;
    align-items: center;
    gap: 12px;
}

.icono-toast-pc {
    font-size: 2rem !important;
    color: var(--header-color);
}

.toast-pc-texto strong {
    display: block;
    font-size: 0.95rem;
    margin-bottom: 3px;
}

.toast-pc-texto p {
    margin: 0;
    font-size: 0.8rem;
    line-height: 1.3;
    opacity: 0.85;
}

.toast-pc-cerrar {
    background: transparent;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
    transition: opacity 0.2s, transform 0.2s;
}

.toast-pc-cerrar:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* =========================================
   EFECTOS DEL BOTÓN "?" (Pantalla Completa)
   ========================================= */
.btn-info-fullscreen {
    font-size: 1.2rem !important;
    margin-left: auto;
    padding: 6px;
    cursor: pointer; 
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    
    /* MAGIA PARA IGUALAR AL BOTÓN DE INSTALAR */
    color: #f5f5f5 ; /* Siempre blanco puro sin importar el modo */
    opacity: 0.9; /* Casi totalmente opaco para que resalte más que antes */
    font-weight: 400 !important; /* Fuerza un trazo grueso */
    font-variation-settings: 'wght' 700 !important; /* Propiedad especial de Google para engrosar el icono */
}

/* Efecto al pasar el mouse (Hover) */
.btn-info-fullscreen:hover {
    opacity: 1;
    transform: scale(1.15); /* Se agranda un poquito */
    
    /* Como el icono es blanco, le ponemos un fondito blanco semi-transparente al pasar el mouse */
    background-color: var(--primary-color);
}

/* Efecto al hacer clic */
.btn-info-fullscreen:active {
    transform: scale(0.9);
}

/* =========================================
   CAJA CONTENEDORA GLOBAL (Estilo Index)
   ========================================= */
.caja-principal {
    background-color: var(--bg-color);
    padding: 20px;
    border-radius: 16px;
    box-shadow: var(--box-shadow);
    margin-bottom: 20px; /* Deja un espacio elegante si pones otra caja debajo */
}

/* Reducimos un poco el padding en celulares para que las tarjetas no queden apretadas */
@media (max-width: 768px) {
    .caja-principal {
        padding: 15px;
    }
}

/* =========================================
   SISTEMA UNIVERSAL DE TARJETAS (UI KIT)
   ========================================= */

/* 1. LA CUADRÍCULA (Reemplaza a .carreras-grid y .servicios-grid) */
.grid-universal {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
    padding-bottom: 20px;
}

/* 2. LA TARJETA BASE (El ADN compartido) */
.card-universal {
    background: var(--bg-color);
    border-radius: 14px;
    text-decoration: none;
    color: var(--text-color);
    box-shadow: var(--box-shadow);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    display: flex;
    overflow: hidden;
    position: relative;
}

/* Efecto al pasar el mouse (Levitación) */
.card-universal:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.12);
}

/* 3. MODIFICADOR A: TARJETA HORIZONTAL (Para Carreras) */
.card-horizontal {
    flex-direction: row;
    align-items: center;
    gap: 15px;
    padding: 20px;
    border-top: 5px solid var(--card-color, var(--header-color));
}

/* 4. MODIFICADOR B: TARJETA VERTICAL (Para Servicios) */
.card-vertical {
    flex-direction: column;
    height: 100%;
}

.card-vertical:hover {
    border-color: var(--header-color); /* Borde de color al pasar el mouse */
}

/* Cabecera para la tarjeta vertical */
.card-vertical .card-header {
    background: rgba(0,0,0,0.03);
    padding: 12px 20px;
    font-size: 0.85rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid var(--border-color);
    opacity: 0.8;
}

/* Contenido de la tarjeta vertical */
.card-vertical .card-body {
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 15px;
    flex-grow: 1;
}

/* 5. ICONOS UNIVERSALES */
.card-icon {
    width: 50px;
    height: 50px;
    min-width: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-boton-icon);
    border-radius: 10px;
    color: var(--header-color);
    font-size: 1.8rem;
    transition: all 0.3s ease;
}

.card-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Efecto de color al pasar el mouse (Especial para los Servicios) */
.card-vertical:hover .card-icon {
    background: var(--header-color);
    color: #ffffff;
}

/* 6. TEXTOS Y ETIQUETAS */
.card-info h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 5px;
    line-height: 1.2;
}

.card-info p {
    font-size: 0.85rem;
    opacity: 0.8;
    line-height: 1.4;
    margin: 0;
}

/* Etiqueta de duración (Ej: "4 Años") */
.badge-info {
    font-size: 0.8rem;
    color: var(--text-color);
    background: rgba(0,0,0,0.05);
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
}

/* =========================================
   ESTADO ESPECIAL: CARRERA CERRADA
   ========================================= */
.card-universal.cerrada {
    filter: grayscale(100%);
    opacity: 0.7;
    cursor: not-allowed;
    border-top-color: #888 !important;
}

.card-universal.cerrada:hover {
    transform: none;
    box-shadow: var(--box-shadow);
}

.badge-cerrada {
    font-size: 0.7rem;
    background: #d32f2f;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
}

/* =========================================
   AJUSTES FINOS DE ICONOS Y FALLBACK (UI KIT)
   ========================================= */

/* 1. Ajuste de tamaño para los iconos de los Servicios (Vertical) */
.card-vertical .card-icon {
    width: 60px; 
    height: 60px;
    min-width: 60px; /* MAGIA 1: Le dice al navegador el tamaño mínimo estricto */
    flex-shrink: 0;  /* MAGIA 2: Prohíbe terminantemente que el texto aplaste al icono */
}

.card-vertical .card-icon .material-symbols-rounded {
    font-size: 2.2rem; /* Tamaño vistoso de la fuente */
}

/* 2. El icono de respaldo (Material Icon) oculto por defecto en Carreras */
.fallback-icon {
    font-size: 2rem;
    color: var(--card-color, var(--header-color)); /* Hereda el color de la carrera */
    display: none;
}

/* 3. MAGIA: Si la imagen falla y se oculta (display:none), mostramos el icono de respaldo */
.card-icon img[style*="display: none"] + .fallback-icon {
    display: block;
}

/* =========================================
   TÍTULOS DE GRUPOS (Ej: Tecnicaturas y Profesorados)
   ========================================= */
.grupo-carreras {
    margin-bottom: 5px; /* Un pequeño margen para respirar dentro de la caja */
}

.grupo-titulo {
    font-size: 1.2rem;
    color: var(--text-color);
    margin-bottom: 20px;
    
    /* MAGIA 1: La barra de color institucional a la izquierda */
    border-left: 4px solid var(--header-color); 
    padding-left: 15px;
    
    /* MAGIA 2: Transforma el texto a MAYÚSCULAS automáticamente */
    text-transform: uppercase; 
    letter-spacing: 1px;
    font-weight: 700;
}

/* =========================================
   ENCABEZADOS UNIVERSALES (page-header)
   ========================================= */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.header-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.header-content h1 {
    font-size: 1.8rem;
    color: var(--text-color);
    margin: 0 0 5px 0;
}

.header-content p {
    font-size: 0.95rem;
    margin: 0;
    opacity: 0.8;
    display: flex;
    align-items: center;
    gap: 5px; /* Separa el iconito del texto */
}

/* Le damos color institucional al icono de ubicación (si lo hay) */
.header-content .material-symbols-rounded {
    font-size: 1.2rem;
    color: var(--header-color);
}

/* Blindaje del Logo */
.header-institution-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
    flex-shrink: 0; /* MAGIA: Evita que el texto aplaste a la imagen */
}

/* Ajuste fino para celulares pequeños */
@media (max-width: 480px) {
    .page-header {
        gap: 15px;
    }
    .header-content h1 {
        font-size: 1.4rem;
    }
    .header-institution-logo {
        width: 60px;
        height: 60px;
    }
}

/* =========================================
   ICONO DE UBICACIÓN (Index Principal)
   ========================================= */
.ubicacion-icon {
    /* MAGIA VISUAL: Color rojo clásico de los pines de mapa */
    color: #c62828 !important; 
    
    /* Tamaño equilibrado respecto al texto */
    font-size: 1.4rem !important;

    /* MAGIA DEL RELLENO: Cambia el icono de borde (0) a sólido (1) */
    font-variation-settings: 'FILL' 1 !important;
}

/* Centrado perfecto usando Flexbox para los párrafos de las tarjetas */
.institucion-content p {
    display: flex;
    align-items: center;
    gap: 4px; /* Un pequeño aire entre el pin rojo y el nombre de la ciudad */
}

/* Alineación profesional para los encabezados de página */
.page-header.caja-principal {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    text-align: left !important;
    gap: 1.5rem !important;
}

.page-header .header-content {
    text-align: left !important;
    margin: 0 !important;
}

/* Efecto para el logo de Bella Vista:
   Como en index.html el enlace tiene data-id="isfd-bella-vista", 
   nuestro motor lo detecta. Para el logo, usaremos una regla que 
   aplique el borde redondeado solo cuando sea el de Bella Vista.
*/
.header-institution-logo {
    margin: 0 !important;
    transition: border-radius 0.3s ease;
}

/* Seleccionamos el logo por su ID o por el contexto del ISFD BV */
#inst-logo[src*="logo-isfd-bv"], 
#menu-inst-logo[src*="logo-isfd-bv"] {
    border-radius: 12px; /* Mismo redondeo que tus tarjetas */
    padding: 5px;
    background: var(--bg-color);
}

/* =========================================
   VISIBILIDAD EN MODO OSCURO (info.html)
   ========================================= */

/* 1. TÍTULO PRINCIPAL (Texto blanco puro, sin bloques) */
.dark-mode .info-header-title {
    background-color: transparent !important;
    color: #ffffff !important; /* MAGIA: Texto en blanco puro */
    box-shadow: none !important;
    padding: 0 !important;
}

/* 2. ICONO DEL TÍTULO PRINCIPAL (Violeta brillante) */
.dark-mode .info-header-title .material-symbols-rounded {
    color: #5e41ff !important; /* MAGIA: Icono en violeta para que contraste */
}

/* 3. PESTAÑA ACTIVA (Violeta) */
.dark-mode .main-nav ul li a.nav-active {
    background-color: transparent !important; 
    color: #5e41ff !important; 
    padding: 0 !important;
    border-radius: 0 !important;
}

.dark-mode .main-nav ul li a.nav-active::after {
    display: block !important;
    background-color: #5e41ff !important;
}

/* 4. BLINDAJE DEL MAIN: Títulos e iconos oscuros dentro del contenido */

/* A. Títulos H2, H3 y H4 (Violeta para mantener la armonía) */
.dark-mode #info-contenido h2,
.dark-mode #info-contenido h3,
.dark-mode #info-contenido h4 {
    background-color: transparent !important; 
    color: #5e41ff !important; 
    padding: 0 !important;
    display: block !important;
    margin-bottom: 15px;
}

/* B. Íconos de la sección de información (Pastilla con ícono Violeta unificado) */
.dark-mode #info-contenido span[style*="var(--header-color)"] {
    background-color: var(--text-color); /* Mantiene el fondo clarito de la pastilla */
    color: #5e41ff !important; /* MAGIA: Reemplazamos el azul oscuro heredado por tu Violeta */
    padding: 4px 12px;
    border-radius: 8px;
    display: inline-block; 
}

/* 5. Corrección de alineación del logo */
#info-contenido img {
    display: block;
    margin: 0 auto 15px auto !important;
}










/* =========================================
   ESTILOS PÁGINA DE INFORMACIÓN (info.html)
   ========================================= */

/* 1. Título principal dinámico */
.info-header-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 !important;
    text-transform: none !important; /* Evita que se ponga todo en mayúsculas */
}

/* 2. Ícono del título */
.info-header-title .material-symbols-rounded {
    font-size: 2.8rem !important;
    color: var(--header-color);
}

/* 3. Indicador de Pestaña Activa en el Menú */
.main-nav ul li a.nav-active {
    color: var(--header-color);
    font-weight: 700;
    position: relative;
}

/* La rayita debajo de la pestaña activa */
.main-nav ul li a.nav-active::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: var(--header-color);
    border-radius: 2px;
}

/* =========================================
   MODAL DE FOTOS (Línea de Tiempo) (info.html)
   ========================================= */
.foto-modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.foto-modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.foto-modal-content {
    position: relative;
    max-width: 90%;
    max-height: 80vh;
    animation: zoomIn 0.3s ease;
}

.foto-modal-content img {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    object-fit: contain;
}

.btn-cerrar-foto {
    position: absolute;
    top: -15px;
    right: -15px;
    background: var(--header-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

@keyframes zoomIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}



















/* =========================================
   TARJETAS DE RECURSOS (recursos.html)
   ========================================= */
.recurso-card {
    display: flex;
    align-items: center;
    background: var(--bg-button-check);
    border: 1px solid var(--border-color);
    padding: 15px 20px;
    border-radius: 12px;
    margin-bottom: 15px;
    text-decoration: none;
    color: var(--text-color);
    transition: all 0.2s ease;
}

.recurso-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-color: var(--primary-color);
}

.recurso-icon {
    font-size: 2rem;
    color: var(--primary-color);
    margin-right: 15px;
}

.recurso-info h3 { 
    margin: 0 0 5px 0; 
    font-size: 1.1rem; 
}

.recurso-info p { 
    margin: 0; 
    font-size: 0.85rem; 
    opacity: 0.7; 
}

.recurso-arrow { 
    margin-left: auto; 
    opacity: 0.5; 
}

/* =========================================
   SISTEMA DEL VISOR DE DRIVE (MODAL) (recursos.html)
   ========================================= */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    /* CORRECCIÓN: Fondo negro con 85% de opacidad para que sea transparente en ambos modos */
    background-color: rgba(0, 0, 0, 0.85); 
    z-index: 99999; 
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-oculto {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* =========================================
   BOTONES INTERNOS PARA RECURSOS AGRUPADOS (recursos.html)
   ========================================= */
.btn-recurso-interno {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-body-color); 
    color: var(--text-color);
    padding: 10px 15px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    /* CORRECCIÓN: Usamos el color de borde estándar para que no resalte tanto hasta que pases el mouse */
    border: 1px solid var(--border-color); 
    transition: all 0.2s ease;
}

.btn-recurso-interno .material-symbols-rounded {
    font-size: 1.3rem;
    /* CORRECCIÓN: Usamos el color principal de la app (Violeta en claro, oscuro en Dark Mode) */
    color: var(--header-color); 
    transition: color 0.2s ease;
}

.btn-recurso-interno:hover {
    /* CORRECCIÓN: Al pasar el mouse, toma el color institucional */
    background: var(--header-color); 
    color: #ffffff;
    border-color: var(--header-color); 
    transform: translateX(5px); 
}

.btn-recurso-interno:hover .material-symbols-rounded {
    color: #ffffff; /* El ícono se vuelve blanco al pasar el mouse */
}