/* Product page (includes/product_info.php). Everything is scoped to the product block,
   so the shared classes (#buy-box, .addtocartbutton, owl) elsewhere are not touched. */

/* The image slider preloads full size pictures into 1px divs at the end of <body>.
   The pictures are wider than a phone and made the whole page scroll sideways. */
body > div[style*="visibility: hidden"][style*="left: -1px"] {
    overflow: hidden !important;
}

/* ---------- price + buy button ---------- */
[data-view="_shared_product"] #buy-box {
    display: flex;
    align-items: center;
    float: none;
    clear: both;
    width: 100%;
    max-width: 400px;
    height: auto;
    min-height: 60px;
    margin: 16px 0 0;
    padding: 0;
    -webkit-box-sizing: border-box !important;
    box-sizing: border-box !important;
    border: 1px solid #e1e1e1;
    border-radius: 6px;
    background: #f8f8f8;
    overflow: hidden;
}

[data-view="_shared_product"] #buy-box #price {
    flex: 1 1 auto;
    float: none;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: auto;
    min-width: 0;
    height: auto;
    margin: 0;
    padding: 6px 12px;
    border: 0;
    font-size: 13px;
    line-height: 1.3;
}

[data-view="_shared_product"] #buy-box #old-price {
    width: auto;
    white-space: normal;
    font-size: 13px;
    font-weight: 600;
}

[data-view="_shared_product"] #buy-box #actual-price {
    width: auto;
    font-size: 24px;
    line-height: 1.15;
    white-space: nowrap;
}

/* "КУПИ СЕГА" and "БЪРЗА ПОРЪЧКА" are the same size and sit at the same place in their boxes:
   164x46, 8px from the right edge. The buy button has inline width/margins/float, hence !important */
[data-view="_shared_product"] #buy-box .addtocartbutton {
    flex: 0 0 164px;
    float: none !important;
    width: 164px !important;
    height: 46px;
    margin: 6px 8px !important;
    padding: 0 4px !important;
    border-radius: 6px;
    font-size: 16px !important;
    font-weight: 600;
    line-height: 46px;
    white-space: nowrap;
}

/* ---------- fast order: text on the left, button on the right ----------
   jQuery .show()/.hide() (after_content.php) sets display: block on the box, so no flex here:
   the button is placed absolutely and the text keeps room for it */
[data-view="_shared_product"] .product-fast-order {
    position: relative;
    float: none;
    clear: both;
    width: 100%;
    max-width: 400px;
    height: auto;
    min-height: 60px;
    margin: 12px 0 20px;
    padding: 8px 180px 8px 12px;
    box-sizing: border-box;
    border: 1px solid #e1e1e1;
    border-radius: 6px;
    background: #f8f8f8;
}

[data-view="_shared_product"] .product-fast-order-text {
    color: #666;
    font-size: 13px;
    line-height: 1.35;
}

[data-view="_shared_product"] .product-fast-order-text b {
    display: block;
    margin-bottom: 2px;
    color: #222;
    font-size: 14px;
    font-weight: 600;
}

[data-view="_shared_product"] .product-fast-order > a.highslide {
    position: absolute;
    top: 50%;
    right: 8px;
    width: 164px;
    height: 46px;
    margin-top: -23px;
    padding: 0 4px;
    box-sizing: border-box;
    border-radius: 6px;
    background: #f7b500;
    color: #2b2100;
    font-size: 16px;
    font-weight: 600;
    line-height: 46px;
    text-align: center;
    text-decoration: none;
    text-transform: uppercase;
    white-space: nowrap;
}

[data-view="_shared_product"] .product-fast-order > a.highslide:hover,
[data-view="_shared_product"] .product-fast-order > a.highslide:focus {
    background: #e0a200;
    color: #2b2100;
}

/* the two <br> after it (behind the hidden form and its <script>) only made space next to the
   old floats; now they would add an empty gap */
