/* ============================================
   VARIABLES Y CONFIGURACIÓN PRINCIPAL
   ============================================ */
:root {
  --primary: #214E92;
  --secondary: #057965;
  --accent: #86A697;
  --gradient-primary: linear-gradient(135deg, #214E92 0%, #057965 100%);
  --gradient-blue: linear-gradient(135deg, #214E92 0%, #86A697 100%);
  --shadow-sm: 0 2px 10px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.1);
}

/* ============================================
   TIPOGRAFÍAS
   ============================================ */
body, .font-nunito { 
  font-family: 'Nunito', sans-serif !important; 
}

.font-poppins { 
  font-family: 'Poppins', sans-serif !important; 
}

/* ============================================
   COMPONENTES PRINCIPALES
   ============================================ */

/* NAVBAR */
.navbar-custom {
  background: white !important;
  box-shadow: var(--shadow-sm);
}

.nav-link { 
  border-radius: 20px; 
  transition: all 0.3s; 
  font-weight: 500;
}

.nav-link:hover { 
  background: var(--gradient-primary); 
  color: white !important; 
  transform: translateY(-2px);
}

/* ============================================
   SUBMENÚS - VERSIÓN NORMAL
   ============================================ */

/* Configuración base para todos los dropdown-submenu */
.dropdown-submenu {
  position: relative;
}

.dropdown-submenu .submenu {
  display: none;
  position: absolute;
  left: 0;
  top: 100%;
  min-width: 100%;
  z-index: 1000;
  border: none !important;
  box-shadow: 0 6px 20px rgba(0,0,0,0.12) !important;
  border-radius: 10px !important;
  padding: 8px 0 !important;
  background: white !important;
  margin-top: 5px !important;
}

/* Indicadores móviles - ocultos por defecto */
.mobile-indicator {
  display: none;
  font-size: 14px;
  font-weight: bold;
}

/* =========== VERSIÓN DESKTOP =========== */
@media (min-width: 992px) {
  /* En desktop, mostrar submenú a la derecha */
  .dropdown-submenu .submenu {
    left: 100%;
    top: 0;
    margin-top: 0 !important;
    margin-left: 5px !important;
    min-width: 300px;
  }
  
  /* Mostrar submenú al hacer hover */
  .dropdown-submenu:hover .submenu {
    display: block;
  }
  
  /* Rotar flecha en hover */
  .dropdown-submenu .submenu-arrow {
    transition: transform 0.3s ease;
  }
  
  .dropdown-submenu:hover .submenu-arrow {
    transform: rotate(90deg);
  }
  
  /* Ocultar indicador móvil en desktop */
  .mobile-indicator {
    display: none !important;
  }
}

/* =========== VERSIÓN MÓVIL =========== */
@media (max-width: 991px) {
  /* En móvil, mostrar submenú debajo del elemento padre */
  .dropdown-submenu .submenu {
    position: static !important;
    width: 100% !important;
    margin: 5px 0 0 0 !important;
    border: none !important;
    box-shadow: inset 3px 0 0 var(--primary) !important;
    border-radius: 0 8px 8px 0 !important;
    padding: 8px 0 8px 20px !important;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%) !important;
  }
  
  /* Ocultar flecha desktop y mostrar indicador móvil */
  .submenu-arrow {
    display: none !important;
  }
  
  .mobile-indicator {
    display: inline !important;
    transition: all 0.3s ease;
  }
  
  /* Estado activo del indicador móvil */
  .submenu-toggle.active .mobile-indicator {
    transform: rotate(45deg);
  }
  
  /* Mostrar submenú cuando esté activo */
  .dropdown-submenu.active .submenu {
    display: block !important;
  }
  
  /* Mejorar items del submenú en móvil */
  .dropdown-submenu .submenu .dropdown-item {
    padding: 6px 12px !important;
    margin: 1px 4px !important;
    font-size: 14px !important;
  }
}

/* Estilos mejorados para los títulos de submenú */
.submenu-toggle {
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%) !important;
  font-weight: 600 !important;
  border: 1px solid #e3e6ea !important;
  border-radius: 8px !important;
  margin: 3px 8px !important;
  padding: 10px 15px !important;
  cursor: pointer !important;
  transition: all 0.3s ease !important;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05) !important;
}

/* Mejorar el dropdown principal */
.dropdown-menu {
  border: none !important;
  box-shadow: 0 8px 25px rgba(0,0,0,0.15) !important;
  border-radius: 12px !important;
  padding: 8px 0 !important;
  margin-top: 8px !important;
  background: white !important;
}

.dropdown-item {
  padding: 6px 16px !important;
  transition: all 0.3s ease !important;
  border-radius: 6px !important;
  margin: 1px 8px !important;
}

.dropdown-item:hover {
  background: #f8f9fa !important;
  color: var(--primary) !important;
  transform: translateX(3px) !important;
}

.dropdown-divider {
  margin: 4px 16px !important;
  border-color: #e9ecef !important;
}

