/* =========================================
   PRODUCT DETAILS MODAL
========================================= */

.product-modal,
.product-modal * {
    box-sizing: border-box;
}

.product-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: clamp(8px, 2vw, 24px);
    font-family: inherit;
}

.product-modal.is-open {
    display: flex;
}

.product-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(20, 17, 13, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* MAIN MODAL */

.product-modal-container {
    position: relative;
    z-index: 1;

    display: grid;
    grid-template-columns:
        minmax(0, 1.12fr)
        minmax(0, 0.88fr);

    width: min(1350px, 100%);
    height: min(700px, calc(100dvh - 80px));
    min-height: 0;

    padding: clamp(18px, 2vw, 32px);
    gap: clamp(22px, 3vw, 44px);

    background: #fff;
    border-radius: clamp(12px, 1.4vw, 12px);
    box-shadow: 0 20px 80px rgba(0, 0, 0, 0.2);

    overflow: hidden;
    outline: none;
}

/* CLOSE BUTTON */

.product-modal-close {
    position: absolute;
    z-index: 5;
    top: 10px;
    right: 10px;

    display: grid;
    place-items: center;

    width: clamp(34px, 3vw, 42px);
    aspect-ratio: 1;

    padding: 0;
    border: 0;
    border-radius: 50%;

    background: white;
    color: #222;

    font-family: Arial, sans-serif;
    font-size: clamp(24px, 2.4vw, 32px);
    line-height: 1;

    cursor: pointer;
    transition: background 0.2s ease;
}

.product-modal-close:hover {
    background: #e8e8e8;
}

/* =========================================
   DESKTOP IMAGE GALLERY
========================================= */

.modal-gallery {
    display: grid;
    grid-template-columns:
        clamp(58px, 9vw, 100px)
        minmax(0, 1fr);

    gap: clamp(10px, 1.2vw, 16px);

    min-width: 0;
    min-height: 0;
    align-self: stretch;
}

/* THUMBNAILS */
.modal-thumbnails {
    display: flex;
    flex-direction: column;
    gap: clamp(8px, 1vw, 12px);

    min-width: 0;
    min-height: 0;

    overflow-x: hidden;
    overflow-y: auto;

    scrollbar-width: thin;
    scrollbar-color: #d5d5d5 transparent;
}

.modal-thumbnail {
    display: block;
    flex: 0 0 auto;

    width: 100%;
    aspect-ratio: 1 / 1;

    padding: 0;
    border: none;
    background: transparent;
    border-radius: 0;

    cursor: pointer;
}

.modal-thumbnail img {
    display: block;

    width: 100%;
    height: 100%;

    object-fit: cover;
    border: 3px solid transparent;
    border-radius: 10px;

    transition: border-color 0.2s ease;
}

.modal-thumbnail:hover img {
    border-color: #b98a45;
}

.modal-thumbnail.is-active img {
    border-color: #c79643;
}

/* MAIN IMAGE */
.modal-main-image{
width: 100%;
height: 100%;
border-radius: 12px;
background: #bebebe;
display: flex;
align-items: center;
justify-content: center;
}
.modal-main-image img{
display: block;
border-radius: 12px;

width: 100%;
height: 100%;

object-fit: cover;
transition: opacity 0.18s ease;
}

/* =========================================
   PRODUCT INFORMATION SCROLL
========================================= */

/* =========================================
   PRODUCT INFORMATION SCROLL
========================================= */

.modal-information {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}


.modal-information-content {
    display: flex;
    flex-direction: column;
    /* align-items: stretch; */
    text-align: start;

    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    min-height: 0;

    padding: 8px 12px 16px;

    overflow: hidden;
}

.modal-scroll {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    min-height: 0;

    overflow-x: hidden;
    overflow-y: auto;

    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
}


/* Scrollbar styling */
.modal-scroll::-webkit-scrollbar {
    width: 5px;
}

/* .modal-scroll::-webkit-scrollbar-thumb {
    background: #d5d5d5;
    border-radius: 10px;
} */

.modal-information h2 {
    margin: 0;
    padding-right: 32px;

    color: #171717;
    font-size: clamp(20px, 2.8vw, 28px);
    line-height: 1.15;
    font-weight: 600;
    letter-spacing: -0.8px;
    font-family: serif;
}

.modal-subtitle {
    color: #777;
    margin-top: 8px;
    font-size: clamp(14px, 1vw, 16px);
    line-height: 1.55;
    font-family: serif;
}

/* PRICE */

.modal-price-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: clamp(8px, 1.5vw, 14px);
    margin-top: -8px;
}

