/* ==============================================================
   🔥 GALLERY INTRO CSS - COM NAVEGAÇÃO COMPLETA! 🔥
   👀 SETAS + SWIPE + CONTADOR
   ============================================================== */

/* 📦 WRAPPER PRINCIPAL */
.gallery-intro-wrapper {
    width: 100%;
    padding: 40px 20px 20px 20px;
    max-width: 1800px;
    margin: 60px auto 0 auto;
    position: relative;
    z-index: 5;
}

/* 🔥 GRID DA GALERIA - 5 COLUNAS QUADRADAS NO DESKTOP */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
    grid-auto-flow: dense;
}

/* 📸 ITENS DA GALERIA */
.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    cursor: pointer;
    background-color: #0a0a0a;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    aspect-ratio: 1 / 1;
}

.gallery-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, rgba(0,0,0,0.3) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
    pointer-events: none;
}

/* 🖼️ IMAGENS E VÍDEOS */
.gallery-item img,
.gallery-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1), filter 0.3s ease;
}

/* ✨ HOVER EFFECTS */
.gallery-item:hover {
    transform: scale(1.02);
    z-index: 10;
}

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

.gallery-item:hover img,
.gallery-item:hover video {
    transform: scale(1.08);
    filter: brightness(1.1);
}

/* 🏷️ OVERLAY COM TAG */
.gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0) 50%);
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    padding: 15px;
    z-index: 2;
    pointer-events: none;
}

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

/* 📖 TAG ALPHA */
.gallery-tag-alpha {
    background-color: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #ffffff;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transform: translateY(10px);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-item:hover .gallery-tag-alpha {
    transform: translateY(0);
}

/* 📱 RESPONSIVO */
@media (max-width: 1200px) {
    .gallery-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 968px) {
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }
}

@media (max-width: 768px) {
    .gallery-intro-wrapper {
        padding: 40px 10px 10px 10px;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
}

/* 🔄 LOADING STATE */
.gallery-item img,
.gallery-item video {
    background: linear-gradient(90deg, #0a0a0a 25%, #1a1a1a 50%, #0a0a0a 75%);
    background-size: 200% 100%;
    animation: gallery-loading 1.5s infinite;
}

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

.gallery-item img[src],
.gallery-item video[src] {
    animation: none;
    background: none;
}

/* ==============================================================
   🔥🔥🔥 MODAL COM NAVEGAÇÃO - SETAS + SWIPE + CONTADOR 🔥🔥🔥
   ============================================================== */

.gallery-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999 !important;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-modal.gallery-active {
    display: flex !important;
    opacity: 1 !important;
}

.gallery-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    z-index: 999998 !important;
}

.gallery-modal-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 100px 40px 100px;
    z-index: 999999 !important;
    user-select: none;
    -webkit-user-select: none;
}

