/**
 * Dynamic Product Popup Styles
 */

.dynamic-popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
}

.dynamic-popup.popup-active {
    display: block;
}

.popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    cursor: pointer;
    animation: fadeIn 0.3s ease-in-out;
}

.popup-container {
    position: relative;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    margin: 5vh auto;
    background: #d0a292 !important;
    border-radius: 8px;
    overflow-y: auto;
    z-index: 1000000;
    animation: slideIn 0.3s ease-in-out;
}

.popup-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #333;
    color: #fff;
    border: none;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    z-index: 1000001;
    transition: background 0.2s ease;
}

.popup-close:hover {
    background: #000;
}

.popup-content {
    padding: 20px;
}

.popup-loading-spinner {
    display: none;
    text-align: center;
    padding: 60px 20px;
    font-size: 18px;
    color: #666;
}

.popup-loading .popup-loading-spinner {
    display: block;
}

.popup-loading .popup-body {
    display: none;
}

.popup-loading-spinner span {
    display: inline-block;
    animation: pulse 1.5s ease-in-out infinite;
}

.popup-body {
    min-height: 200px;
}

.popup-image {
    margin-bottom: 20px;
    text-align: center;
}

.popup-image img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.popup-details {
    padding: 10px 0;
}

.popup-title {
    margin: 0 0 15px 0;
    font-size: 28px;
    font-weight: 700;
    color: #333;
}

.popup-price {
    font-size: 24px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 10px;
}

.popup-price del {
    color: #999;
    margin-right: 10px;
}

.popup-sku {
    font-size: 14px;
    color: #666;
    margin-bottom: 15px;
}

.popup-excerpt {
    margin: 15px 0;
    font-size: 16px;
    line-height: 1.6;
    color: #555;
}

.popup-custom-fields {
    margin: 20px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 4px;
}

.popup-custom-fields .custom-field {
    margin-bottom: 10px;
    font-size: 15px;
}

.popup-custom-fields .custom-field:last-child {
    margin-bottom: 0;
}

.popup-custom-fields strong {
    color: #333;
    margin-right: 5px;
}

.popup-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 20px 0;
}

.popup-gallery .gallery-thumb {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.popup-gallery .gallery-thumb:hover {
    transform: scale(1.1);
}

.popup-actions {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.popup-actions .button {
    display: inline-block;
    padding: 12px 24px;
    background: #0073aa;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 600;
    transition: background 0.2s ease;
    border: none;
    cursor: pointer;
}

.popup-actions .button:hover {
    background: #005177;
}

.popup-actions .add-to-cart {
    background: #28a745;
}

.popup-actions .add-to-cart:hover {
    background: #218838;
}

.stock-status {
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
}

.stock-status.in-stock {
    background: #d4edda;
    color: #155724;
}

.stock-status.out-of-stock {
    background: #f8d7da;
    color: #721c24;
}

.popup-error {
    padding: 40px 20px;
    text-align: center;
    color: #d32f2f;
    font-size: 16px;
}

body.popup-open {
    overflow: hidden;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@media (max-width: 768px) {
    .popup-container {
        width: 95%;
        margin: 2.5vh auto;
        max-height: 95vh;
    }
    
    .popup-title {
        font-size: 22px;
    }
    
    .popup-price {
        font-size: 20px;
    }
    
    .popup-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .popup-actions .button {
        width: 100%;
        text-align: center;
    }
}

/* === Two-column popup layout for dynamic product popup === */

.dynamic-popup .popup-layout-two-column {
    /* optional max width to keep it nice and tight */
    max-width: 960px;
    margin: 40px auto;
}

.dynamic-popup .popup-main.popup-columns {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-start;
    gap: 30px;
}

/* Left = image carousel */
.dynamic-popup .popup-column-left {
    flex: 0 0 50%;
    max-width: 50%;
}

/* Right = details */
.dynamic-popup .popup-column-right {
    flex: 0 0 50%;
    max-width: 50%;
}

/* Header title at top */
.dynamic-popup .popup-title-top {
    margin-bottom: 20px;
    font-size: 24px;
    font-weight: 600;
    color: #ffffff !important;
}

/* Inner title on right column */
.dynamic-popup .popup-title-main {
    margin: 0 0 10px;
    font-size: 22px;
    font-weight: 600;
}

/* Price styling */
.dynamic-popup .popup-price {
    margin-bottom: 10px;
    font-size: 20px;
    font-weight: 600;
}

/* Size + description text */
.dynamic-popup .popup-size {
    margin-bottom: 10px;
    font-size: 16px;
}

.dynamic-popup .popup-description {
    margin-bottom: 20px;
    font-size: 15px;
    line-height: 1.6;
}

/* Actions row (Add to cart + View Full Details) */
.dynamic-popup .popup-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.dynamic-popup .popup-actions .button {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 3px;
    text-decoration: none;
    cursor: pointer;
}

/* Basic button look – tweak to match your theme */
.dynamic-popup .popup-actions .add-to-cart {
    background-color: #2c3e50;
    color: #fff;
}

.dynamic-popup .popup-actions .view-product {
    background-color: #ffffff;
    color: #2c3e50;
    border: 1px solid #2c3e50;
}

/* Stock text */
.dynamic-popup .stock-status {
    font-size: 14px;
    margin-right: auto;
}

.dynamic-popup .stock-status.in-stock {
    color: #27ae60;
}

.dynamic-popup .stock-status.out-of-stock {
    color: #c0392b;
}

/* === Carousel / slider area (one image at a time) === */

.dynamic-popup .popup-column-left .elementor-image-carousel-wrapper.swiper {
    width: 100%;
}

.dynamic-popup .popup-column-left .elementor-image-carousel {
    width: 100%;
}

.dynamic-popup .popup-column-left .swiper-slide {
    text-align: center;
}

.dynamic-popup .popup-column-left .swiper-slide img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
}

/* Arrows & pagination inside the popup carousel (optional) */
.dynamic-popup .popup-column-left .elementor-swiper-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
}

.dynamic-popup .popup-column-left .elementor-swiper-button-prev {
    left: 10px;
}

.dynamic-popup .popup-column-left .elementor-swiper-button-next {
    right: 10px;
}

.dynamic-popup .popup-column-left .swiper-pagination {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 10px;
}


/* === Slider behaviour: show only active slide, full width === */

.dynamic-popup .popup-column-left .elementor-image-carousel-wrapper.swiper {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.dynamic-popup .popup-column-left .elementor-image-carousel {
    width: 100%;
}

.dynamic-popup .popup-column-left .swiper-slide {
    display: none;              /* hide all slides by default */
}

.dynamic-popup .popup-column-left .swiper-slide.is-active {
    display: block;             /* only active slide is visible */
}

.dynamic-popup .popup-column-left .swiper-slide img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;        /* large image filling the left column nicely */
}

/* Arrows */
.dynamic-popup .popup-column-left .elementor-swiper-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    background: rgba(0,0,0,0.4);
    border: none;
    padding: 6px 10px;
    cursor: pointer;
    color: #fff;
}

