/* ===== GALERÍA PROFESIONAL - DISEÑO PREMIUM ===== */
.gallery-section {
    background: linear-gradient(135deg, var(--bg-sand) 0%, var(--bg-sand-dark) 100%);
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid #D4A55E;
}

.gallery-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 80%, rgba(212, 165, 94, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(26, 38, 57, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

/* Contenedor principal */
.gallery-container {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    background: rgba(26, 38, 57, 0.6);
    border-radius: var(--border-radius-xl);
    border: 2px solid rgba(212, 165, 94, 0.2);
    backdrop-filter: blur(10px);
    overflow: hidden;
    box-shadow: var(--shadow-dark);
}

/* Cabecera de la galería */
.gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    background: rgba(15, 26, 43, 0.8);
    border-bottom: 1px solid rgba(212, 165, 94, 0.2);
}

.gallery-nav-controls {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Botones de navegación - Estilo premium */
.carousel-btn {
    width: 48px;
    height: 48px;
    background: rgba(26, 38, 57, 0.9);
    border: 2px solid var(--accent-gold);
    border-radius: var(--border-radius-md);
    color: var(--accent-gold);
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.carousel-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: var(--accent-gold);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.4s ease, height 0.4s ease;
    z-index: 0;
}

.carousel-btn:hover {
    color: var(--text-white);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(212, 165, 94, 0.3);
}

.carousel-btn:hover::before {
    width: 100%;
    height: 100%;
    border-radius: var(--border-radius-md);
}

.carousel-btn i {
    position: relative;
    z-index: 1;
    transition: transform 0.3s ease;
}

.carousel-btn:hover i {
    transform: scale(1.1);
}

.carousel-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: rgba(212, 165, 94, 0.3);
    color: rgba(212, 165, 94, 0.5);
}

.carousel-btn:disabled:hover {
    background: rgba(26, 38, 57, 0.9);
    transform: none;
    box-shadow: none;
}

.carousel-btn:disabled::before {
    display: none;
}

/* Contador */
.carousel-counter {
    font-size: 1.1rem;
    color: var(--text-white);
    font-weight: 500;
    min-width: 80px;
    text-align: center;
}

.current-slide {
    color: var(--accent-gold);
    font-weight: 600;
    font-size: 1.3rem;
}

.total-slides {
    color: var(--text-light);
    opacity: 0.8;
}

/* Controles de vista */
.gallery-view-controls {
    display: flex;
    gap: 10px;
    background: rgba(15, 26, 43, 0.5);
    padding: 8px;
    border-radius: var(--border-radius-md);
    border: 1px solid rgba(212, 165, 94, 0.2);
}

.view-btn {
    width: 40px;
    height: 40px;
    background: transparent;
    border: 2px solid transparent;
    border-radius: var(--border-radius-md);
    color: var(--text-light);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.view-btn:hover {
    color: var(--accent-gold);
    background: rgba(212, 165, 94, 0.1);
}

.view-btn.active {
    background: var(--accent-gold);
    color: var(--text-white);
    border-color: var(--accent-gold-light);
    box-shadow: 0 4px 12px rgba(212, 165, 94, 0.3);
}

/* Vista de cuadrícula (default) */
.gallery-grid-view {
    display: none;
    padding: 30px;
}

.gallery-grid-view.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
}

/* Items de la cuadrícula */
.gallery-item {
    position: relative;
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    background: var(--bg-cream);
    border: 2px solid rgba(212, 165, 94, 0.3);
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    cursor: pointer;
    aspect-ratio: 4/3;
    transform: translateY(0);
}

.gallery-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, 
        transparent 0%, 
        transparent 60%, 
        rgba(15, 26, 43, 0.9) 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 1;
    pointer-events: none;
}

.gallery-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    border-color: var(--accent-gold);
    z-index: 2;
}

.gallery-item:hover::before {
    opacity: 1;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: block;
}

.gallery-item:hover img {
    transform: scale(1.1);
}

/* Botón expandir premium */
.expand-btn {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: rgba(212, 165, 94, 0.95);
    border: 2px solid var(--accent-gold);
    border-radius: var(--border-radius-md);
    color: var(--text-white);
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transform: translateY(10px) scale(0.9);
}

.gallery-item:hover .expand-btn {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.expand-btn:hover {
    background: var(--accent-gold);
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.expand-btn i {
    transition: transform 0.3s ease;
}

.expand-btn:hover i {
    transform: scale(1.2);
}

/* Vista de carrusel */
.gallery-carousel-view {
    display: none;
    padding: 30px;
}

.gallery-carousel-view.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

.carousel-wrapper {
    position: relative;
    overflow: hidden;
    border-radius: var(--border-radius-lg);
    margin-bottom: 30px;
}

.carousel-track {
    display: flex;
    transition: transform 0.6s cubic-bezier(0.25, 0.8, 0.25, 1);
    height: 500px;
}

.carousel-slide {
    min-width: 100%;
    height: 100%;
    position: relative;
    border-radius: var(--border-radius-lg);
    overflow: hidden;
}

.carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.5s ease;
}

.carousel-slide:hover img {
    transform: scale(1.05);
}

/* Indicadores del carrusel */
.carousel-indicators {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.carousel-indicator {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0;
    position: relative;
    overflow: hidden;
}

.carousel-indicator::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--accent-gold);
    transition: left 0.3s ease;
}

