/* Fullscreen Modal Styles */
#fullscreenModal.modal.show .modal-content {
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    background-color: rgba(0, 0, 0, 0.7);
}

body.fullscreen-modal-open {
    overflow: hidden;
}

body.fullscreen-modal-open main {
    filter: blur(5px);
    transition: filter 0.3s ease;
}

/* Fullscreen Toggle Button - Visible siempre */
.fullscreen-toggle {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    color: #333;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.1rem;
    cursor: pointer;
    z-index: 10;
    opacity: 1;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

/* Solo mostrar en imágenes, no en videos */
.gallery-item[data-category="video"] .fullscreen-toggle {
    display: none !important;
}

.fullscreen-toggle:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.1);
}

.fullscreen-toggle svg {
    width: 16px;
    height: 16px;
}

.gallery-item[data-category="photo"] .item-hover-mask {
    display: none !important;
}

.gallery-item[data-category="photo"] .item-overlay {
    display: none !important;
}

.gallery-item[data-category="video"]:hover .item-hover-mask {
    opacity: 1;
}

#fullscreenModal .modal-content {
    background: transparent;
    border: none;
}

#fullscreenModal .modal-body {
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
}

.fullscreen-image {
    max-width: 90%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

/* Animación de entrada */
@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.fullscreen-image.loaded {
    animation: fadeInScale 0.3s ease forwards;
}

/* Modal caption */
.fullscreen-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    color: white;
    padding: 1.5rem;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

#fullscreenModal.show .fullscreen-caption {
    transform: translateY(0);
}

.caption-content {
    max-width: 800px;
    margin: 0 auto;
}

/* Navigation arrows */
.nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 10;
}

#fullscreenModal:hover .nav-arrow {
    opacity: 0.8;
}

.nav-arrow:hover {
    background: rgba(255, 255, 255, 0.3);
    opacity: 1;
}

.nav-arrow.prev {
    left: 20px;
}

.nav-arrow.next {
    right: 20px;
}

.zoom-controls {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 25px;
    padding: 8px;
    display: flex;
    gap: 5px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#fullscreenModal:hover .zoom-controls {
    opacity: 1;
}

.zoom-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.zoom-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.fullscreen-image.loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    transform: translate(-50%, -50%);
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

#fullscreenModal .modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    z-index: -1;
    border-radius: 12px;
}

#fullscreenModal .btn-close {
    background-color: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    opacity: 0.8;
    transition: all 0.3s ease;
}

#fullscreenModal .btn-close:hover {
    background-color: rgba(255, 255, 255, 0.3);
    opacity: 1;
    transform: scale(1.1);
}

.fullscreen-image {
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] #fullscreenModal.modal.show .modal-content {
    background-color: rgba(0, 0, 0, 0.85);
}

[data-bs-theme="dark"] #fullscreenModal .btn-close {
    background-color: rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .nav-arrow {
        width: 40px;
        height: 40px;
        opacity: 0.7;
    }
    
    .fullscreen-caption {
        padding: 1rem;
        font-size: 0.9rem;
    }
    
    .zoom-controls {
        bottom: 80px;
        top: auto;
        left: 50%;
        transform: translateX(-50%);
    }
    
    .fullscreen-toggle {
        width: 32px;
        height: 32px;
    }
}