/* === GŁÓWNY KONTENER === */
.aromaholik-product-gallery {
    display: block;
    position: relative;
    width: 100%;
    float: none;
    clear: both;
    z-index: 1;
    margin-bottom: 5px !important;
    padding: 0 !important;
}

/* === MAIN GALLERY === */
.aromaholik-gallery-main {
    position: relative !important;
    width: 100% !important;
    min-height: 1px;
    overflow: hidden;
    border-radius: 12px;
    background: #fff;
    border: 1px solid #e5e5e5;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12),
    0 2px 8px rgba(0, 0, 0, 0.08),
    0 0 1px rgba(0, 0, 0, 0.1);
    margin-bottom: 18px !important;
}

.aromaholik-gallery-main::before {
    content: '';
    display: block;
    padding-bottom: 100%; /* Ratio 1:1 */
}

.aromaholik-gallery-main-wrapper {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.aromaholik-gallery-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.aromaholik-gallery-slide.active {
    opacity: 1;
    visibility: visible;
    z-index: 1;
    animation: slideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes slideIn {
    from { opacity: 0; transform: translateX(10px);}
    to   { opacity: 1; transform: translateX(0);}
}

/* === ZOOM ICON === */
.aromaholik-zoom-icon {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
    z-index: 5;
}

/* === NAVIGATION ARROWS === */
.aromaholik-gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: auto;
    height: auto;
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #fff;
    opacity: 0.85;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.aromaholik-gallery-nav:hover {
    opacity: 1;
    transform: translateY(-50%) scale(1.12);
}
.aromaholik-gallery-nav:disabled {
    opacity: 0.25;
    cursor: not-allowed;
}
.aromaholik-gallery-nav:disabled:hover {
    transform: translateY(-50%);
}
.aromaholik-gallery-nav svg {
    width: 36px;
    height: 36px;
    stroke-width: 2.5;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.2))
    drop-shadow(0 0 2px rgba(0, 0, 0, 0.25));
    transition: all 0.3s ease;
    display: block;
    pointer-events: none;
}
.aromaholik-gallery-nav:hover svg {
    stroke-width: 3;
    filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.25))
    drop-shadow(0 0 3px rgba(0, 0, 0, 0.30));
}
.aromaholik-gallery-prev { left: 16px; }
.aromaholik-gallery-next { right: 16px; }

/* === THUMBNAILS === */
.aromaholik-gallery-thumbs {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #67b112 #f0f0f0;
    padding: 2px 0;
}
.aromaholik-gallery-thumbs::-webkit-scrollbar { height: 6px; }
.aromaholik-gallery-thumbs::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 3px;
}
.aromaholik-gallery-thumbs::-webkit-scrollbar-thumb {
    background: #67b112;
    border-radius: 3px;
}
.aromaholik-gallery-thumbs::-webkit-scrollbar-thumb:hover {
    background: #d4a584;
}
.aromaholik-gallery-thumbs-wrapper {
    display: flex;
    gap: 10px;
    padding: 4px 0;
}
.aromaholik-gallery-thumb {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    background: #fff;
    padding: 0;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}
.aromaholik-gallery-thumb::before {
    content: '';
    position: absolute;
    inset: 0;
    background: transparent;
    transition: background 0.25s ease;
    pointer-events: none;
    z-index: 1;
}
.aromaholik-gallery-thumb:hover {
    border-color: #c0c0c0;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
.aromaholik-gallery-thumb:hover::before {
    background: rgba(0, 0, 0, 0.05);
}
.aromaholik-gallery-thumb.active {
    border-color: #67b112;
    border-width: 3px;
    box-shadow: 0 0 0 1px rgba(225, 185, 152, 0.3),
    0 2px 8px rgba(225, 185, 152, 0.2);
}
.aromaholik-gallery-thumb.active::before { background: transparent; }
.aromaholik-gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: transform 0.25s ease;
}
.aromaholik-gallery-thumb:hover img { transform: scale(1.08); }

/* === SPACING FIXES I FLOW === */
.single-product .aromaholik-product-gallery {
    margin-bottom: 32px;
}
.aromaholik-product-gallery + * {
    margin-top: 0;
    clear: both !important;
}