[data-view="_shared_product"] .product-fast-order ~ br {
    display: none;
}

/* ---------- fabrics: free sample, made to measure, width in cm ---------- */
[data-view="_shared_product"] form[name="cart_quantity2"] .addtocartbutton {
    float: none;
    width: 100%;
    max-width: 100%;
    min-height: 48px;
    margin-top: 6px;
    padding: 12px 16px;
    border-radius: 6px;
    white-space: normal;
}

[data-view="_shared_product"] input[name="quantity"] {
    width: 84px;
    height: 40px;
    margin: 4px 2px;
    padding: 0 8px;
    border: 1px solid #bbb;
    border-radius: 4px;
    font-size: 16px;
}

/* ---------- phones ---------- */
@media (max-width: 767px) {
    /* Facebook draws the review posts at least 350px wide; on 320px phones that widened the page */
    .product-package .facebook_reviews .fb-post {
        max-width: 100%;
        overflow: hidden;
    }

    [data-view="_shared_product"] #buy-box,
    [data-view="_shared_product"] .product-fast-order {
        max-width: none;
    }

    /* both buttons take the same share of the width */
    [data-view="_shared_product"] #buy-box .addtocartbutton {
        flex-basis: 46%;
        width: 46% !important;
    }

    [data-view="_shared_product"] .product-fast-order {
        padding-right: calc(46% + 16px);
    }

    [data-view="_shared_product"] .product-fast-order > a.highslide {
        width: 46%;
    }

    /* the slider (owl 2.0 beta) sizes its slides by the window width, not by its box, so the gallery
       goes from edge to edge of the screen; inside the 5px page padding the slides were 10px too wide */
    [data-view="_shared_product"] .smart-phone {
        width: 100vw;
        margin-left: calc(50% - 50vw);
    }

    /* the empty owl dots have margin-top: -35px (site css); it collapsed out of the gallery and
       pulled everything under it 35px up, over the bottom of the picture. The dots are not used here */
    [data-view="_shared_product"] .mobile-thumbs-slider .owl-controls {
        display: none;
    }

    /* every slide gets the same square frame, so the slider is not as tall as the tallest picture */
    [data-view="_shared_product"] .mobile-thumbs-slider .thumb-image {
        position: relative;
        background: #fff;
    }

    [data-view="_shared_product"] .mobile-thumbs-slider .thumb-image > a {
        display: block;
        position: relative;
        height: 0;
        padding-bottom: 100%;
    }

    /* "2 / 5" on the picture; filled by the slider script, empty (hidden) for one picture */
    [data-view="_shared_product"] .mobile-thumbs {
        position: relative;
    }

    [data-view="_shared_product"] .mobile-thumbs-counter {
        position: absolute;
        right: 10px;
        bottom: 10px;
        z-index: 3;
        padding: 3px 10px;
        border-radius: 12px;
        background: rgba(0, 0, 0, 0.55);
        color: #fff;
        font-size: 13px;
        line-height: 18px;
        pointer-events: none;
    }

    [data-view="_shared_product"] .mobile-thumbs-counter:empty {
        display: none;
    }

    /* small pictures under the main one; tap = show that picture */
    /* the sale badge stood 2px out of the picture (mobile.css right: -2px) */
    [data-view="_shared_product"] .mobile-thumbs .sale-product-icon {
        top: 6px;
        right: 6px;
    }

    [data-view="_shared_product"] .mobile-thumbs-strip {
        display: flex;
        gap: 8px;
        padding: 10px 5px 4px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    [data-view="_shared_product"] .mobile-thumbs-strip::-webkit-scrollbar {
        display: none;
    }

    [data-view="_shared_product"] .mobile-thumbs-strip a {
        flex: 0 0 60px;
        width: 60px;
        height: 60px;
        border: 2px solid #e1e1e1;
        border-radius: 6px;
        background: #fff;
        overflow: hidden;
    }

    [data-view="_shared_product"] .mobile-thumbs-strip a.active {
        border-color: #a8426f;
    }

    [data-view="_shared_product"] .mobile-thumbs-strip img {
        display: block;
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    [data-view="_shared_product"] .mobile-thumbs-slider .thumb-image img.imageLink {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        object-fit: contain;
    }

    [data-view="_shared_product"] .madetomeasure {
        display: flex !important;
        flex-wrap: wrap;
        gap: 6px;
        width: 100%;
        margin-bottom: 8px;
    }

    [data-view="_shared_product"] .madetomeasure > p {
        flex: 0 0 100%;
    }

    [data-view="_shared_product"] .madetomeasure > a {
        flex: 1 1 0;
        min-width: 0;
    }

    [data-view="_shared_product"] .madetomeasure .buyCurtains,
    [data-view="_shared_product"] .madetomeasure .buyDraperies,
    [data-view="_shared_product"] .madetomeasure .buyRomanBlinds {
        float: none;
        width: auto;
        height: auto;
        aspect-ratio: 171 / 100;
        margin: 0;
        padding: 2px 5px;
        border-radius: 4px;
        background-size: cover;
        background-position: left top;
        font-size: 13px;
        line-height: 1.2;
    }

    [data-view="_shared_product"] .madetomeasure > .Clear {
        display: none;
    }
}

/* 320-360px phones: the two button texts still fit on one line */
@media (max-width: 360px) {
    [data-view="_shared_product"] #buy-box .addtocartbutton,
    [data-view="_shared_product"] .product-fast-order > a.highslide {
        font-size: 13px !important;
    }
}

/* the strip is only for the phone gallery (.smart-phone), which tablets do not show */
@media (min-width: 768px) {
    [data-view="_shared_product"] .mobile-thumbs-strip {
        display: none;
    }
}

/* phones and tablets (iPad Safari sends a Mac User-Agent by default); from 992px the desktop layout is fine */
@media (max-width: 991px) {
    /* The desktop gallery (.imageContainer: thumbnails + main picture) is sent when the browser says it is
       a desktop: Safari on iPad (Mac User-Agent by default) or on iPhone with "Request Desktop Website".
       Up to ~990px the thumbnails stood in a column above the picture; here the picture comes first,
       the thumbnails in a row under it. */
    [data-view="_shared_product"] .imageContainer {
        display: flex;
        flex-direction: column;
        position: relative;
        margin: 0;
    }

    [data-view="_shared_product"] .imageContainer .pictureContainer {
        order: 1;
        float: none;
        width: 100%;
        padding: 0;
    }

    [data-view="_shared_product"] .imageContainer .pictureContainer img {
        display: block;
        width: 100%;
        max-width: 100%;
        height: auto !important;
        max-height: 80vh;
        object-fit: contain;
    }

    [data-view="_shared_product"] .imageContainer .multizoom2 {
        order: 2;
        display: flex;
        gap: 8px;
        float: none;
        width: 100%;
        padding: 10px 0 4px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    [data-view="_shared_product"] .imageContainer .multizoom2::-webkit-scrollbar {
        display: none;
    }

    /* the items have inline margins */
    [data-view="_shared_product"] .imageContainer .multizoom2 .item {
        flex: 0 0 60px;
        width: 60px;
        height: 60px;
        margin: 0 !important;
        border: 2px solid #e1e1e1;
        border-radius: 6px;
        background: #fff;
        overflow: hidden;
    }

    [data-view="_shared_product"] .imageContainer .multizoom2 .item a,
    [data-view="_shared_product"] .imageContainer .multizoom2 .item img {
        display: block;
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    [data-view="_shared_product"] .imageContainer .sale-product-icon {
        top: 6px;
        right: 6px;
    }

    /* the hover zoom layer is placed once over the picture and can stay over the thumbnails when the layout
       moves (rotation); on touch screens hover zoom does not work anyway, so it must not catch the taps */
    .zoomContainer {
        pointer-events: none;
    }
}

/* Info sections (description, delivery, payment...): the whole row opens the text, not only the 15px line of the title.
   The padding of .info-box moves to the clickable title, so the sizes do not change. */
[data-view="_shared_product"] .info-box {
    padding: 0 5px 0 10px;
}
[data-view="_shared_product"] .info-dropdown {
    margin: 0 -5px 0 -10px;
    padding: 20px 5px 10px 10px;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.05);
    -webkit-user-select: none;
    user-select: none;
}
/* the arrow pictures came from mania.bg, which does not answer any more: the arrow is drawn with borders */
[data-view="_shared_product"] .info-dropdown .dropdown-arrow,
[data-view="_shared_product"] .info-dropdown .dropdown-arrow.active {
    width: 8px;
    height: 8px;
    margin: 1px 8px 0 0;
    background: none;
    border-right: 2px solid #171414;
    border-bottom: 2px solid #171414;
    transform: rotate(45deg);
    transition: transform .3s;
}
[data-view="_shared_product"] .info-dropdown .dropdown-arrow.active {
    margin-top: 5px;
    transform: rotate(-135deg);
}

/* "Contact us": one list of big rows (at least 56px high, the whole row is the link), icon, text, arrow */
[data-view="_shared_product"] .contact-list {
    max-width: 460px;
    margin: 4px 0 14px;
}
[data-view="_shared_product"] .contact-row {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 56px;
    padding: 8px 36px 8px 10px;
    background: #fff;
    border: 1px solid #e1e1e1;
    border-radius: 10px;
    color: #171414;
    text-decoration: none;
    transition: border-color .2s, box-shadow .2s;
}
[data-view="_shared_product"] .contact-row + .contact-row {
    margin-top: 8px;
}
[data-view="_shared_product"] .contact-row:hover,
[data-view="_shared_product"] .contact-row:focus {
    border-color: #bdbdbd;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    color: #171414;
    text-decoration: none;
}
[data-view="_shared_product"] .contact-row:active {
    background: #f8f8f8;
}
[data-view="_shared_product"] .contact-row::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 16px;
    width: 8px;
    height: 8px;
    margin-top: -5px;
    border-top: 2px solid #9e9e9e;
    border-right: 2px solid #9e9e9e;
    transform: rotate(45deg);
}
[data-view="_shared_product"] .contact-ico {
    flex: 0 0 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin-right: 12px;
    border-radius: 50%;
}
[data-view="_shared_product"] .contact-ico svg {
    width: 22px;
    height: 22px;
    fill: #fff;
}
[data-view="_shared_product"] .contact-ico img {
    width: 40px;
    height: 40px;
}
[data-view="_shared_product"] .contact-phone .contact-ico {
    background: #171414;
}
[data-view="_shared_product"] .contact-viber .contact-ico {
    background: #7360f2;
}
[data-view="_shared_product"] .contact-viber .contact-ico svg {
    width: 26px;
    height: 26px;
}
[data-view="_shared_product"] .contact-email .contact-ico {
    background: #6b7280;
}
[data-view="_shared_product"] .contact-txt {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.25;
}
[data-view="_shared_product"] .contact-txt b {
    font-size: 15px;
    font-weight: 700;
    overflow-wrap: anywhere;
}
[data-view="_shared_product"] .contact-txt small {
    margin-top: 2px;
    font-size: 12px;
    color: #6b7280;
}

/* desktop gallery thumbnails: the pictures are not square (e.g. 86x100, 100x90) and the column made them narrower
   while the height stayed, so they were squashed by up to 17%; they keep their proportions now */
[data-view="_shared_product"] .multizoom2 .item img {
    -o-object-fit: contain;
    object-fit: contain;
}
/* an open info dropdown (ОПИСАНИЕ...) shows all of its text; style.css cut it at 500px.
   gfx/pol/public.shop.js animates the opening and closing to the real height */
.dropdown-text.active {
    max-height: none;
}