/* 🔥🔥🔥 BOTÃO FECHAR - GIGANTE NO TOPO! 🔥🔥🔥 */
.gallery-modal-close {
    position: fixed !important;
    top: 20px !important;
    right: 20px !important;
    width: 70px !important;
    height: 70px !important;
    background: #ff0000 !important;
    border: 4px solid #ffffff !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 10000000 !important;
    color: #ffffff !important;
    cursor: pointer !important;
    box-shadow: 0 0 30px rgba(255, 0, 0, 0.9), 0 0 60px rgba(255, 0, 0, 0.5) !important;
    backdrop-filter: blur(10px) !important;
    transition: all 0.3s ease !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

.gallery-modal-close:hover {
    background: #cc0000 !important;
    transform: rotate(90deg) scale(1.2) !important;
    box-shadow: 0 0 50px rgba(255, 0, 0, 1), 0 0 80px rgba(255, 0, 0, 0.7) !important;
}

.gallery-modal-close svg {
    width: 40px !important;
    height: 40px !important;
    stroke-width: 4 !important;
}

/* 🖼️ MÍDIA - IMAGEM GRANDE CENTRALIZADA */
.gallery-modal-media {
    max-width: 90vw;
    max-height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    position: relative;
}

.gallery-modal-media img,
.gallery-modal-media video {
    max-width: 100%;
    max-height: 70vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    transition: opacity 0.25s ease;
}

/* 🔥 TRANSIÇÃO SUAVE ENTRE MÍDIAS */
.gallery-modal-media.gallery-transitioning img,
.gallery-modal-media.gallery-transitioning video {
    opacity: 0;
}

/* ==============================================================
   🔥🔥🔥 SETAS DE NAVEGAÇÃO - DESKTOP 🔥🔥🔥
   ============================================================== */

.gallery-nav-btn {
    position: fixed !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 60px !important;
    height: 60px !important;
    background: rgba(255, 255, 255, 0.1) !important;
    border: 2px solid rgba(255, 255, 255, 0.3) !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    z-index: 10000001 !important;
    color: #ffffff !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    transition: all 0.3s ease !important;
    opacity: 0.7;
    pointer-events: auto !important;
}

.gallery-nav-btn:hover {
    background: rgba(255, 255, 255, 0.25) !important;
    border-color: rgba(255, 255, 255, 0.6) !important;
    opacity: 1;
    transform: translateY(-50%) scale(1.1) !important;
}

.gallery-nav-btn:active {
    transform: translateY(-50%) scale(0.95) !important;
}

.gallery-nav-prev {
    left: 20px !important;
}

.gallery-nav-next {
    right: 20px !important;
}

.gallery-nav-btn svg {
    width: 28px !important;
    height: 28px !important;
    stroke-width: 3 !important;
    pointer-events: none;
}

/* ==============================================================
   🔢 CONTADOR DE POSIÇÃO
   ============================================================== */

.gallery-modal-counter {
    position: fixed !important;
    bottom: 25px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    background: rgba(255, 255, 255, 0.1) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: 25px !important;
    padding: 8px 20px !important;
    color: #ffffff !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    letter-spacing: 2px !important;
    z-index: 10000001 !important;
    pointer-events: none;
    user-select: none;
}

/* 📝 LEGENDA SIMPLES */
.gallery-modal-legenda {
    max-width: 90vw;
    text-align: center;
    padding: 0 20px;
}

.gallery-modal-titulo {
    font-size: 28px;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 10px 0;
    line-height: 1.2;
}

.gallery-modal-descricao {
    font-size: 16px;
    font-weight: 400;
    color: #aaaaaa;
    margin: 0;
    line-height: 1.5;
}

/* ==============================================================
   📱 RESPONSIVO MOBILE
   ============================================================== */

@media (max-width: 968px) {
    .gallery-modal-container {
        padding: 70px 20px 80px 20px;
    }

    .gallery-modal-media {
        max-height: 55vh;
        margin-bottom: 15px;
    }

    .gallery-modal-media img,
    .gallery-modal-media video {
        max-height: 55vh;
        border-radius: 8px;
    }

    .gallery-modal-close {
        top: 10px !important;
        right: 10px !important;
        width: 60px !important;
        height: 60px !important;
    }
    
    .gallery-modal-close svg {
        width: 32px !important;
        height: 32px !important;
    }

    /* 🔥 SETAS MENORES NO MOBILE */
    .gallery-nav-btn {
        width: 44px !important;
        height: 44px !important;
        opacity: 0.5;
    }

    .gallery-nav-prev {
        left: 8px !important;
    }

    .gallery-nav-next {
        right: 8px !important;
    }

    .gallery-nav-btn svg {
        width: 22px !important;
        height: 22px !important;
    }

    .gallery-modal-titulo {
        font-size: 22px;
        margin-bottom: 8px;
    }

    .gallery-modal-descricao {
        font-size: 14px;
    }

    .gallery-modal-counter {
        bottom: 15px !important;
        font-size: 13px !important;
        padding: 6px 16px !important;
    }
}

@media (max-width: 480px) {
    .gallery-modal-container {
        padding: 60px 10px 70px 10px;
    }

    .gallery-modal-media {
        max-height: 50vh;
    }

    .gallery-modal-media img,
    .gallery-modal-media video {
        max-height: 50vh;
    }

    .gallery-modal-close {
        width: 50px !important;
        height: 50px !important;
    }
    
    .gallery-modal-close svg {
        width: 28px !important;
        height: 28px !important;
    }

    .gallery-nav-btn {
        width: 38px !important;
        height: 38px !important;
    }

    .gallery-nav-btn svg {
        width: 18px !important;
        height: 18px !important;
    }

    .gallery-modal-titulo {
        font-size: 18px;
    }

    .gallery-modal-descricao {
        font-size: 13px;
    }
}

/* ✨ ANIMAÇÃO DE ENTRADA */
@keyframes gallery-modal-fade-in {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.gallery-modal.gallery-active .gallery-modal-media {
    animation: gallery-modal-fade-in 0.3s ease;
}

/* 🔥 HINT DE SWIPE - SÓ APARECE NO MOBILE NA 1ª VEZ */
.gallery-swipe-hint {
    position: fixed;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 25px;
    padding: 8px 18px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 1px;
    z-index: 10000002;
    pointer-events: none;
    animation: gallery-hint-fade 3s ease forwards;
    display: none;
}

@keyframes gallery-hint-fade {
    0% { opacity: 0; transform: translateX(-50%) translateY(10px); }
    15% { opacity: 1; transform: translateX(-50%) translateY(0); }
    70% { opacity: 1; }
    100% { opacity: 0; pointer-events: none; }
}

@media (max-width: 968px) {
    .gallery-swipe-hint {
        display: block;
    }
}

/* 🔥🔥🔥 ESCONDE O MENU QUANDO O MODAL TÁ ABERTO! 🔥🔥🔥 */
body.gallery-modal-open .menu-container {
    opacity: 0 !important;
    pointer-events: none !important;
}
