/* ============================================
   COMPONENTE: GALERÍA MODAL
   Estilos para galería de imágenes con modal
   ============================================ */

/* GALERÍA PRINCIPAL */
.hz-gallery-casos {
    max-width: 800px;
    margin: 3rem auto;
    padding: 1.5rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.06);
    border: 1px solid #e9ecef;
}

.hz-gallery-title {
    color: #2c3e50;
    margin-top: 0;
    margin-bottom: 0.5rem;
    font-size: 1.4rem;
}

.hz-gallery-subtitle {
    color: #6c757d;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    font-style: italic;
}

/* GRID */
.hz-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}

/* ITEMS DE GALERÍA */
.hz-gallery-item {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    cursor: pointer;
    border: 1px solid #dee2e6;
}

.hz-gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
    border-color: #3498db;
}

/* CONTENEDOR DE IMAGEN */
.hz-gallery-img-container {
    position: relative;
    height: 200px;
    overflow: hidden;
    background: #f5f7fa;
}

.hz-gallery-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.hz-gallery-item:hover .hz-gallery-img {
    transform: scale(1.05);
}

/* OVERLAY AL HACER HOVER */
.hz-img-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(41, 128, 185, 0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.hz-gallery-item:hover .hz-img-overlay {
    opacity: 1;
}

.hz-img-overlay i {
    font-size: 2rem;
    margin-bottom: 8px;
}

.hz-img-overlay span {
    font-size: 0.9rem;
    font-weight: 500;
}

/* NÚMERO DE IMAGEN */
.hz-img-number {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #2c5282;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    z-index: 2;
}

/* PIE DE FOTO */
.hz-gallery-caption {
    padding: 1rem;
    font-size: 0.85rem;
    color: #495057;
    line-height: 1.4;
    border-top: 1px solid #eee;
    background: #fdfdfd;
}

.hz-fig-number {
    font-weight: 600;
    color: #2c5282;
    margin-right: 4px;
}

/* MODAL */
.hz-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.hz-modal-content {
    position: relative;
    background: white;
    margin: 2% auto;
    width: 90%;
    max-width: 900px;
    height: 90vh;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from { transform: translateY(-30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* HEADER DEL MODAL */
.hz-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: #2c3e50;
    color: white;
}

.hz-modal-title {
    margin: 0;
    font-size: 1.1rem;
}

.hz-modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s;
}

.hz-modal-close:hover {
    color: #f1c40f;
}

/* CUERPO DEL MODAL */
.hz-modal-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 1.5rem;
    background: #f8f9fa;
}

.hz-modal-img-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    background: white;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    position: relative;
    min-height: 300px;
}

.hz-modal-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
    cursor: zoom-in;
}

.hz-modal-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #666;
}

.hz-modal-caption {
    margin-top: 1rem;
    padding: 1rem;
    background: white;
    border-radius: 6px;
    border-left: 4px solid #3498db;
}

.hz-modal-caption p {
    margin: 0;
    color: #2c3e50;
    font-size: 0.95rem;
}

/* FOOTER DEL MODAL */
.hz-modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: #f1f3f5;
    border-top: 1px solid #dee2e6;
    flex-wrap: wrap;
    gap: 1rem;
}

.hz-modal-controls {
    display: flex;
    gap: 0.5rem;
}

.hz-modal-btn {
    padding: 0.5rem 1rem;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.3s;
}

.hz-modal-btn:hover {
    background: #2980b9;
}

.hz-modal-btn:disabled {
    background: #95a5a6;
    cursor: not-allowed;
}

.hz-modal-zoom {
    display: flex;
    gap: 0.5rem;
}

.hz-zoom-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid #ced4da;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.hz-zoom-btn:hover {
    background: #e9ecef;
    border-color: #3498db;
    color: #3498db;
}

/* RESPONSIVE */
@media (max-width: 850px) {
    .hz-gallery-casos {
        margin: 2rem 1rem;
        padding: 1rem;
    }
    
    .hz-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 1rem;
    }
}

@media (max-width: 768px) {
    .hz-modal-content {
        width: 95%;
        height: 95vh;
        margin: 2.5vh auto;
    }
    
    .hz-modal-footer {
        flex-direction: column;
        align-items: stretch;
    }
    
    .hz-modal-controls {
        justify-content: center;
    }
    
    .hz-modal-zoom {
        justify-content: center;
    }
}

@media (max-width: 640px) {
    .hz-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
    
    .hz-gallery-img-container {
        height: 160px;
    }
    
    .hz-modal-content {
        width: 98%;
        height: 98vh;
        margin: 1vh auto;
    }
    
    .hz-modal-header {
        padding: 0.75rem 1rem;
    }
    
    .hz-modal-body {
        padding: 1rem;
    }
    
    .hz-modal-footer {
        padding: 0.75rem 1rem;
    }
}

@media (max-width: 480px) {
    .hz-gallery-grid {
        grid-template-columns: 1fr;
        max-width: 350px;
        margin: 0 auto;
    }
    
    .hz-gallery-img-container {
        height: 200px;
    }
    
    .hz-modal-btn span {
        display: none;
    }
    
    .hz-modal-btn i {
        margin: 0;
    }
}