.modal-current-price {
    color: #151515;
    font-size: clamp(16px, 2.5vw, 24px);
    line-height: 1.1;
    font-weight: 700;
    white-space: nowrap;
    font-family: serif;
}

.modal-old-price {
    color: #b77b7b;
    font-size: clamp(14px, 1.4vw, 20px);
    text-decoration: line-through;
    white-space: nowrap;
}

.modal-discount {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 6px 12px;

    background: #eaf7d2;
    color: #526c29;

    border-radius: 30px;

    font-size: clamp(12px, 0.9vw, 14px);
    font-weight: 600;
    white-space: nowrap;
}

/* PACK SIZE */

.modal-pack-section {
    margin-bottom: 12px;
    margin-top: 12px;
}


.modal-pack-options {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}

.modal-pack-option {
    min-width: clamp(90px, 9vw, 100px);
    min-height: 30px;

    padding: 8px 12px;

    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;

    color: #252525;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;

    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-pack-option:hover {
    border-color: #c79643;
}

.modal-pack-option.is-active {
    background: #fff4df;
    border: 1.5px solid #c79643;
    box-shadow: 0 0 0 1px rgba(199, 150, 67, 0.12);
}

/* AMAZON PURCHASE BUTTON */

.modal-buy-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;

    width: 100%;
    height: 45px;
    padding: 5px 0;

    border: 0;
    border-radius: 8px;

    background: #ffad1f;
    color: #17120a;
    font-family: sans-serif;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;

    cursor: pointer;

    transition:
        background 0.2s ease,
        transform 0.2s ease;
}

.modal-buy-button:hover {
    background: #f5a014;
}

.modal-buy-button:active {
    transform: scale(0.99);
}

.modal-buy-button img {
    display: block;
    width: 80px;
}

.modal-buy-mobile {
    display: none;
}

.modal-divider {
   margin: 5px 0;
}

/* DESCRIPTION */

.modal-description-section h3 {
    color: #222;
    font-size: clamp(17px, 1.5vw, 21px);
    font-weight: 500;
    text-align: start;
}

.modal-description-section p {
    text-align: start;
    color: #777;
    font-size: clamp(13px, 1vw, 14px);
    line-height: 1.65;

    overflow-wrap: anywhere;
}

/* NUTRITION FACTS */

.modal-nutrition-image {
    display: block;
    width: 100%;
    max-width: 480px;
    height: auto;
    object-fit: contain;
}

.modal-accordion-content .modal-nutrition-image {
    margin-top: 4px;
}



/* ACCORDIONS */

.modal-accordions {
    margin-bottom: 8px;
}

.modal-accordion {
    border-top: 1px solid #e5e5e5;
}

.modal-accordion:last-child {
    border-bottom: 1px solid #e5e5e5;
}

.modal-accordion summary {
    position: relative;

    padding: 13px 25px 13px 0;

    color: #292929;
    font-size: 14px;
    font-weight: 500;

    cursor: pointer;
    list-style: none;
}

.modal-accordion summary::-webkit-details-marker {
    display: none;
}

.modal-accordion summary::after {
    content: "+";

    position: absolute;
    top: 50%;
    right: 3px;

    transform: translateY(-50%);

    color: #555;
    font-size: 20px;
    font-weight: 400;
}

.modal-accordion[open] summary::after {
    content: "\2212";
}

.modal-accordion-content {
    padding: 0 0 14px;

    color: #777;
    font-size: 13px;
    line-height: 1.65;

    overflow-wrap: anywhere;
}

/* =========================================
   MOBILE — IMAGE FULL WIDTH, CONTENT PADDED
========================================= */

