/* Grid:Capacitacion-grid
   Card:Capacitacion-card
   Card-Title:Curso-title
*/

.Capacitacion-grid {
    max-width: 1300px;
    margin: 60px auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
}

/* Card Styles */
.Capacitacion-card {
    background: var(--card-bg); /* Variable crucial */
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-card);
    transition: all 0.3s ease;
    border: 1px solid var(--border-color); /* Borde sutil */
    position: relative;
    cursor: pointer;
}

.Capacitacion-card:hover {
    transform: translateY(-8px);
    /* En dark mode esto hará un resplandor azul */
    box-shadow: 0 15px 30px rgba(0,0,0,0.1), var(--neon-glow); 
    border-color: var(--brand-blue);
}

.Capacitacion-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

/* Efecto de zoom en la imagen al hacer hover */
.Capacitacion-card:hover img {
    transform: scale(1.05);
}

/* Card Title */
.Curso-title {
    font-family: var(--font-Family-2);
    padding: 18px 20px;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-main);
    background: var(--card-bg); /* Variable crucial */
    position: relative;
    z-index: 2;
}

/* Pequeña línea decorativa naranja bajo el título */
.Curso-title::after {
    content: '';
    display: block;
    width: 40px;
    height: 3px;
    background: var(--brand-orange);
    margin-top: 8px;
    border-radius: 2px;
}
/*=========================== Modal ===============================*/
.modal {
  position: fixed;
  inset: 0;
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 5000;
}

.modal.active { display: flex; }

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(11, 45, 66, 0.8); /* Fondo azul oscuro transparente */
  backdrop-filter: blur(5px);
  animation: fadeIn .3s ease;
}

.modal-box {
  position: relative;
  background: var(--card-bg);
  /* REACCIÓN A PANTALLAS: Usar min/max para ancho */
  width: min(90%, 550px);
  /* Ajuste de altura para mejor scroll en pantallas pequeñas */
  max-height: 95vh; 
  /* AJUSTE CLAVE: Aumentar padding inferior para evitar corte */
  padding: 30px 30px 45px; 
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.3);
  animation: modalSlideUp .4s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 10;
  overflow-y: auto; 
  color: var(--text-main);
}

/* RESPONSIVE para que la imagen y el título no se vean muy grandes en móvil */
@media (max-width: 500px) {
    .modal-box {
        /* Reducir padding en móviles */
        padding: 20px 20px 30px; 
    }
    .modal-title {
        font-size: 1.5rem;
    }
    .modal-img {
        height: 150px; /* Reducir alto de imagen */
    }
    /* Ajuste para el scroll area en móvil */
    .modal-cursos {
        max-height: 50vh; /* Permitir más espacio vertical si es necesario */
    }
}


.modal-img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 20px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.modal-title {
  font-family: var(--font-Family-2);
  font-size: 1.8rem;
  margin-bottom: 10px;
  color: var(--brand-blue); /* Título Azul */
  font-weight: 800;
}

.modal-desc {
  font-family: var(--font-Family-1);
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 25px;
}

.modal-btn {
  margin-top: 20px;
  padding: 10px 20px;
  border-radius: 8px;
  background: var(--btn-bg);
  color: white;
  border: none;
  cursor: pointer;
  transition: .25s;
}

.modal-btn:hover {
  background: var(--btn-bg-hover);
}

.modal-close {
  position: absolute;
  top: 15px;
  right: 15px;
  background: var(--bg-section);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  color: var(--text-main);
  transition: .2s;
}
.modal-close:hover {
  background: var(--brand-orange);
  color: white;
}

