/* ===== MODALES CON SCROLL INTERNO ===== */

.modals-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  pointer-events: none;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 1001;
}

.modal[aria-hidden="false"] {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: all;
}

.modal[aria-hidden="false"] .modal-overlay {
  opacity: 1;
}

.modal-content {
  color: var(--color-azul);
  background: var(--color-gris);
  border-radius: 12px;
  width: 100%;
  max-width: 500px;
  min-height: 75vh;
  max-height: 75vh; /* ← LÍMITE DE ALTURA */
  display: flex;
  flex-direction: column;
  z-index: 1002;
  position: relative;
  transform: translateY(20px);
  transition: transform 0.3s ease;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  pointer-events: all;
  overflow: hidden; /* ← IMPORTANTE: contenedor no hace scroll */
}

.modal[aria-hidden="false"] .modal-content {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #e0e0e0;
  background: var(--color-azul);
  color: white;
  flex-shrink: 0; /* ← No se encoge */
}

.modal-header h2 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 600;
}

.modal-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s ease;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ===== CUERPO DEL MODAL CON SCROLL ===== */
.modal-body {
  padding: 20px;
  flex: 1; /* ← Ocupa espacio disponible */
  overflow-y: auto; /* ← ¡SCROLL INTERNO AQUÍ! */
  max-height: calc(90vh - 140px); /* ← Altura máxima calculada */
}

/* Personalizar scrollbar para modal */
.modal-body::-webkit-scrollbar {
  width: 8px;
}

.modal-body::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb {
  background: #2c5aa0;
  border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
  background: #1e3a68;
}

/* ===== FOOTER DEL MODAL (opcional) ===== */
.modal-footer {
  padding: 15px 20px;
  border-top: 1px solid #e0e0e0;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-shrink: 0; /* ← No se encoge */
  background: #f8f9fa;
}

/* ===== CONTENIDO LARGO DE EJEMPLO ===== */
.long-content {
  padding: 10px 0;
}

.long-content p {
  margin-bottom: 15px;
  line-height: 1.6;
}

.long-content h3 {
  color: #2c5aa0;
  margin: 25px 0 15px 0;
  padding-bottom: 10px;
  border-bottom: 2px solid #e0e0e0;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  .modal {
    padding: 10px;
  }
  
  .modal-content {
    max-height: 95vh; /* Más alto en móviles */
    max-width: 100%;
    border-radius: 8px;
  }
  
  .modal-body {
    max-height: calc(95vh - 140px);
  }
  
  .modal-header {
    padding: 15px;
  }
  
  .modal-header h2 {
    font-size: 1.1rem;
  }
}

/* ===== PARA DEMOSTRACIÓN (puedes eliminar) ===== */
.demo-tall-content {
  height: 1500px; /* Contenido muy alto para probar scroll */
  background: linear-gradient(180deg, #f8f9fa, #e9ecef);
  padding: 20px;
  border-radius: 8px;
}