/* ======== VARIABLES Y CONFIGURACIÓN GENERAL ======== */
:root {
    --color-primary: #1a4b8c;
    --color-primary-dark: #0d3a73;
    --color-primary-light: #e8f0fe;
    --color-accent: #ff6b35;
    --color-accent-secondary: #ff8c42;
    --color-white: #ffffff;
    --color-text: #2d3748;
    --color-text-light: #718096;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.15);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.2);
    --border-radius: 12px;
    --border-radius-lg: 20px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ======== RESET Y BASE ======== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', sans-serif;
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    /* Necesario para posicionar el fondo */
    position: relative;
}

/* ======== IMAGEN DE FONDO APLICADA A TODO EL BODY ======== */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Ruta corregida a la imagen `fondo.jfif` que está en la carpeta `static` */
    background-image: url('../images/fondo.jfif');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.2; /* Opacidad deseada */
    z-index: -1; /* Envía la imagen detrás del contenido */
}

/* ======== NAVBAR MEJORADA ======== */
.navbar {
    background: #007f69 !important;
    box-shadow: var(--shadow-md);
    padding: 1rem 0;
}

.navbar .container {
    max-width: 1200px;
    height: auto !important;
    display: flex;
    justify-content: center;
    align-items: center;
}

.logo {
    width: 250px !important;
    height: 80px !important;
    object-fit: contain;
    transition: var(--transition);
    filter: brightness(0) invert(1);
}

.logo:hover {
    transform: scale(1.05);
    filter: brightness(0) invert(0.9);
}

/* ======== CONTENEDOR PRINCIPAL ======== */
main.container {
    flex: 1;
    max-width: 1200px;
    padding: 2rem 1rem;
    margin-left: auto;
    margin-right: auto;
    position: relative; /* Asegura que el contenido esté encima del fondo */
    z-index: 1; /* Valor mayor que el fondo */
}


/* ======== TIPOGRAFÍA MEJORADA ======== */
.titulo {
    font-size: 3rem;
    font-weight: 800;
    color: var(--color-primary);
    text-align: center;
    margin: 2rem 0 3rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
    background: #1a4b8c;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.bg-dark {
    background-color: #007f69 !important;
}

/* ======== BOTONES MEJORADOS ======== */
.btn-catalogo {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100px;
    padding: 1.5rem 2rem;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: var(--color-white);
    font-size: 1.2rem;
    font-weight: 700;
    border-radius: var(--border-radius-lg);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: var(--shadow-md);
    border: 3px solid transparent;
    transition: var(--transition);
    cursor: pointer;
    width: 100%;
    position: relative;
    overflow: hidden;
}

.btn-catalogo::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: var(--transition);
}

.btn-catalogo:hover {
    background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary) 100%);
    color: var(--color-white);
    border-color: var(--color-accent);
    transform: translateY(-4px) scale(1.02);
    box-shadow: var(--shadow-lg);
}

.btn-catalogo:hover::before {
    left: 100%;
}

/* Botón volver mejorado */
.btn-primary {
    background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-secondary) 100%);
    border: none;
    font-weight: 700;
    padding: 1rem 2.5rem;
    border-radius: var(--border-radius-lg);
    transition: var(--transition);
    color: var(--color-white);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--shadow-md);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--color-accent-secondary) 0%, var(--color-accent) 100%);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    color: var(--color-white);
}

/* ======== GALERÍA MEJORADA ======== */
.row.g-4 {
    margin: 2rem 0;
    display: flex;
    justify-content: center;
    align-content: center;
    width: 100%;
    height: auto;
}

.img-fluid {
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 400px;
    object-fit: contain;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    border: 3px solid transparent;
}

.img-fluid:hover {
    transform: scale(1.05) rotate(1deg);
    box-shadow: var(--shadow-lg);
    border-color: var(--color-accent);
}

/* ======== SISTEMA DE EXPANSIÓN DE IMÁGENES CORREGIDO ======== */
.img-container {
    position: relative;
    overflow: visible;
    transition: transform 0.3s ease;
}

.img-fluid.expandable {
    cursor: zoom-in;
    transition: all 0.4s ease;
    position: relative;
    z-index: 10;
}

