/* ===================================
   QUICK VIEW TRIGGER - SLIDE EFFECT
   =================================== */

/* Product wrapper - ensure relative position */
.woocommerce ul.products li.product .astra-shop-thumbnail-wrap,
.woocommerce ul.products li.product .woocommerce-loop-product__link,
.woocommerce ul.products li.product > a:first-child {
    position: relative;
    overflow: hidden;
    display: block;
}

/* Quick View Button - Hidden by default */
.ah-qv-trigger {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    border-radius: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
    white-space: nowrap;
}

.ah-qv-trigger svg {
    width: 18px;
    height: 18px;
    transition: transform 0.3s ease;
}

/* Show on product hover */
.woocommerce ul.products li.product:hover .ah-qv-trigger {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    visibility: visible;
}

/* Button hover effect */
.ah-qv-trigger:hover {
    background: #67b112;
    color: #fff;
    transform: translateX(-50%) translateY(-3px) scale(1.05);
    box-shadow: 0 6px 20px rgba(18, 179, 40, 0.25);
}

.ah-qv-trigger:hover svg {
    transform: scale(1.1);
}

/* Active/Click state */
.ah-qv-trigger:active {
    transform: translateX(-50%) translateY(0) scale(0.98);
}

/* ===================================
   MODAL CONTAINER WITH OVERFLOW FIX
   =================================== */

/* Body class when modal is open */
body.qv-modal-open {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
}

.ah-qv-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: none;
    overflow: hidden; /* Prevent overflow */
}

.ah-qv-modal.active {
    display: block;
}

.ah-qv-modal *,
.ah-qv-modal *::before,
.ah-qv-modal *::after {
    box-sizing: border-box;
}

.ah-qv-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.25s ease;
    cursor: pointer;
}

.ah-qv-wrapper {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 1200px;
    max-height: 90vh;
    background: #fff;
    border-radius: 16px;
    overflow-y: auto; /* Only vertical scroll */
    overflow-x: hidden; /* No horizontal scroll */
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    -webkit-overflow-scrolling: touch;
}

/* Scrollbar styling */
.ah-qv-wrapper::-webkit-scrollbar {
    width: 6px;
}

.ah-qv-wrapper::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 3px;
}

.ah-qv-wrapper::-webkit-scrollbar-thumb {
    background: #67b112;
    border-radius: 3px;
}

.ah-qv-wrapper::-webkit-scrollbar-thumb:hover {
    background: #0e8a20;
}

/* ===================================
   MODAL CONTENT WITH OVERFLOW FIX
   =================================== */

.ah-qv-content {
    position: relative;
    padding: 40px;
    min-height: 400px;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden; /* Prevent horizontal overflow */
    box-sizing: border-box;
}

.ah-qv-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    background: transparent;
    border: none;
}

.ah-qv-close svg {
    width: 24px;
    height: 24px;
    fill: #0e8a20;
}

.ah-qv-close:hover {
    transform: rotate(90deg);
}

.ah-qv-inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* ===================================
   GALLERY SECTION - FIXED FOR MOBILE
   =================================== */

.ah-qv-gallery-container {
    position: relative;
    width: 100%;
    max-width: 100%;
    margin-bottom: 24px;
    overflow: hidden;
    box-sizing: border-box;
}

.ah-qv-gallery-main {
    position: relative;
    width: 100%;
    max-width: 100%;
    aspect-ratio: 1 / 1;
    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: 15px;
    box-sizing: border-box;
}

.ah-qv-gallery-slider {
    position: relative;
    width: 100%;
    height: 100%;
}

/* Gallery Slides */
.ah-qv-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ah-qv-slide.active {
    opacity: 1;
    visibility: visible;
    z-index: 1;
    animation: slideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.ah-qv-slide img {
    width: 100%;
    height: 100%;
    max-width: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* White background products */
.ah-qv-slide.white-bg img {
    object-fit: contain;
    padding: 5%;
}

.ah-qv-gallery-main:hover .ah-qv-slide.active img {
    transform: scale(1.08);
}

/* Navigation Arrows */
.ah-qv-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);
}

.ah-qv-nav:hover {
    opacity: 1;
    transform: translateY(-50%) scale(1.12);
}

.ah-qv-nav svg {
    width: 36px;
    height: 36px;
    stroke-width: 2.5;
    stroke: currentColor;
    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;
}

.ah-qv-nav-prev {
    left: 16px;
}

.ah-qv-nav-next {
    right: 16px;
}

/* Thumbnails - Fixed for mobile */
.ah-qv-gallery-thumbs {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #67b112 #f0f0f0;
    margin-bottom: 24px;
    padding: 2px 0;
    display: flex;
    gap: 10px;
    box-sizing: border-box;
}

.ah-qv-gallery-thumbs::-webkit-scrollbar {
    height: 6px;
}

.ah-qv-gallery-thumbs::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 3px;
}

.ah-qv-gallery-thumbs::-webkit-scrollbar-thumb {
    background: #67b112;
    border-radius: 3px;
}

.ah-qv-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;
}

.ah-qv-thumb:hover {
    border-color: #c0c0c0;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.ah-qv-thumb.active {
    border-color: #67b112;
    border-width: 3px;
    box-shadow: 0 0 0 1px rgba(18, 179, 40, 0.3),
    0 2px 8px rgba(18, 179, 40, 0.2);
}

.ah-qv-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

/* ===================================
   PRODUCT SUMMARY - FIXED FOR MOBILE
   =================================== */

