:root {
    --primary-color: #2d6efa;
    --secondary-color: #007bff;
    --text-color: #333;
    --bg-light: #f8f9fa;
    --transition-speed: 0.3s;
    --border-radius: 0.75rem;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
}

/* Base Styles */
body {
    font-family: 'Roboto', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-light);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1 0 auto;
}

/* Typography */
.section-title {
    color: var(--primary-color);
    font-weight: 700;
    margin-bottom: 1.5rem;
    position: relative;
    padding-bottom: 0.5rem;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: var(--primary-color);
    border-radius: 2px;
}

/* Header Styles */
.site-header {
    background-color: #007bff;
    padding: 1rem 0;
    color: white;
}

.site-title {
    margin: 0;
    font-size: 2rem;
    text-align: center; /* Asegura que el título esté centrado */
}

/* Card Styles */
.card {
    border: 1px solid #cccccc; /* Borde ligeramente más oscuro */
    box-shadow: var(--shadow-sm);
    border-radius: var(--border-radius);
    transition: transform var(--transition-speed), box-shadow var(--transition-speed);
    background: white;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.resource-card {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.resource-icon {
    width: 64px;
    height: 64px;
    object-fit: contain;
    margin: 1rem auto;
    transition: transform var(--transition-speed);
}

.resource-card:hover .resource-icon {
    transform: scale(1.1);
}

/* Button Styles */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    font-weight: 500;
    transition: all var(--transition-speed);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
}

/* Footer Styles */
.footer {
    background-color: #f8f9fa;
    padding: 1rem 0;
    text-align: center;
    border-top: 1px solid #e7e7e7;
}

.footer p {
    margin: 0;
    text-align: center;
    font-size: 1rem;
}

.footer a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color var(--transition-speed);
}

.footer a:hover {
    color: var(--secondary-color);
}

/* Video Container */
.ratio {
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

/* Description Section */
.description-section .card-body p {
    max-width: 80%; /* Reducido desde 90% para un párrafo más angosto */
    margin-left: auto;
    margin-right: auto;
}

/* Gallery and Carousel Styles */
.gallery-section {
    background-color: #f8f9fa;
    padding-top: 2rem;
    padding-bottom: 2rem;
    border-radius: var(--border-radius); /* Bordes redondeados igual que las cards */
    border: 1px solid #cccccc; /* Borde añadido similar a las cards */
    box-shadow: var(--shadow-sm); /* Sombra sutil añadida para consistencia */
}

#imageCarousel .carousel-inner {
    border-radius: .25rem; /* Opcional: para esquinas redondeadas si las imágenes no llenan completamente */
    overflow: hidden; /* Asegura que las imágenes respeten el radio del borde */
}

#imageCarousel .carousel-item {
    text-align: center; /* Centra la imagen si es más estrecha que el carrusel */
}

#imageCarousel .carousel-item img {
    display: block; /* Para que el margen automático funcione */
    width: 100%;    /* Intenta llenar el ancho */
    max-height: 450px; /* Altura máxima para las imágenes */
    object-fit: contain; /* Escala para ajustar sin cortar, manteniendo la proporción */
    margin-left: auto;
    margin-right: auto;
}

/* Iconos de control del carrusel: oscurecer los iconos predeterminados de Bootstrap */
#imageCarousel .carousel-control-prev-icon,
#imageCarousel .carousel-control-next-icon {
    filter: invert(1) grayscale(100) brightness(0.5); /* Los hace gris oscuro/negro */
}

/* Indicadores del carrusel (puntos inferiores) */
#imageCarousel .carousel-indicators button {
    background-color: #adb5bd; /* Gris más claro para indicadores inactivos */
}

#imageCarousel .carousel-indicators .active {
    background-color: #343a40; /* Gris más oscuro para el indicador activo */
}

/* Responsive Design */
@media (max-width: 768px) {
    .site-title {
        font-size: 1.5rem;
    }

    .section-title {
        font-size: 1.75rem;
    }

    .resource-icon {
        width: 48px;
        height: 48px;
    }

    .btn-primary {
        padding: 0.5rem 1rem;
    }

    .card-title {
        font-size: 1.1rem;
    }
}