.dynamic-popup .popup-column-left .elementor-swiper-button-prev {
    left: 10px;
}

.dynamic-popup .popup-column-left .elementor-swiper-button-next {
    right: 10px;
}

/* Pagination bullets */
.dynamic-popup .popup-column-left .swiper-pagination {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 10px;
    text-align: center;
}

.dynamic-popup .popup-column-left .swiper-pagination-bullet {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin: 0 4px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    cursor: pointer;
}

.dynamic-popup .popup-column-left .swiper-pagination-bullet-active {
    background: #fff;
}
/* FORCE the gallery image to expand and fully fill the left column */
.dynamic-popup .popup-column-left .swiper-slide-image {
    width: 100% !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    display: block !important;
}

/* Make the product popup a bit wider so the image has room */
.dynamic-popup .popup-container {
    max-width: 1000px; /* or 1100px if you prefer */
}

/* Make left column larger than right column */
.dynamic-popup .popup-main.popup-columns {
    align-items: stretch;
}

.dynamic-popup .popup-column-left {
    flex: 0 0 60%;
    max-width: 60%;
}

.dynamic-popup .popup-column-right {
    flex: 0 0 40%;
    max-width: 40%;
}

/* Ensure the slide image fills the left column area */
.dynamic-popup .popup-column-left .swiper-slide-inner {
    width: 100%;
}

.dynamic-popup .popup-column-left .swiper-slide-image {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}
/* ==== FORCE POPUP GALLERY IMAGE TO FILL LEFT COLUMN ==== */

/* Make every layer in the left carousel stretch full width */
.dynamic-popup .popup-column-left .popup-image-slider,
.dynamic-popup .popup-column-left .popup-image-slider .elementor-widget-container,
.dynamic-popup .popup-column-left .elementor-image-carousel-wrapper.swiper,
.dynamic-popup .popup-column-left .elementor-image-carousel.swiper-wrapper,
.dynamic-popup .popup-column-left .swiper-slide,
.dynamic-popup .popup-column-left .swiper-slide-inner {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
}

/* Remove any thumbnail-sized constraints Elementor adds */
.dynamic-popup .popup-column-left .swiper-slide-image {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: none !important;
    object-fit: contain !important;
}
/* Mobile: stack popup into a single column */
@media (max-width: 768px) {
    .dynamic-popup .popup-main.popup-columns {
        flex-direction: column;
        flex-wrap: nowrap;
    }

    .dynamic-popup .popup-column-left,
    .dynamic-popup .popup-column-right {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }

    .dynamic-popup .popup-column-left {
        margin-bottom: 20px;
    }
}
/* Grey tone for size + description text */
.dynamic-popup .popup-size,
.dynamic-popup .popup-description,
.dynamic-popup .popup-product-details {
    color: #000 !important;   /* soft grey */
}