@media (max-width: 767px) {
    .aromaholik-gallery-nav svg { width: 32px; height: 32px; }
    .aromaholik-gallery-prev { left: 12px; }
    .aromaholik-gallery-next { right: 12px; }
    .aromaholik-gallery-main { margin-bottom: 20px;}
    .aromaholik-gallery-thumbs { margin-bottom: 15px !important; }
    .aromaholik-product-gallery { margin-bottom: 5px !important;}
}
@media (min-width: 1024px) {
    .aromaholik-gallery-main { margin-bottom: 24px; border-radius: 16px;}
    .aromaholik-gallery-thumbs {margin-bottom: 15px;}
    .aromaholik-gallery-thumb { width: 90px; height: 90px; border-radius: 10px;}
    .aromaholik-gallery-thumbs-wrapper { gap: 14px;}
    .aromaholik-gallery-nav svg { width: 40px; height: 40px;}
    .aromaholik-gallery-prev { left: 20px;}
    .aromaholik-gallery-next { right: 20px;}
}
@media (min-width: 1280px) {
    .aromaholik-gallery-thumb { width: 100px; height: 100px;}
}

/* --- ABSOLUTNY STOPPER -- wymuś flow poniżej galerii --- */
.aromaholik-product-gallery,
.aromaholik-gallery-main,
.aromaholik-gallery-main-wrapper {
    box-sizing: border-box !important;
}

.aromaholik-product-gallery + *,
.aromaholik-gallery-main + * {
    clear: both !important;
    position: static !important;
}

.product_title,
.elementor-widget-woocommerce-product-title,
h1.product_title {
    position: relative !important;
    z-index: 2 !important;
    background: transparent !important;
    margin-top: 12px !important;
    clear: both !important;
    display: block !important;
}

/* Wyłącz wbudowany lightbox Elementora dla Twojej galerii */
.aromaholik-product-gallery .aromaholik-gallery-lightbox-trigger {
    pointer-events: none !important; /* ← to blokuje DOM click */
}
.aromaholik-product-gallery .aromaholik-gallery-lightbox-trigger > * {
    pointer-events: auto !important; /* ale dzieci (img, svg) mają działać */
}

/* ========================================
   AROMAHOLIK LIGHTBOX — FULLSCREEN
   ======================================== */

/* 🔲 GŁÓWNY KONTENER LIGHTBOXA */
.aromaholik-gallery-lightbox {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 999999 !important;
    background: transparent !important;
    display: flex !important; /* Changed: always flex */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s cubic-bezier(0.165, 0.84, 0.44, 1),
    visibility 0.35s;
    pointer-events: none;
}

/* Active state - when lightbox is open */
.aromaholik-gallery-lightbox.active {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: all !important;
}

/* 🔲 NAKŁADKA (overlay) — półprzezroczyste tło */
.aromaholik-lightbox-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    cursor: pointer;
    transition: background 0.35s ease;
    z-index: 1; /* Added z-index */
}

.aromaholik-gallery-lightbox:hover .aromaholik-lightbox-overlay {
    background: rgba(0, 0, 0, 0.92);
}

/* 🔲 KONTENER ZAWARTOŚCI — wyśrodkowany */
.aromaholik-lightbox-container {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 100vw;
    max-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    z-index: 10; /* Added z-index */
}

/* 🔲 OBRAZ W LIGHTBOXIE */
.aromaholik-lightbox-content {
    position: relative;
    max-width: 95vw;
    max-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    z-index: 15; /* Added z-index */
}

.aromaholik-lightbox-image {
    max-width: 100%;
    max-height: 100%;
    height: auto;
    width: auto;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.45),
    0 10px 25px rgba(0, 0, 0, 0.3);
    background: #fff;
    display: block;
    position: relative; /* Added */
    z-index: 15; /* Added */
}

/* Animation for image when lightbox opens */
.aromaholik-gallery-lightbox.active .aromaholik-lightbox-image {
    animation: lightboxFadeIn 0.4s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}

@keyframes lightboxFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* 🔲 PRZYCISKI — ZAMKNIJ, POPRZEDNIE, NASTĘPNE */
.aromaholik-lightbox-close,
.aromaholik-lightbox-prev,
.aromaholik-lightbox-next {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.94);
    color: #333;
    border: none;
    cursor: pointer;
    z-index: 100; /* Increased z-index */
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22),
    0 1px 4px rgba(0, 0, 0, 0.12);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    font-size: 0;
    padding: 0;
    margin: 0;
}

.aromaholik-lightbox-close:hover,
.aromaholik-lightbox-prev:hover,
.aromaholik-lightbox-next:hover {
    background: #67b112;
    color: white;
    transform: scale(1.12);
    box-shadow: 0 6px 20px rgba(18, 179, 40, 0.4),
    0 2px 8px rgba(0, 0, 0, 0.2);
}

