/*
 * ╔═══════════════════════════════════════════════════════════════════════╗
 * ║              GALERÍA DE IMÁGENES - DISEÑO ULTRA ELEGANTE              ║
 * ║                    Diseño completamente nuevo                         ║
 * ╚═══════════════════════════════════════════════════════════════════════╝
 */

/* ========================================
   GRID PRINCIPAL - Masonry Layout
   ======================================== */
.gallery-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0;
}

#galleryGrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
    padding: 0;
    margin: 0;
    animation: fadeInUp 0.8s ease-out;
}

/* ========================================
   TARJETA DE IMAGEN - Diseño Premium
   ======================================== */
.gallery-card {
    position: relative;
    background: #fff;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    transition: all 0.5s cubic-bezier(0.165, 0.84, 0.44, 1);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.gallery-card:hover {
    transform: translateY(-16px) scale(1.03);
    box-shadow: 0 30px 60px rgba(245, 158, 11, 0.35),
                0 0 0 1px rgba(245, 158, 11, 0.2);
}

/* ========================================
   IMAGEN CONTAINER - Ratio Perfecto
   ======================================== */
.gallery-card-image {
    position: relative;
    width: 100%;
    padding-top: 66.67%; /* Ratio 3:2 */
    overflow: hidden;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.gallery-card-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s cubic-bezier(0.165, 0.84, 0.44, 1);
    filter: brightness(0.95) contrast(1.05);
}

.gallery-card:hover .gallery-card-image img {
    transform: scale(1.2) rotate(3deg);
    filter: brightness(1) contrast(1.1);
}

/* ========================================
   OVERLAY - Efecto Glassmorphism
   ======================================== */
.gallery-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        rgba(245, 158, 11, 0.97) 0%,
        rgba(217, 119, 6, 0.97) 100%
    );
    backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.5s cubic-bezier(0.165, 0.84, 0.44, 1);
    z-index: 2;
}

.gallery-card:hover .gallery-card-overlay {
    opacity: 1;
}

.gallery-card-overlay-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    animation: pulse 2s ease-in-out infinite;
}

.gallery-card-overlay-icon i {
    font-size: 2.5rem;
    color: white;
}