.carousel-indicator:hover {
    transform: scale(1.2);
    border-color: var(--accent-gold);
}

.carousel-indicator.active {
    background: transparent;
    border-color: var(--accent-gold);
    transform: scale(1.2);
}

.carousel-indicator.active::before {
    left: 0;
}

/* Instrucción para usuarios */
.gallery-instruction {
    text-align: center;
    margin-top: 25px;
    padding: 18px;
    background: rgba(212, 165, 94, 0.08);
    border-radius: var(--border-radius-lg);
    border: 1px solid rgba(212, 165, 94, 0.2);
    backdrop-filter: blur(10px);
}

.gallery-instruction p {
    color: var(--text-white);
    font-size: 0.95rem;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.gallery-instruction i {
    color: var(--accent-gold);
    font-size: 1.1rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Popup de galería premium */
.gallery-popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 4000;
    justify-content: center;
    align-items: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-popup.active {
    display: flex;
    opacity: 1;
}

.popup-container {
    max-width: 90%;
    max-height: 90vh;
    width: 1000px;
    background: rgba(15, 26, 43, 0.95);
    border-radius: var(--border-radius-xl);
    border: 2px solid var(--accent-gold);
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    position: relative;
}

.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    background: rgba(26, 38, 57, 0.9);
    border-bottom: 1px solid rgba(212, 165, 94, 0.2);
}

.popup-counter {
    color: var(--accent-gold);
    font-size: 1.1rem;
    font-weight: 500;
}

.popup-close {
    width: 44px;
    height: 44px;
    background: rgba(212, 165, 94, 0.1);
    border: 2px solid var(--accent-gold);
    border-radius: var(--border-radius-md);
    color: var(--accent-gold);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.popup-close:hover {
    background: var(--accent-gold);
    color: var(--text-white);
    transform: rotate(90deg);
}

.popup-content {
    position: relative;
    padding: 30px;
}

.popup-image {
    max-width: 100%;
    max-height: 60vh;
    display: block;
    margin: 0 auto;
    object-fit: contain;
    border-radius: var(--border-radius-lg);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.popup-nav {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    padding: 0 40px;
    pointer-events: none;
}

.popup-nav button {
    width: 50px;
    height: 50px;
    background: rgba(26, 38, 57, 0.9);
    border: 2px solid var(--accent-gold);
    border-radius: var(--border-radius-md);
    color: var(--accent-gold);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: all;
}

.popup-nav button:hover {
    background: var(--accent-gold);
    color: var(--text-white);
    transform: scale(1.1);
}

.popup-caption {
    text-align: center;
    color: var(--text-white);
    font-size: 1rem;
    margin-top: 20px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: var(--border-radius-md);
    border-left: 3px solid var(--accent-gold);
}

/* Animaciones */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.gallery-popup.active .popup-container {
    animation: slideIn 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Para prevenir scroll cuando el popup está abierto */
body.popup-open {
    overflow: hidden;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .gallery-container {
        margin: 0 20px;
    }
}

@media (max-width: 992px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .gallery-header {
        flex-direction: column;
        gap: 20px;
        align-items: stretch;
    }
    
    .gallery-nav-controls {
        justify-content: center;
    }
    
    .gallery-view-controls {
        align-self: center;
    }
    
    .carousel-track {
        height: 400px;
    }
}

@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        max-width: 500px;
        margin: 0 auto;
    }
    
    .gallery-grid-view,
    .gallery-carousel-view {
        padding: 20px;
    }
    
    .carousel-track {
        height: 350px;
    }
    
    .popup-container {
        max-width: 95%;
    }
    
    .popup-nav {
        padding: 0 20px;
    }
    
    .popup-nav button {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .popup-header {
        padding: 15px 20px;
    }
    
    .popup-content {
        padding: 20px;
    }
}

@media (max-width: 576px) {
    .gallery-container {
        margin: 0 10px;
        border-radius: var(--border-radius-lg);
    }
    
    .carousel-track {
        height: 300px;
    }
    
    .carousel-indicators {
        gap: 8px;
    }
    
    .carousel-indicator {
        width: 10px;
        height: 10px;
    }
    
    .expand-btn {
        width: 40px;
        height: 40px;
        font-size: 1rem;
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    
    .gallery-instruction {
        padding: 15px;
    }
    
    .gallery-instruction p {
        font-size: 0.9rem;
        flex-direction: column;
        gap: 8px;
    }
    
    .popup-nav {
        padding: 0 10px;
    }
    
    .popup-nav button {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }
    
    .popup-caption {
        font-size: 0.9rem;
        padding: 10px;
    }
}

/* Mejoras de accesibilidad */
@media (prefers-reduced-motion: reduce) {
    .gallery-item,
    .expand-btn,
    .carousel-btn,
    .view-btn,
    .popup-nav button,
    .popup-close {
        transition: none;
    }
    
    .gallery-popup.active .popup-container {
        animation: none;
    }
    
    .gallery-instruction i {
        animation: none;
    }
}