/* ============================================================
   ProductGallery Component Styles
   Faithfully replicates style.css from produto.html
   ============================================================ */

/* === Base Container === */
.c-product-gallery.product-gallery-container {
    width: 100%;
    height: auto;
}

.c-product-gallery.product-gallery {
    display: flex;
    gap: 20px;
    height: auto;
    align-items: stretch;
}

/* === Shared Main Slider === */
.c-product-gallery .product-main-slider {
    flex: 1;
    aspect-ratio: 1/1;
    border-radius: 8px;
    overflow: hidden;
    background-color: #f9f9f9;
    box-shadow: 0 5px 25px rgba(0,0,0,0.05);
    position: relative;
    -webkit-user-select: none;
    user-select: none;
}

.c-product-gallery .product-main-slider img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.5s ease;
}

.c-product-gallery .product-main-slider video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

/* === Thumbnails (Desktop Only) === */

/* align-items: flex-start garante que o aspect-ratio do main slider governe a altura da galeria */
.c-product-gallery.gallery-desktop-layout.product-gallery {
    align-items: flex-start;
}

.c-product-gallery.gallery-desktop-layout .product-thumbs-slider {
    width: 120px;
    flex-shrink: 0;
    overflow: hidden; /* impede Swiper vertical de expandir além da altura definida via JS */
    -webkit-user-select: none;
    user-select: none;
}

.c-product-gallery.gallery-desktop-layout .product-thumbs-slider .swiper-slide {
    width: 100%;
    opacity: 0.5;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 4px;
    overflow: hidden;
    border: 2px solid transparent;
}

.c-product-gallery.gallery-desktop-layout .product-thumbs-slider .swiper-slide:hover {
    opacity: 0.8;
}

.c-product-gallery.gallery-desktop-layout .product-thumbs-slider .swiper-slide-thumb-active {
    opacity: 1;
    border-color: var(--secondary-color);
}

.c-product-gallery.gallery-desktop-layout .product-thumbs-slider img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.c-product-gallery.gallery-desktop-layout .product-thumbs-slider video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

/* Video Thumbnail Play Icon */
.c-product-gallery .video-thumb {
    position: relative;
}

.c-product-gallery .thumb-video-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 28px;
    height: 28px;
    background-color: rgba(0, 0, 0, 0.55);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.c-product-gallery .thumb-video-icon i {
    font-size: 0.6rem;
    color: var(--white);
    margin-left: 2px;
}

/* === Desktop Image Slide Cursor === */
.c-product-gallery .image-slide {
    cursor: zoom-in;
    width: 100%;
    height: 100%;
}

/* === Video Slide === */
.c-product-gallery .video-slide {
    position: relative;
    cursor: zoom-in;
    width: 100%;
    height: 100%;
}

.c-product-gallery .video-slide video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

.c-product-gallery .video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.3) 0%, transparent 50%);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.c-product-gallery .video-overlay i {
    font-size: 3rem;
    color: rgba(255, 255, 255, 0.85);
    text-shadow: 0 2px 12px rgba(0,0,0,0.4);
    transition: transform 0.3s ease;
}

.c-product-gallery .video-slide:hover .video-overlay i {
    transform: scale(1.15);
}

/* === Desktop Navigation Arrows === */
.c-product-gallery.gallery-desktop-layout .product-main-slider .swiper-button-next,
.c-product-gallery.gallery-desktop-layout .product-main-slider .swiper-button-prev {
    opacity: 0;
    transition: var(--transition);
    background-color: rgba(255, 255, 255, 0.8);
    width: 44px;
    height: 44px;
    border-radius: 50%;
}

.c-product-gallery.gallery-desktop-layout .product-main-slider .swiper-button-next::after,
.c-product-gallery.gallery-desktop-layout .product-main-slider .swiper-button-prev::after {
    font-size: 1rem;
    color: var(--secondary-color);
    font-weight: 900;
}

.c-product-gallery.gallery-desktop-layout .product-main-slider:hover .swiper-button-next,
.c-product-gallery.gallery-desktop-layout .product-main-slider:hover .swiper-button-prev {
    opacity: 1;
}

.c-product-gallery.gallery-desktop-layout .product-main-slider .swiper-button-disabled {
    display: none !important;
}