@media (max-width: 576px) {
    .container {
        padding: 1rem;
    }

    .section-title {
        font-size: 1.5rem;
    }

    .lead {
        font-size: 1rem;
    }
}

/* Accessibility */
:focus {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

.btn:focus {
    box-shadow: 0 0 0 3px rgba(45, 110, 250, 0.5);
}

/* Print Styles */
@media print {
    .btn,
    .video-container {
        display: none;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }

    .site-header {
        background: none;
        color: var(--text-color);
    }

    .site-title {
        color: var(--text-color);
    }
}

.lead strong {
    font-weight: bold; /* Asegura que el texto en strong sea negrita */
}

/* Estilos para el carrusel y la superposición de la lupa */
.carousel-image-wrapper {
    position: relative; /* Necesario para posicionar la superposición */
    cursor: pointer; /* Indica que la imagen es clickeable */
}

.magnifying-glass-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.3); /* Fondo semitransparente oscuro */
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0; /* Oculto por defecto */
    transition: opacity 0.3s ease;
}

.carousel-image-wrapper:hover .magnifying-glass-overlay {
    opacity: 1; /* Mostrar al pasar el mouse */
}

.magnifying-glass-overlay i {
    color: white;
    font-size: 2.5rem; /* Tamaño del icono de la lupa */
}

/* Estilos para la modal de imagen */
#imageModal .modal-dialog { /* Asegura que el dialog se expanda */
    max-width: 100%;
    max-height: 100vh; /* Usa vh para altura relativa a la ventana */
    height: 100vh;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

#imageModal .modal-content {
    background-color: transparent; /* Fondo transparente para el contenido del modal */
    border: none;
    box-shadow: none; /* Sin sombra para el contenido del modal */
    height: auto; /* Ajusta la altura al contenido */
    width: auto; /* Ajusta el ancho al contenido */
    display: flex; /* Para centrar la imagen si es más pequeña */
    align-items: center;
    justify-content: center;
}

#imageModal .modal-header {
    border-bottom: none;
    position: absolute; /* Posiciona el header para que no ocupe espacio */
    top: 15px;
    right: 15px;
    z-index: 1056; /* Asegura que esté sobre la imagen */
}

#imageModal .modal-title {
    color: white; /* Aunque no hay título, se mantiene por si se añade */
}

#imageModal .btn-close {
    /* Cambia el SVG del botón de cierre a uno con la X en rojo */
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23FF0000'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3e%3c/svg%3e");
    filter: none; /* Elimina cualquier filtro previo que afecte el color */

    /* Mantiene el fondo del botón para contraste y visibilidad */
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    padding: 0.5em;
    line-height: 0.5; /* Ajuste para centrar el icono si es necesario */
}


#imageModal .modal-body {
    padding: 0; /* Sin padding en el body */
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%; /* Ocupa el ancho del modal-content */
    height: 100%; /* Ocupa la altura del modal-content */
}

#modalImage {
    max-height: 95vh; /* Ligeramente menos que la ventana para dar espacio al botón de cierre */
    max-width: 95vw; /* Ligeramente menos que la ventana */
    object-fit: contain; /* Mantiene la proporción, ajusta dentro de los límites */
    display: block;
    opacity: 1; /* Asegura que la imagen sea visible por defecto */
    transition: opacity 0.3s ease-in-out; /* Transición suave para el efecto de fundido */
}

/* Estilos para los controles de navegación dentro del Modal */
.modal-carousel-control-prev,
.modal-carousel-control-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1057; /* Encima de la imagen pero debajo del header del modal si es necesario */
    background-color: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    width: 50px; /* Ancho del botón */
    height: 50px; /* Alto del botón */
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-carousel-control-prev {
    left: 15px;
}

.modal-carousel-control-next {
    right: 15px;
}

.modal-carousel-control-prev .carousel-control-prev-icon,
.modal-carousel-control-next .carousel-control-next-icon {
    filter: invert(1) grayscale(100) brightness(200%);
    width: 30px; /* Tamaño del icono */
    height: 30px; /* Tamaño del icono */
}