/* ============================================
   RESTO DE ESTILOS
   ============================================ */

/* HERO */
.hero-bg { 
  background: var(--gradient-blue); 
  min-height: 100vh; 
  color: white;
}

.slide-card { 
  background: white; 
  border-radius: 20px; 
  box-shadow: var(--shadow-lg);
}

/* CARDS */
.card-hover {
  transition: all 0.3s;
  border-radius: 15px;
  border: none;
  box-shadow: var(--shadow-md);
  height: 100%;
}

.card-hover:hover { 
  transform: translateY(-5px); 
  box-shadow: 0 15px 35px rgba(0,0,0,0.15);
}

/* ICONOS */
.icon-circle {
  width: 60px;
  height: 60px;
  background: var(--gradient-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.5rem;
  box-shadow: 0 5px 15px rgba(33, 78, 146, 0.3);
  margin: 0 auto 1rem;
}

.contact-icon {
  width: 50px;
  height: 50px;
  background: var(--gradient-primary);
  border-radius: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.3rem;
  flex-shrink: 0;
}

/* BOTONES */
.btn-custom {
  background: var(--gradient-primary);
  border: none;
  border-radius: 25px;
  padding: 0.8rem 2rem;
  color: white;
  font-weight: 600;
  transition: all 0.3s;
  box-shadow: 0 5px 15px rgba(5, 121, 101, 0.3);
}

.btn-custom:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(33, 78, 146, 0.4);
  color: white;
}

/* MODALES */
.modal-custom {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.8);
  z-index: 9999;
  display: none;
  overflow-y: auto;
  align-items: center;
  justify-content: center;
  padding: 0.8rem;
}

.modal-custom.show {
  display: flex;
}

.modal-content-custom {
  background: white;
  border-radius: 20px;
  box-shadow: 0 25px 50px rgba(0,0,0,0.3);
  width: 100%;
  max-width: 700px;
  max-height: 70vh;
  overflow-y: auto;
  position: relative;
  animation: modalSlideIn 0.4s ease-out;
}

.modal-header-gradient {
  background: var(--gradient-primary) !important;
  border-radius: 20px 20px 0 0;
}

.modal-image-container {
  width: 100%;
  height: 220px;
  overflow: hidden;
  border-radius: 15px;
  background: #f8f9fa;
  box-shadow: 0 8px 20px rgba(0,0,0,0.15);
  border: 3px solid #e9ecef;
}

.modal-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.modal-description-text {
  line-height: 1.5;
  font-size: 1.1rem;
  color: #495057;
  text-align: justify;
  min-height: 80px;
  display: flex;
  align-items: center;
}

.modal-details-text {
  line-height: 1.3;
  font-size: 1rem;
  color: #6c757d;
}

.modal-details-text ul {
  padding-left: 1.2rem;
  margin-bottom: 0;
}

.modal-details-text li {
  margin-bottom: 0.8rem;
  padding-left: 0.5rem;
}

.modal-details-text strong {
  color: var(--primary);
  font-weight: 600;
}

.modal-custom .card-body {
  padding: 2rem !important;
}

.modal-custom .btn-custom {
  min-width: 200px;
  font-size: 1.1rem;
  padding: 1rem 2rem;
}

/* FOOTER */
.footer-bg { 
  background: url('img/footer.jpg') center center / cover no-repeat; 
  color: white; 
}

/* ANIMACIONES */
@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-40px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* SCROLL PERSONALIZADO */
.modal-content-custom::-webkit-scrollbar {
  width: 6px;
}

.modal-content-custom::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.modal-content-custom::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 3px;
}

.modal-content-custom::-webkit-scrollbar-thumb:hover {
  background: var(--secondary);
}

/* RESPONSIVE DESIGN */
@media (max-width: 768px) {
  .hero-bg { 
    min-height: auto; 
    padding: 3rem 0 2rem; 
  }
  
  .carousel-item img {
    height: 300px !important;
  }
  
  .icon-circle { 
    width: 50px; 
    height: 50px; 
    font-size: 1.2rem; 
  }
  
  .contact-icon { 
    width: 45px; 
    height: 45px; 
    font-size: 1.1rem; 
  }
  
  .modal-image-container {
    height: 180px;
  }
  
  .modal-content-custom {
    max-width: 95%;
    margin: 1rem;
    border-radius: 15px;
  }
  
  .modal-header-gradient {
    border-radius: 15px 15px 0 0;
  }
  
  .modal-description-text {
    font-size: 1rem;
    min-height: 60px;
  }
}

@media (max-width: 576px) {
  .carousel-item img {
    height: 250px !important;
  }
  
  .modal-image-container {
    height: 160px;
  }
  
  .modal-custom {
    padding: 1rem;
  }
  
  .modal-content-custom {
    max-width: 100%;
    border-radius: 12px;
  }
  
  .modal-header-gradient {
    border-radius: 12px 12px 0 0;
  }
}

@media (max-width: 480px) {
  .carousel-item img {
    height: 200px !important;
  }
}