/* Price text colour */
.dynamic-popup .popup-price,
.dynamic-popup .popup-price * {
    color: #422b0b !important;
}

/* Add to Cart button colour + hover */
.dynamic-popup .popup-actions .add-to-cart {
    background-color: #422b0b !important;
    color: #ffffff !important;   /* keep readable */
}

.dynamic-popup .popup-actions .add-to-cart:hover {
    background-color: #422b0b !important; /* slightly darker hover */
}

/* restrict scroll
/* Remove all scrollbars inside the popup */
.dynamic-popup,
.dynamic-popup * {
    scrollbar-width: none !important;      /* Firefox */
}

.dynamic-popup::-webkit-scrollbar,
.dynamic-popup *::-webkit-scrollbar {
    display: none !important;              /* Chrome / Safari / Edge */
}

/* Prevent any horizontal overflow */
.popup-container,
.popup-content,
.popup-body,
.popup-layout-two-column {
    overflow-x: hidden !important;
}

/* Limit vertical behaviour so it does not start scrolling body */
.popup-container {
    overflow-y: auto;
}
/* Force left image column to stay within 50% width */
.dynamic-popup .popup-column-left {
    flex: 0 0 50% !important;
    max-width: 50% !important;
    overflow: hidden !important;
}

/* Prevent the slider from overflowing the column */
.dynamic-popup .popup-column-left .elementor-image-carousel-wrapper,
.dynamic-popup .popup-column-left .elementor-image-carousel,
.dynamic-popup .popup-column-left .swiper-slide-inner,
.dynamic-popup .popup-column-left img {
    max-width: 100% !important;
    width: 100% !important;
    object-fit: contain !important;
}

/* Add padding so the right column text never touches the edge */
.dynamic-popup .popup-column-right {
    padding-right: 25px !important;
}

/* Optional: prevent layout stretching due to internal flex */
.dynamic-popup .popup-main.popup-columns {
    align-items: flex-start;
    overflow: hidden;
}
/* Desktop-only vertical centering of left image column */
@media (min-width: 769px) {

    /* Make the row stretch children to equal height */
    .dynamic-popup .popup-main.popup-columns {
        display: flex !important;
        align-items: stretch !important;
    }

    /* Left column becomes flex container, centers its content vertically */
    .dynamic-popup .popup-column-left {
        display: flex !important;
        flex-direction: column;
        justify-content: center !important;  /* vertical center */
    }

    /* Ensure the slider block participates in centering and doesn't have extra margins */
    .dynamic-popup .popup-column-left .popup-image-slider,
    .dynamic-popup .popup-column-left .elementor-image-carousel-wrapper.swiper {
        flex: 0 0 auto;
        margin-top: 0 !important;
        margin-bottom: 0 !important;
    }

    /* Center image inside its slide as well (in case slide is taller) */
    .dynamic-popup .popup-column-left .swiper-slide-inner {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
}
/* ==== MOBILE: force single-column popup layout ==== */
@media (max-width: 768px) {

    /* Stack columns instead of side-by-side */
    .dynamic-popup .popup-main.popup-columns {
        display: block !important;          /* no flex row on mobile */
    }

    .dynamic-popup .popup-column-left,
    .dynamic-popup .popup-column-right {
        display: block !important;          /* undo flex centering on mobile */
        flex: none !important;
        width: 100% !important;
        max-width: 100% !important;
        padding-right: 0 !important;
    }

    .dynamic-popup .popup-column-left {
        margin-bottom: 20px !important;     /* spacing between image and text */
    }
}

/* Hide pagination dots in the popup slider */
.dynamic-popup .swiper-pagination {
    display: none !important;
}

/* Price + Add to Cart inline row */
.dynamic-popup .popup-price-row {
    display: flex;
    align-items: center;
    gap: 15px;
    margin: 10px 0 15px;
}

/* Remove extra margin under price when inline */
.dynamic-popup .popup-price-row .popup-price {
    margin: 0;
}

/* Tighter inline add-to-cart styling (uses your existing colours) */
.dynamic-popup .popup-price-row .add-to-cart-inline {
    padding: 8px 18px;
    font-size: 14px;
    line-height: 1.2;
}
/* Fix close button centering */
.popup-close {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;

    width: 40px !important;
    height: 40px !important;

    padding: 0 !important;
    line-height: 1 !important;

    font-size: 26px !important;
    font-weight: bold;

    background: rgba(255,255,255,0.25) !important; /* the background you have */
    color: #ffffff !important;

    border-radius: 50% !important;
}