/* Desktop Pagination - Hidden (only dots on mobile) */
.c-product-gallery.gallery-desktop-layout .product-main-slider .swiper-pagination {
    display: none;
}

/* ============================================================
   Social Action Buttons (Shared Component)
   ============================================================ */
.c-product-gallery .media-actions {
    position: absolute;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 10;
}

.c-product-gallery .gallery-action-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: var(--white);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.c-product-gallery .gallery-action-btn i {
    transition: transform 0.3s ease;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.c-product-gallery .gallery-action-btn:active i {
    transform: scale(0.85);
}

.c-product-gallery .gallery-action-btn:hover {
    background-color: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
    border-color: rgba(255, 255, 255, 0.3);
}

.c-product-gallery .gallery-action-btn.hidden {
    display: none;
}

/* Desktop Actions → bottom-right of main slider */
.c-product-gallery .desktop-actions {
    bottom: 20px;
    right: 20px;
}

/* Modal Actions → bottom-right inside the card */
.c-product-gallery .modal-actions {
    bottom: 16px;
    right: 12px;
}

/* Mobile Actions → higher up (clear pagination + bag panel) */
.c-product-gallery .mobile-actions {
    bottom: 100px;
    right: 16px;
}

/* ============================================================
   Mobile Gallery Layout
   ============================================================ */
.c-product-gallery.gallery-mobile-layout .product-main-slider {
    width: 100%;
    aspect-ratio: 1/1;
    border-radius: 8px;
    max-height: none;
}

/* Slide content inside mobile */
.c-product-gallery.gallery-mobile-layout .product-main-slider .modal-slide-content {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: none;
    aspect-ratio: unset;
    max-width: none;
    background-color: #111;
}

.c-product-gallery.gallery-mobile-layout .product-main-slider .modal-slide-content img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    border-radius: 0;
}

.c-product-gallery.gallery-mobile-layout .product-main-slider .modal-slide-content video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
    display: block;
    border-radius: 0;
}

/* Mobile actions positioned inside the slider */
.c-product-gallery.gallery-mobile-layout .product-main-slider .mobile-actions {
    position: absolute;
    bottom: 50px;
    right: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 10;
}

/* Mobile bag panel content - rounded top corners */
.c-product-gallery.gallery-mobile-layout .product-main-slider .modal-bag-panel-content {
    border-radius: 12px 12px 0 0;
    padding: 18px 16px 28px;
}

/* Ensure swiper fills full height on mobile */
.c-product-gallery.gallery-mobile-layout .product-main-slider .swiper-wrapper {
    height: 100%;
}

.c-product-gallery.gallery-mobile-layout .product-main-slider .swiper-slide {
    height: 100% !important;
    cursor: default;
}

/* Mobile Pagination - Dots */
.c-product-gallery.gallery-mobile-layout .product-main-slider .swiper-pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    bottom: 20px !important;
    z-index: 10;
    width: 100%;
}

.c-product-gallery.gallery-mobile-layout .product-main-slider .swiper-pagination-bullet {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    opacity: 1;
    transition: all 0.3s ease;
    margin: 0 !important;
}

.c-product-gallery.gallery-mobile-layout .product-main-slider .swiper-pagination-bullet-active {
    background: var(--white);
    transform: scale(1.3);
}

/* ============================================================
   Gallery Modal (Desktop Only) - Premium Fullscreen
   ============================================================ */
.c-product-gallery.gallery-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.96);
    z-index: 10000;
    display: none;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.c-product-gallery.gallery-modal.active {
    display: block;
    opacity: 1;
}

/* Modal Close Button */
.c-product-gallery .gallery-modal-close {
    position: absolute;
    top: 24px;
    right: 30px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 3010;
    transition: transform 0.4s ease, color 0.3s ease;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

/* Premium Carousel Wrapper — absolute para garantir 100% do modal sem depender de flex-height */
.c-product-gallery .modal-carousel-wrapper {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
}

/* External Navigation Arrows */
.c-product-gallery .modal-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3020;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    font-size: 1.6rem;
    cursor: pointer;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border-radius: 50%;
}

.c-product-gallery .modal-arrow:hover {
    color: rgba(255, 255, 255, 0.9);
    background-color: rgba(255, 255, 255, 0.08);
}