/* Estado expandido */
.img-fluid.expanded {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(1);
    z-index: 10000;
    max-height: 85vh;
    max-width: 85vw;
    width: auto;
    height: auto;
    cursor: zoom-out;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.9);
    border-radius: 8px;
    object-fit: contain;
}

/* Overlay de fondo oscuro */
.image-overlay-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.92);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.image-overlay-background.active {
    opacity: 1;
    visibility: visible;
}

/* Overlay de información en miniatura */
.image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 8px;
    pointer-events: none;
}

.img-container:hover .image-overlay {
    opacity: 1;
}

/* Prevenir scroll cuando una imagen está expandida */
body.no-scroll {
    overflow: hidden;
    height: 100vh;
}

/* ======== FOOTER MEJORADO ======== */
footer {
    background-color: #007f69;
    color: var(--color-white);
    padding: 2.5rem 0;
    margin-top: auto;
    text-align: center;
}

footer p {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 500;
}

/* ======== GRID Y LAYOUT MEJORADO ======== */
.row.g-3 {
    margin: 2rem -0.5rem;
}

.col-3, .col-md-3, .col-lg-4 {
    padding: 1rem;
    display: flex;
    justify-content: center;
}

/* ======== RESPONSIVE MEJORADO ======== */
@media (max-width: 1200px) {
    .titulo {
        font-size: 2.5rem;
    }
    
    .btn-catalogo {
        min-height: 90px;
        font-size: 1.1rem;
    }
}

@media (max-width: 768px) {
    .titulo {
        font-size: 2.2rem;
        margin: 1.5rem 0 2rem;
    }
    
    .btn-catalogo {
        min-height: 80px;
        font-size: 1rem;
        padding: 1.2rem 1.5rem;
    }
    
    .logo {
        width: 200px !important;
        height: 60px !important;
    }
    
    .img-fluid {
        height: 220px;
    }
    
    .img-fluid.expanded {
        max-height: 80vh;
        max-width: 80vw;
    }
}

@media (max-width: 576px) {
    .titulo {
        font-size: 1.8rem;
    }
    
    .btn-catalogo {
        min-height: 70px;
        font-size: 0.9rem;
        padding: 1rem 1.2rem;
    }
    
    .logo {
        width: 180px !important;
        height: 50px !important;
    }
    
    .img-fluid {
        height: 200px;
    }
    
    .col-3 {
        flex: 0 0 50%;
        max-width: 50%;
    }
    
    .img-fluid.expanded {
        max-height: 75vh;
        max-width: 75vw;
    }
}

/* ======== ANIMACIONES MEJORADAS ======== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeInUp 0.6s ease-out;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.pulse {
    animation: pulse 2s infinite;
}

/* ======== UTILIDADES ADICIONALES ======== */
.text-gradient {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.shadow-custom {
    box-shadow: var(--shadow-lg);
}

.border-gradient {
    border: 3px solid transparent;
    background: linear-gradient(white, white) padding-box,
                linear-gradient(135deg, var(--color-primary), var(--color-accent)) border-box;
}

/* ======== ESTADOS DE CARGA MEJORADOS ======== */
.loading {
    opacity: 0.6;
    pointer-events: none;
    filter: blur(2px);
}

.btn-catalogo:disabled {
    background: linear-gradient(135deg, #ccc 0%, #999 100%);
    cursor: not-allowed;
    transform: none;
    box-shadow: var(--shadow-sm);
}

/* ======== EFECTO DE CARGA ESQUELETO ======== */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: var(--border-radius);
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ======== IMÁGENES DE ILUSTRACIÓN EN CATÁLOGO ======== */
.catalogo-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
}

.imagen-ilustracion {
    width: 100%;
    max-width: 200px;
    height: 150px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.img-ilustracion {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    border: 3px solid transparent;
}

.img-ilustracion:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-lg);
    border-color: var(--color-accent);
}

/* Ajuste del botón para que quede debajo de la imagen */
.catalogo-item .btn-catalogo {
    margin-top: 0.5rem;
    width: 100%;
    max-width: 200px;
}

/* ======== RESPONSIVE PARA IMÁGENES ======== */
@media (max-width: 768px) {
    .imagen-ilustracion {
        max-width: 180px;
        height: 130px;
    }
}

@media (max-width: 576px) {
    .imagen-ilustracion {
        max-width: 160px;
        height: 120px;
    }
    
    .catalogo-item {
        padding: 0.5rem;
    }
}