@keyframes popIn {
  from { transform: scale(.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-cursos {
  text-align: justify;
  margin-top: 15px;
  /* CAMBIO CLAVE: Usa vh para que el área de scroll sea reactiva a la altura de la pantalla */
  max-height: 40vh;       
  overflow-y: auto;        
  padding-right: 6px;
  animation: fadeIn .4s ease-out;
}
.modal-cursos::-webkit-scrollbar {
  width: 8px;
}
.modal-cursos::-webkit-scrollbar-track {
  background: transparent;
}
.modal-cursos::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 4px;
}

.curso-item {
  background: var(--bg-section); /* Variable */
  padding: 15px 20px;
  border-radius: 12px;
  margin-bottom: 12px;
  display: flex;
  /* Cambio: Por defecto, apilamos texto y botón (mejor para títulos largos) */
  flex-direction: column; 
  align-items: flex-start;
  gap: 8px; 
  
  border: 1px solid var(--border-color);
  transition: 0.2s;
}

/* En desktop, volvemos a poner el botón a la derecha (junto al texto) */
@media (min-width: 501px) {
    .curso-item {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 15px;
    }
}


.curso-item:hover {
    border-color: var(--brand-blue);
    background: var(--bg-input); /* Variable */
    /* Resplandor al hover */
    box-shadow: 0 0 10px rgba(0, 242, 234, 0.1); 
}

/* MEJORA DEL TEXTO DE CURSO */
.curso-item span {
  font-weight: 600;
  color: var(--text-main);
  font-size: 1.1rem; /* Aumentado de 0.95rem a 1.1rem */
  font-family: var(--font-Family-1);
  line-height: 1.4; /* Mejora la legibilidad del texto largo */
  flex-grow: 1; /* Permite que el texto ocupe el espacio restante en desktop */
}


.curso-btn {
  background: var(--brand-orange); /* Botón Naranja */
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: .25s;
  box-shadow: 0 4px 10px rgba(231, 72, 46, 0.2);
  /* Asegura que el botón no se estire en móvil */
  flex-shrink: 0; 
}

.curso-btn:hover {
  background: var(--brand-orange-hover);
  transform: translateY(-2px);
}

@keyframes modalSlideUp { from { opacity: 0; transform: translateY(40px) scale(0.95); } to { opacity: 1; transform: translateY(0) scale(1); } }

@keyframes itemAppear {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
/**=========================== Modal Publico ===============================*/
/* Modal especial más grande */
.modal-publicos-box {
  /* Inherits from .modal-box, just wider */
  width: min(90%, 900px); 
  max-height: 95vh; 
  overflow-y: auto;
  padding: 30px; /* Asegurar padding también para este modal */
}

/* Tabs */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--border-color);
  margin-bottom: 15px;
}

.tab {
  padding: 10px 18px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-weight: 600;
  color: var(--text-main);
  transition: .2s;
}

.tab.active {
  color: var(--primary);
  border-bottom: 3px solid var(--primary);
}

.tab:hover {
  color: var(--primary);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Scroll personalizado dentro del modal especial */
.modal-publicos-box {
  scrollbar-width: thin;
}

.modal-publicos-box::-webkit-scrollbar {
  width: 8px;
}

.modal-publicos-box::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 4px;
}
.tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

.tab-btn {
  flex: 1;
  padding: 10px;
  background: var(--bg-section);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: 0.25s;
}

.tab-btn.active {
  background: var(--btn-bg);
  color: white;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}
/* Modal especial más grande (eliminando redundancia de la definición anterior) */
/* El padding ya se define arriba, solo aseguro el ancho y alto máximo */
.modal-publicos-box {
  width: min(90%, 900px);
  max-height: 95vh;
  overflow-y: auto;
  border-radius: 20px;
}
.calendar-wrapper {
    position: relative;
    width: 100%;
    /* Truco para mantener proporción (opcional) o dejar que el iframe mande */
    overflow: hidden; 
    border-radius: 12px;
    background: #fff;
}
.modal-subtitle {
  font-family: var(--font-Family-1); /* Usa la fuente de texto normal (Arial) */
  font-size: 1rem;                   /* Tamaño más pequeño que el título */
  color: var(--brand-orange);        /* Naranja para resaltar que es una instrucción */
  font-weight: 500;                  /* Grosor medio */
  margin-top: -5px;                  /* Lo acerca visualmente al título de arriba */
  margin-bottom: 20px;               /* Da espacio antes de que empiece el calendario */
  line-height: 1.4;
}
@media (max-width: 600px) {
    /* Quitamos el padding exagerado del modal para ganar espacio */
    .modal-publicos-box {
        padding: 15px !important; /* Más pegadito a los bordes */
        width: 95% !important;    /* Que ocupe casi toda la pantalla */
        max-height: 90vh;
    }

    /* Permitimos scroll horizontal si el calendario de Google se pone rebelde */
    .calendar-wrapper {
        overflow-x: auto; 
        -webkit-overflow-scrolling: touch;
    }
    
    /* Forzamos al iframe a tener una altura decente en móvil */
    .calendar-wrapper iframe {
        min-height: 400px;
    }
    
    /* Reducimos el tamaño del título del modal */
    .modal-publicos-box .modal-title {
        font-size: 1.3rem;
        margin-bottom: 15px;
    }
    .modal-subtitle {
    font-size: 0.9rem;
  }
    
}