.gallery-card-overlay-text {
    color: white;
    font-size: 1.125rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* ========================================
   CONTENIDO - Información Elegante
   ======================================== */
.gallery-card-content {
    padding: 2rem;
    background: white;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.gallery-card-category {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    padding: 0.5rem 1.25rem;
    border-radius: 50px;
    font-size: 0.8125rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    align-self: flex-start;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.gallery-card-title {
    font-size: 1.75rem;
    font-weight: 800;
    color: #111827;
    line-height: 1.3;
    margin: 0;
    font-family: 'Playfair Display', serif;
    background: linear-gradient(135deg, #111827 0%, #374151 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.gallery-card-description {
    font-size: 1rem;
    color: #6b7280;
    line-height: 1.7;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.gallery-card-footer {
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: 1px solid #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.gallery-card-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #9ca3af;
    font-size: 0.875rem;
    font-weight: 600;
}

.gallery-card-brand-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.75rem;
}

/* ========================================
   MODAL - Diseño Cinematográfico
   ======================================== */
.gallery-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.98);
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    opacity: 0;
    transition: opacity 0.4s ease;
    backdrop-filter: blur(10px);
}

.gallery-modal.active {
    display: flex !important;
    opacity: 1;
}

.gallery-modal-wrapper {
    max-width: 1600px;
    width: 100%;
    max-height: 95vh;
    position: relative;
    animation: modalZoomIn 0.5s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.gallery-modal-image-container {
    position: relative;
    background: #000;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.8);
    margin-bottom: 2rem;
}

.gallery-modal-image-container img {
    width: 100%;
    height: auto;
    max-height: 75vh;
    object-fit: contain;
    display: block;
}

.gallery-modal-info {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 3rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

.gallery-modal-title {
    font-size: 3rem;
    font-weight: 800;
    color: #111827;
    margin-bottom: 1.5rem;
    font-family: 'Playfair Display', serif;
    line-height: 1.2;
}

.gallery-modal-description {
    font-size: 1.25rem;
    color: #4b5563;
    line-height: 1.8;
    margin-bottom: 2rem;
}

.gallery-modal-meta {
    display: flex;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.gallery-modal-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    padding: 1rem 2rem;
    border-radius: 50px;
    font-weight: 700;
    font-size: 1.125rem;
    box-shadow: 0 8px 20px rgba(245, 158, 11, 0.4);
}

.gallery-modal-counter {
    color: #9ca3af;
    font-size: 1.125rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* ========================================
   BOTONES DEL MODAL - Diseño Moderno
   ======================================== */
.gallery-modal-close {
    position: absolute;
    top: -70px;
    right: 0;
    width: 60px;
    height: 60px;
    background: white;
    border: none;
    border-radius: 50%;
    color: #111827;
    font-size: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

.gallery-modal-close:hover {
    background: #f59e0b;
    color: white;
    transform: rotate(90deg) scale(1.15);
    box-shadow: 0 12px 32px rgba(245, 158, 11, 0.5);
}

.gallery-modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 70px;
    height: 70px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: none;
    border-radius: 50%;
    color: #111827;
    font-size: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

.gallery-modal-nav:hover {
    background: #f59e0b;
    color: white;
    transform: translateY(-50%) scale(1.2);
    box-shadow: 0 12px 32px rgba(245, 158, 11, 0.5);
}

.gallery-modal-nav-prev {
    left: -90px;
}

.gallery-modal-nav-next {
    right: -90px;
}

/* ========================================
   ESTADOS ESPECIALES
   ======================================== */
.gallery-loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 6rem 2rem;
}

.gallery-loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid #f3f4f6;
    border-top-color: #f59e0b;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 2rem;
}

.gallery-loading-text {
    font-size: 1.25rem;
    color: #6b7280;
    font-weight: 600;
}

.gallery-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 6rem 2rem;
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
    border-radius: 24px;
}

.gallery-empty-icon {
    width: 120px;
    height: 120px;
    margin: 0 auto 2rem;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.3;
}

.gallery-empty-icon i {
    font-size: 4rem;
    color: white;
}

.gallery-empty-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #374151;
    margin-bottom: 1rem;
}

.gallery-empty-text {
    font-size: 1.125rem;
    color: #9ca3af;
}

/* ========================================
   ANIMACIONES
   ======================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes modalZoomIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* ========================================
   VIDEO BADGE - Badge para videos
   ======================================== */
.gallery-video-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(220, 38, 38, 0.95);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 600;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.gallery-video-badge i {
    font-size: 1rem;
}

.gallery-video-duration {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #94a3b8;
    font-size: 0.875rem;
    margin-top: 0.5rem;
    padding: 0.5rem 0;
}

/* ========================================
   VIDEO MODAL - Contenedor de videos
   ======================================== */
.gallery-modal-video-container {
    position: relative;
    width: 100%;
    max-width: 90vw;
    max-height: 75vh;
    margin: 0 auto;
    border-radius: 16px;
    overflow: hidden;
    background: #000;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.gallery-modal-video-container iframe {
    width: 100%;
    aspect-ratio: 16/9;
    border: none;
}

.gallery-modal-video-container video {
    width: 100%;
    height: auto;
    max-height: 75vh;
    display: block;
    background: #000;
}

/* ========================================
   RESPONSIVE - Mobile First
   ======================================== */
@media (max-width: 1200px) {
    .gallery-modal-nav-prev {
        left: 10px;
    }
    
    .gallery-modal-nav-next {
        right: 10px;
    }
}

@media (max-width: 768px) {
    #galleryGrid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .gallery-card-content {
        padding: 1.5rem;
    }
    
    .gallery-card-title {
        font-size: 1.5rem;
    }
    
    .gallery-modal-wrapper {
        padding: 1rem;
    }
    
    .gallery-modal-info {
        padding: 2rem;
    }
    
    .gallery-modal-title {
        font-size: 2rem;
    }
    
    .gallery-modal-description {
        font-size: 1rem;
    }
    
    .gallery-modal-nav {
        width: 50px;
        height: 50px;
        font-size: 24px;
    }
    
    .gallery-modal-close {
        top: 10px;
        right: 10px;
        width: 50px;
        height: 50px;
    }
}

@media (max-width: 480px) {
    #galleryGrid {
        gap: 1rem;
    }
    
    .gallery-card {
        border-radius: 16px;
    }
    
    .gallery-modal-info {
        padding: 1.5rem;
    }
}