.c-product-gallery .modal-arrow-prev { left: 20px; }
.c-product-gallery .modal-arrow-next { right: 20px; }

/* Modal Viewport - flex horizontal com padding para as setas laterais */
.c-product-gallery .modal-viewport {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 0 100px;
}

/* Gallery Modal Swiper — altura explícita em viewport units (nunca %) */
.c-product-gallery .gallery-modal-swiper {
    width: 100%;
    height: calc(100vh - 48px);
    height: calc(100dvh - 48px);
    overflow: visible !important;
    -webkit-user-select: none;
    user-select: none;
}

.c-product-gallery .gallery-modal-swiper .swiper-wrapper {
    align-items: center;
    height: 100%;
}

.c-product-gallery .gallery-modal-swiper .swiper-slide {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
    transition: opacity 0.4s ease, transform 0.4s ease;
    opacity: 0.35;
    transform: scale(0.82);
    width: calc(100dvh - 48px) !important;
    height: calc(100vh - 48px);
    height: calc(100dvh - 48px);
    flex-shrink: 0;
}

.c-product-gallery .gallery-modal-swiper .swiper-slide-active {
    opacity: 1;
    transform: scale(1);
}

/* Conteúdo do slide — ocupa o slide inteiro, sem aspect-ratio fixo */
.c-product-gallery .gallery-modal-swiper .swiper-slide .modal-slide-content {
    width: 100%;
    height: 100%;
    aspect-ratio: unset;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    background-color: #111;
}

.c-product-gallery .gallery-modal-swiper .swiper-slide-active .modal-slide-content {
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.06);
}

/* Zoom container (Swiper Zoom module) */
.c-product-gallery .gallery-modal-swiper .swiper-zoom-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.c-product-gallery .gallery-modal-swiper .swiper-zoom-container picture {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.c-product-gallery .gallery-modal-swiper .swiper-zoom-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    border-radius: 0;
    cursor: zoom-in;
}

.c-product-gallery .gallery-modal-swiper .swiper-slide-zoomed .swiper-zoom-container img {
    cursor: grab;
}

.c-product-gallery .gallery-modal-swiper .swiper-slide-zoomed .swiper-zoom-container img:active {
    cursor: grabbing;
}

.c-product-gallery .gallery-modal-swiper .modal-slide-content video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
    display: block;
}

/* Zoom Hint */
.c-product-gallery .modal-zoom-hint {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.75rem;
    padding: 6px 14px;
    border-radius: 20px;
    z-index: 3020;
    pointer-events: none;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
    animation: modal-zoom-hint-fade 2.5s ease forwards;
}

@keyframes modal-zoom-hint-fade {
    0%   { opacity: 0; }
    20%  { opacity: 1; }
    80%  { opacity: 1; }
    100% { opacity: 0; }
}

/* Modal Pagination - Horizontal bars */
.c-product-gallery .gallery-modal-pagination {
    position: absolute;
    bottom: 20px !important;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3010;
    display: flex;
    gap: 6px;
}

.c-product-gallery.gallery-modal .swiper-pagination-bullet {
    width: 28px;
    height: 3px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.25);
    opacity: 1;
    transition: all 0.3s ease;
}

.c-product-gallery.gallery-modal .swiper-pagination-bullet-active {
    background: var(--white);
    width: 40px;
}

/* ============================================================
   Bag Panel (Shared: Mobile + Modal)
   ============================================================ */
.c-product-gallery .modal-bag-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 15;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease, visibility 0.3s ease;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
}

.c-product-gallery .modal-bag-panel.active {
    transform: translateY(0);
    pointer-events: auto;
    opacity: 1;
    visibility: visible;
}

.c-product-gallery .modal-bag-panel-content {
    background: var(--white);
    padding: 18px 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    border-radius: 0 0 12px 12px;
}

.c-product-gallery .modal-bag-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--secondary-color);
    font-family: var(--font-primary);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.c-product-gallery .modal-bag-panel-close {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 1rem;
    cursor: pointer;
    padding: 4px;
    transition: color 0.3s ease;
}

.c-product-gallery .modal-bag-panel-close:hover {
    color: var(--secondary-color);
}

