 :root {
    --blue: #2f3b7a;
    --blue-dark: #2c3570;
    --gold: #d2a23c;
     --bg: #efefef;
     --card: #ffffff;
     --text: #2a2a2a;
 }
 
 * {
     box-sizing: border-box;
 }
 
body {
    margin: 0;
    font-family: "Montserrat", sans-serif;
    background: var(--bg);
    color: var(--text);
}

.main-header {
    background: var(--blue);
    color: #ffffff;
    padding: 40px 16px;
    text-align: center;
    position: relative;
    overflow: hidden;
    border-bottom: 5px solid #c62828; /* Línea roja pegada al header */
}

.header-content {
    position: relative;
    z-index: 5;
}

.deco-image {
    position: absolute;
    bottom: 0;
    height: 100%;
    width: auto;
    max-width: 300px; /* Limite de ancho para que no sean gigantes */
    object-fit: contain;
    z-index: 1;
    pointer-events: none;
}

.deco-left {
    left: 0;
}

.deco-right {
    right: 0;
}

@media (max-width: 1200px) {
    .deco-image {
        opacity: 0.3;
        height: 80%;
    }
}

@media (max-width: 900px) {
    .deco-image {
        display: none;
    }
}

.header-title {
    margin: 0;
    font-size: 48px;
    font-weight: 800;
    letter-spacing: 2px;
}

.header-logo {
    display: block;
    margin: 15px auto;
    width: 400px;
    height: auto;
}

.header-subtitle {
    margin: 8px 0 0;
    font-size: 18px;
    font-weight: 400;
    opacity: 0.9;
}
 
.container {
    max-width: 1100px;
    margin: 30px auto 48px;
    padding: 0 16px;
}

/* Filtros */
.filters-wrapper {
    margin-top: 30px;
    margin-bottom: 40px;
}

.filters-box {
    background-color: var(--blue);
    padding: 20px;
    border-radius: 10px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    position: relative; /* Para z-index */
    z-index: 20; /* Asegurar que los dropdowns queden por encima del contenido */
}

/* Ocultar selects nativos cuando se usa el custom select - SE OCULTA POR JS */
.filter-select {
    /* display: none;  <-- ELIMINADO para evitar que desaparezca si falla JS */
}

/* Custom Select Wrapper */
.custom-select-wrapper {
    position: relative;
    user-select: none;
    width: 100%;
}

.custom-select {
    position: relative;
    display: flex;
    flex-direction: column;
}

.custom-select__trigger {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    font-family: "Montserrat", sans-serif;
    font-size: 14px;
    color: var(--text);
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.custom-select__trigger:hover {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
}

.custom-options {
    position: absolute;
    display: block;
    top: 100%;
    left: 0;
    right: 0;
    border-radius: 6px;
    background: #fff;
    transition: all 0.3s;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 100; /* Aumentado para evitar solapamientos */
    margin-top: 5px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    max-height: 200px;
    overflow-y: auto;
}

.custom-select.open .custom-options {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
}

.custom-option {
    position: relative;
    display: block;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 400;
    color: #333;
    cursor: pointer;
    transition: all 0.2s;
}

/* HOVER: Color gris #8b8b8b cuando el mouse se mueve sobre la opción */
.custom-option:hover {
    background-color: #8b8b8b;
    color: #fff;
}

/* SELECTED: Color rojo para la opción activa/seleccionada */
.custom-option.selected {
    background-color: #c62828;
    color: #fff;
}

/* Flecha */
.arrow {
    position: relative;
    height: 10px;
    width: 10px;
}
.arrow::after {
    content: '';
    position: absolute;
    bottom: 2px; /* Ajuste fino */
    right: 0;
    width: 8px;
    height: 8px;
    border-bottom: 2px solid #333;
    border-right: 2px solid #333;
    transform: rotate(45deg);
    transition: all 0.3s;
}
.custom-select.open .arrow::after {
    transform: rotate(225deg);
    bottom: -2px;
}

/* Badge para Formato (Taller/Curso) */
.course-format-tag {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--gold); /* Dorado */
    color: #ffffff;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    box-shadow: 0 2px 4px rgba(0,0,0,0.25);
    letter-spacing: 0.5px;
    z-index: 10;
}

 .courses-grid {
     display: grid;
     grid-template-columns: repeat(3, 1fr);
     gap: 20px;
 }
 
 .course-card {
    background: var(--card);
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    
    /* Animación de entrada y Hover */
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.4s ease, opacity 0.6s ease;
    opacity: 0; /* Inicialmente oculto */
    transform: translateY(30px); /* Inicialmente desplazado hacia abajo */
}

.course-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.course-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
}

.course-image {
    position: relative;
    overflow: hidden; /* Importante para el zoom de la imagen */
}

.course-image img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    display: block;
    transition: transform 0.6s ease;
}

.course-card:hover .course-image img {
    transform: scale(1.08);
}

/* Botón de WhatsApp */
.course-actions {
    margin-top: auto;
    padding-top: 16px;
    display: flex;
    justify-content: center;
    border-top: 1px solid #f0f0f0; /* Separador sutil */
    margin-top: 16px;
}

.btn-whatsapp {
    background-color: #25D366;
    color: white;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-whatsapp svg {
    fill: currentColor;
    width: 20px;
    height: 20px;
}

.btn-whatsapp:hover {
    background-color: #128C7E; /* Verde más oscuro oficial de WA */
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
}

.btn-whatsapp:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.course-type-tag {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: #c62828; /* Rojo oscuro vibrante */
    color: #ffffff;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    box-shadow: 0 2px 4px rgba(0,0,0,0.25);
    letter-spacing: 0.5px;
    z-index: 10;
    transform: rotate(-3deg);
}


 
.course-content {
    padding: 14px 16px 16px;
    border-top: 1px solid #e6e6e6;
}
 
.course-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
    color: var(--dark);
    line-height: 1.3;
}

.course-subtitle {
    font-size: 14px;
    font-weight: 500;
    color: #666; /* Color gris para el tipo, para que contraste con el nivel azul */
    margin-bottom: 12px;
    line-height: 1.4;
}

.course-format {
    color: #c62828; /* Rojo */
    font-weight: 400; /* Normal */
}

.course-level {
    font-weight: 800;
    color: var(--blue);
    text-transform: uppercase; /* Opcional pero queda bien para niveles */
}


 
.course-duration,
.course-area {
    font-weight: 600;
    color: var(--blue);
}

.course-details {
    margin-top: 12px;
    font-family: "Roboto", sans-serif;
    font-size: 13px;
    color: #555;
}

.detail-row {
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
    margin-bottom: 6px;
    line-height: 1.4;
}

.detail-row:last-child {
    margin-bottom: 0;
}

.detail-label {
    font-weight: 600;
    color: var(--blue);
    flex-shrink: 0;
    width: 90px;
    margin-right: 0;
}

.detail-value {
    text-align: left;
    flex: 1;
    color: #333;
}
 
 .loading-text {
     text-align: center;
     color: #666666;
     grid-column: 1 / -1;
 }
 
 @media (max-width: 980px) {
    .courses-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .header-title {
        font-size: 36px;
    }
    
    .header-logo {
        width: 300px;
        margin: 12px auto;
    }
    
    .header-subtitle {
        font-size: 16px;
    }
    
    .courses-grid {
        grid-template-columns: 1fr;
    }
    
    .course-title {
        font-size: 16px;
    }
    
    .course-subtitle {
        font-size: 13px;
    }
    
    .course-details {
        font-size: 12px;
    }
    
    .detail-label {
        width: 75px;
    }
}