/* 🔲 ZAMKNIJ — prawy górny róg */
.aromaholik-lightbox-close {
    top: 24px;
    right: 24px;
}

/* 🔲 POPRZEDNIE — lewy bok */
.aromaholik-lightbox-prev {
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
}

.aromaholik-lightbox-prev:hover {
    transform: translateY(-50%) scale(1.12);
}

/* 🔲 NASTĘPNE — prawy bok */
.aromaholik-lightbox-next {
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
}

.aromaholik-lightbox-next:hover {
    transform: translateY(-50%) scale(1.12);
}

/* 🔲 IKONY SVG — skalowanie i kolor */
.aromaholik-lightbox-close svg,
.aromaholik-lightbox-prev svg,
.aromaholik-lightbox-next svg {
    width: 28px;
    height: 28px;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    pointer-events: none;
    display: block;
}

.aromaholik-lightbox-close:hover svg,
.aromaholik-lightbox-prev:hover svg,
.aromaholik-lightbox-next:hover svg {
    stroke-width: 2.5;
}

/* 🔲 LICZNIK (1 / 4) — górny środek */
.aromaholik-lightbox-counter {
    position: absolute;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.65);
    color: white;
    font-size: 15px;
    font-weight: 500;
    padding: 8px 20px;
    border-radius: 24px;
    z-index: 100; /* Increased z-index */
    pointer-events: none;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    letter-spacing: 0.5px;
}

.aromaholik-lightbox-counter .current {
    color: #67b112;
    font-weight: 600;
}

.aromaholik-gallery-lightbox.active .aromaholik-lightbox-container > * {
    opacity: 1;
    transform: translateY(0);
}

.aromaholik-lightbox-close { transition-delay: 0.1s; }
.aromaholik-lightbox-prev { transition-delay: 0.15s; }
.aromaholik-lightbox-next { transition-delay: 0.15s; }
.aromaholik-lightbox-counter { transition-delay: 0.2s; }


.aromaholik-lightbox-image.loading::after {
    content: '';
    position: absolute;
    width: 40px;
    height: 40px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top: 3px solid #67b112;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ========================================
   MEDIA QUERIES — RESPONSIVE
   ======================================== */

/* 📱 Mobile (iPhone, Android) */
@media (max-width: 767px) {
    .aromaholik-lightbox-container {
        padding: 16px;
    }

    .aromaholik-lightbox-content {
        max-height: 80vh;
    }

    .aromaholik-lightbox-image {
        border-radius: 10px;
        box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
    }

    .aromaholik-lightbox-close,
    .aromaholik-lightbox-prev,
    .aromaholik-lightbox-next {
        width: 50px;
        height: 50px;
    }

    .aromaholik-lightbox-close {
        top: 16px;
        right: 16px;
    }

    .aromaholik-lightbox-prev {
        left: 16px;
    }

    .aromaholik-lightbox-next {
        right: 16px;
    }

    .aromaholik-lightbox-counter {
        top: 16px;
        padding: 6px 16px;
        font-size: 14px;
    }

    .aromaholik-lightbox-close svg,
    .aromaholik-lightbox-prev svg,
    .aromaholik-lightbox-next svg {
        width: 26px;
        height: 26px;
    }
}

/* 📲 Bardzo małe ekrany (iPhone SE) */
@media (max-width: 480px) {
    .aromaholik-lightbox-counter {
        font-size: 13px;
        padding: 5px 14px;
    }

    .aromaholik-lightbox-close,
    .aromaholik-lightbox-prev,
    .aromaholik-lightbox-next {
        width: 46px;
        height: 46px;
    }

    .aromaholik-lightbox-close svg,
    .aromaholik-lightbox-prev svg,
    .aromaholik-lightbox-next svg {
        width: 24px;
        height: 24px;
    }
}

/* 🖥️ Duże ekrany (desktop+) */
@media (min-width: 1200px) {
    .aromaholik-lightbox-close,
    .aromaholik-lightbox-prev,
    .aromaholik-lightbox-next {
        width: 64px;
        height: 64px;
    }

    .aromaholik-lightbox-close svg,
    .aromaholik-lightbox-prev svg,
    .aromaholik-lightbox-next svg {
        width: 32px;
        height: 32px;
    }

    .aromaholik-lightbox-counter {
        font-size: 16px;
        padding: 10px 24px;
    }
}