/* Horizontal scrolling sizes */
.c-product-gallery .modal-bag-sizes {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    mask-image: linear-gradient(to right, black 85%, transparent 100%);
    -webkit-mask-image: linear-gradient(to right, black 85%, transparent 100%);
}

.c-product-gallery .modal-bag-sizes::-webkit-scrollbar {
    display: none;
}

.c-product-gallery .modal-size-btn {
    min-width: 50px;
    height: 50px;
    flex-shrink: 0;
    border: 1px solid #ddd;
    background: none;
    color: var(--secondary-color);
    font-family: var(--font-primary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    border-radius: 2px;
    padding: 0 12px;
}

.c-product-gallery .modal-size-btn:hover:not(.unavailable) {
    border-color: var(--secondary-color);
}

.c-product-gallery .modal-size-btn.active {
    background-color: var(--secondary-color);
    color: var(--white);
    border-color: var(--secondary-color);
}

.c-product-gallery .modal-size-btn.unavailable {
    opacity: 0.6;
    cursor: not-allowed;
    position: relative;
    overflow: hidden;
    color: #999;
}

.c-product-gallery .modal-size-btn.unavailable::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 1px;
    background-color: #999;
    transform: rotate(-45deg);
}

/* Add to Bag CTA Button */
.c-product-gallery .modal-bag-add-btn {
    width: 100%;
    height: 48px;
    background: linear-gradient(135deg, var(--cta-green) 0%, var(--cta-green-hover) 100%);
    color: var(--white);
    border: none;
    font-family: var(--font-primary);
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.8rem;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(21, 128, 61, 0.25);
}

.c-product-gallery .modal-bag-add-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(21, 128, 61, 0.4);
}

/* ============================================================
   Mobile-only Modal Media Query Overrides
   ============================================================ */
@media (max-width: 768px) {
    .c-product-gallery .modal-viewport {
        padding: 0;
    }

    .c-product-gallery .modal-arrow {
        display: none !important;
    }

    .c-product-gallery .gallery-modal-swiper {
        overflow: hidden !important;
        height: 100vh;
        height: 100dvh;
    }

    .c-product-gallery .gallery-modal-swiper .swiper-slide {
        opacity: 0;
        transform: scale(1);
        width: 100% !important;
        height: 100vh;
        height: 100dvh;
    }

    .c-product-gallery .gallery-modal-swiper .swiper-slide-active {
        opacity: 1;
        transform: scale(1);
    }

    .c-product-gallery .gallery-modal-swiper .swiper-slide .modal-slide-content {
        width: 100%;
        height: 100%;
        aspect-ratio: unset;
        border-radius: 0;
        box-shadow: none;
    }

    .c-product-gallery .gallery-modal-swiper .swiper-slide-active .modal-slide-content {
        box-shadow: none;
    }

    .c-product-gallery .modal-actions {
        bottom: 100px;
        right: 16px;
    }

    .c-product-gallery .gallery-modal-close {
        top: 16px;
        right: 16px;
    }

    .c-product-gallery .modal-bag-panel-content {
        border-radius: 12px 12px 0 0;
        padding: 18px 16px 28px;
    }

    /* Pagination: centered dots */
    .c-product-gallery .gallery-modal-pagination {
        bottom: 80px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        width: auto !important;
    }

    .c-product-gallery.gallery-modal .swiper-pagination-bullet {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.4);
        opacity: 1;
    }

    .c-product-gallery.gallery-modal .swiper-pagination-bullet-active {
        background: var(--white);
        width: 8px;
        transform: scale(1.3);
    }
}

/* ============================================================
   Force Mobile Layout Breakout (Full Width)
   ============================================================ */
@media (max-width: 768px) {
    .c-product-gallery.gallery-mobile-layout {
        width: calc(100% + 32px); /* Break out of 16px container padding */
        margin-left: -16px;
        margin-right: -16px;
        position: relative;
        z-index: 1;
    }

    .c-product-gallery.gallery-mobile-layout .swiper-slide {
        height: 100%;
    }

    .c-product-gallery.gallery-mobile-layout img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .c-product-gallery.gallery-mobile-layout video {
        width: 100%;
        height: 100%;
        object-fit: contain;
        background: #000;
    }
}