@media (max-width: 767px) {

    /* Full-screen modal */
    .product-modal {
        padding: 0;
        align-items: stretch;
        justify-content: stretch;
    }

    /* Remove all container padding */
    .product-modal-container {
        display: flex;
        flex-direction: column;
        width: 100%;
        max-width: 100%;
        height: 100dvh;
        max-height: 100dvh;
        min-height: 0;
        margin: 0;
        padding: 0;
        gap: 0;
        border-radius: 0;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

/* =========================================
   MOBILE — NATURAL IMAGE DIMENSIONS
========================================= */

.modal-gallery {
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
    width: 100%;
    height: auto;
    min-height: 0;
    max-height: none;
    gap: 8px;
    padding: 0;
    margin: 0;
    overflow: visible;
}

/* Main image wrapper */
.modal-main-image {
    order: 1;
    display: block;
    flex: 0 0 auto;
    width: 100%;
    height: auto;
    min-width: 0;
    min-height: 0;
    padding: 0;
    margin: 0;
    border-radius: 0;
    overflow: visible;
    background: transparent;
}

/* Image retains its original aspect ratio */
#modalMainImage,
.modal-main-image img {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
    max-height: none;
    padding: 0;
    margin: 0;
    border-radius: 0;
    object-fit: initial;
    object-position: center;
}

    /* Thumbnails below the main image */
    .modal-thumbnails {
        order: 2;
        display: flex;
        flex-direction: row;
        flex: 0 0 56px;
        width: 100%;
        height: 56px;
        min-height: 56px;
        padding: 0 12px;
        margin: 0;
        gap: 6px;
        overflow-x: auto;
        overflow-y: hidden;
        box-sizing: border-box;
        scrollbar-width: thin;
        -webkit-overflow-scrolling: touch;
    }

    .modal-thumbnail {
        display: flex;
        flex: 0 0 50px;
        width: 50px;
        height: 50px;
        min-width: 50px;
        min-height: 50px;
        padding: 3px;
        align-items: center;
        justify-content: center;
        overflow: hidden;
        box-sizing: border-box;
    }

    .modal-thumbnail img {
        display: block;
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: center;
    }

    /* =========================================
       PRODUCT INFORMATION — ADD PADDING HERE
    ========================================= */

    .modal-information {
        display: flex;
        flex-direction: column;
        flex: 0 0 auto;
        width: 100%;
        height: auto;
        min-width: 0;
        min-height: 0;
        padding: 4px 16px 28px;
        margin: 0;
        overflow: visible;
        box-sizing: border-box;
    }

    .modal-information-content {
        display: flex;
        flex-direction: column;
        flex: 0 0 auto;
        width: 100%;
        height: auto;
        min-width: 0;
        min-height: 0;
        padding: 0;
        overflow: visible;
        box-sizing: border-box;
    }

    #modalProductName {
        font-size: 23px;
        line-height: 1.3;
        margin-bottom: 8px;
        overflow-wrap: anywhere;
    }

    .modal-subtitle {
        font-size: 13px;
        line-height: 1.5;
        margin-top: 0;
        margin-bottom: 0;
    }

    .modal-price-row {
        margin-top: 0;
        gap: 8px;
    }

    .modal-current-price {
        font-size: 21px;
    }

    /* Pack options */
    .modal-pack-section {
        margin-top: 12px;
        margin-bottom: 0px;
    }

    .modal-pack-options {
        display: flex;
        flex-wrap: wrap;
        gap: 7px;
        margin-bottom: 12px;
    }

    .modal-pack-options button {
        max-width: 100%;
        box-sizing: border-box;
    }

    /* Buy button */
    .modal-buy-desktop {
        display: none !important;
    }

    .modal-buy-mobile {
        display: flex;
        justify-content: center;
        align-items: center;
        width: 100%;
        margin: 14px 0;
        box-sizing: border-box;
    }


    /* Description and accordions */
    .modal-divider {
        margin: 5px 0;
    }

    .modal-scroll {
        flex: 0 0 auto;
        width: 100%;
        height: auto;
        max-height: none;
        min-height: 0;
        padding: 0;
        overflow: visible;
        box-sizing: border-box;
    }

    .modal-scroll section {
        max-width: 100%;
        box-sizing: border-box;
    }

    .modal-scroll p {
        font-size: 14px;
        line-height: 1.7;
    }

    .modal-scroll h3,
    .modal-scroll h4 {
        line-height: 1.4;
    }

    /* Nutrition facts image */
    #modalNutritionImage {
        display: block;
        width: 100%;
        max-width: 480px;
        height: auto;
        max-height: none;
        margin: 12px auto;
        object-fit: contain;
        box-sizing: border-box;
    }

    /* Close button */
    .product-modal-close {
        position: fixed;
        top: 10px;
        right: 10px;
        z-index: 1000;
    }
}