.ah-qv-details-link {
    color: #212121;
}

.reset_variations {
    color: #212121;
}

.ah-qv-details-link:hover {
    color: #212121;
}

.reset_variations:hover {
    color: #212121;
}

.ah-qv-summary {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}

/* Prevent text overflow */
.ah-qv-summary > * {
    display: flex;
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Product Title */
.ah-qv-summary .product-title {
    font-size: 28px;
    font-weight: 600;
    line-height: 1.2;
    color: #333;
    margin: 0;
    word-break: break-word;
}

/* Price */
.ah-qv-summary .price {
    font-size: 24px;
    font-weight: 700;
    color: #67b112;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ah-qv-summary .description strong::after {
    content: "";
    display: block;
}

/* Description */
.ah-qv-summary .description {
    font-size: 14px;
    line-height: 1.6;
    color: #666;
    padding: 15px 0;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
    word-break: break-word;
    display: block;
}

/* ===================================
   VARIATIONS FORM - FIXED FOR MOBILE
   =================================== */

.ah-qv-summary .variations {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
}

.ah-qv-summary .variation-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.ah-qv-summary .variation-item select {
    width: 100%;
    max-width: 100%;
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
}

/* ===================================
   ADD TO CART - FIXED FOR MOBILE
   =================================== */

.ah-qv-summary .cart {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.ah-qv-summary .single_add_to_cart_button {
    width: 100%;
    max-width: 100%;
    padding: 15px 30px;
    background: #67b112;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(18, 179, 40, 0.25);
    box-sizing: border-box;
}

/* ===================================
   ANIMATIONS
   =================================== */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translate(-50%, -45%) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===================================
   MOBILE RESPONSIVE - COMPLETE FIX
   =================================== */

@media (max-width: 768px) {
    /* Trigger always visible on mobile */
    .ah-qv-trigger {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
        visibility: visible;
        width: 40px;
        height: 40px;
        padding: 0;
        border-radius: 50%;
        bottom: 10px;
        display: none;
    }

    .ah-qv-trigger span {
        display: none;
    }

    /* Modal full screen on mobile */
    .ah-qv-wrapper {
        width: 100%;
        width: 100vw;
        height: 100%;
        height: 100vh;
        max-width: 100vw;
        max-height: 100vh;
        margin: 0;
        border-radius: 0;
        position: fixed;
        top: 0;
        left: 0;
        transform: none;
        overflow-y: auto;
        overflow-x: hidden;
    }

    .ah-qv-content {
        padding: 60px 15px 20px 15px;
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    }

    .ah-qv-close {
        position: fixed;
        top: 10px;
        right: 10px;
        z-index: 11;
    }

    .ah-qv-inner {
        grid-template-columns: 1fr;
        gap: 20px;
        width: 100%;
        max-width: 100%;
        padding: 0;
        margin: 0;
    }

    .ah-qv-gallery-container {
        width: 100%;
        max-width: calc(100vw - 30px); /* Account for padding */
        margin: 0 auto 20px auto;
    }

    .ah-qv-gallery-main {
        aspect-ratio: 4 / 3;
        border-radius: 8px;
        width: 100%;
        max-width: 100%;
    }

    .ah-qv-gallery-thumbs {
        width: 100%;
        max-width: calc(100vw - 30px); /* Account for padding */
        padding: 2px 0;
        margin: 0;
    }

    .ah-qv-nav svg {
        width: 32px;
        height: 32px;
    }

    .ah-qv-nav-prev {
        left: 12px;
    }

    .ah-qv-nav-next {
        right: 12px;
    }

    .ah-qv-thumb {
        width: 70px;
        height: 70px;
    }

    .ah-qv-summary {
        width: 100%;
        max-width: calc(100vw - 30px); /* Account for padding */
        margin: 0;
        padding: 0;
    }

    .ah-qv-summary .product-title {
        font-size: 22px;
    }

    .ah-qv-summary .price {
        font-size: 20px;
    }

    /* Ensure forms don't overflow */
    .ah-qv-summary .cart,
    .ah-qv-summary .variations_form {
        width: 100%;
        max-width: 100%;
    }

    .ah-qv-summary .single_add_to_cart_button {
        width: 100%;
        max-width: 100%;
        font-size: 14px;
        padding: 12px 20px;
    }
}

@media (max-width: 480px) {
    .ah-qv-content {
        padding: 50px 10px 20px 10px;
    }

    .ah-qv-gallery-container {
        max-width: calc(100vw - 20px);
    }

    .ah-qv-gallery-thumbs {
        max-width: calc(100vw - 20px);
    }

    .ah-qv-summary {
        max-width: calc(100vw - 20px);
    }

    .ah-qv-summary .product-title {
        font-size: 20px;
    }

    .ah-qv-thumb {
        width: 60px;
        height: 60px;
    }

    .ah-qv-close {
        width: 36px;
        height: 36px;
    }
}

/* Tablet */
@media (max-width: 1024px) and (min-width: 769px) {
    .ah-qv-wrapper {
        width: 95%;
        max-width: 900px;
    }

    .ah-qv-content {
        padding: 30px;
    }

    .ah-qv-inner {
        gap: 30px;
    }
}

/* Large Desktop */
@media (min-width: 1280px) {
    .ah-qv-thumb {
        width: 100px;
        height: 100px;
    }
}

/* Disable text selection on gallery controls */
.ah-qv-nav,
.ah-qv-thumb,
.ah-qv-close {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}