/* =========================================================================
 * Popup „Google recenze" – otevírá ho tlačítko „Zobrazit všechny recenze"
 * v hlavičce widgetu (homepage + detail produktu), viz widget.tpl.
 * (Řádek hodnocení u H1 produktu odstraněn v 1.7.0.)
 *
 * Vizuální jazyk převzatý z theme jms_xtheme (ověřeno v custom.css/global.css):
 *   body text  Helvetica, Arial 16px #37474f
 *   brand      #ab0d09 (152 výskytů v custom.css – dominantní)
 *   border     #e3e3e3 / #cfcfcf
 *   radius     3px (defacto standard theme, nic nemá > 5px kromě kulatých ikon)
 *   hvězdy     #ffae00 plná / #d5d5d5 prázdná (.rating v global.css:1501)
 *   modal      overlay rgba(31,39,49,.5), panel bílý + 0 1px 16px rgba(16,39,71,.5)
 *              (vzor #layer_cart – nejčastěji viděný modal shopu)
 *   zavírací × kulatý červený badge (vzor .cms_popup)
 *   transition 0.4s (theme má `a { transition: all 0.4s }`)
 *
 * JEDEN DOM, DVĚ CSS KŮŽE: rozdíl desktop/mobil je výhradně v @media,
 * JS nemá žádnou logiku layoutu → rotace/resize funguje bez re-mountu.
 * ========================================================================= */

/* -------------------------------------------------------------------------
 * Popup – základ + DESKTOP modal
 * ---------------------------------------------------------------------- */

/* z-index musí přebít theme: .product-color-size-pick-container má na téže
   stránce 100000 (product.css:576). Root je připnutý na document.body, takže
   ho nezachytí žádný transform/filter předka. */
.grw-rmodal {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 2000000;
    display: none;
    font-family: Helvetica, Arial, sans-serif;
}

.grw-rmodal.is-open {
    display: block;
}

.grw-rmodal,
.grw-rmodal * {
    box-sizing: border-box;
}

/* Pozn.: `inset` shorthand se tu záměrně nepoužívá (Safari 14.1+).
   Bez backdrop-filter – theme nikde blur nepoužívá. */
.grw-rmodal-backdrop {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(31, 39, 49, 0.5);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.grw-rmodal.is-visible .grw-rmodal-backdrop {
    opacity: 1;
}

.grw-rmodal-wrap {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.grw-rmodal-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 560px;
    max-height: 85vh;
    background: #fff;
    border: none;
    border-radius: 3px;
    box-shadow: 0 1px 16px rgba(16, 39, 71, 0.5);
    overflow: hidden;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.grw-rmodal.is-visible .grw-rmodal-panel {
    opacity: 1;
    transform: none;
}

/* Drag handle je jen mobilní */
.grw-rmodal-handle {
    display: none;
}

/* Hlavička: vycentrovaný červený uppercase nadpis (vzor .cms_popup,
   #layer_cart i newsletter popup – všechny centrují a používají #ab0d09) */
.grw-rmodal-head {
    position: relative;
    flex-shrink: 0;
    padding: 22px 56px 16px;
    border-bottom: 1px solid #e3e3e3;
    text-align: center;
}

.grw-rmodal-head h3 {
    margin: 0;
    padding: 0;
    font-family: 'Oswald', 'Oswald Bold', sans-serif;
    font-size: 22px;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: 0.025em;
    text-transform: uppercase;
    color: #ab0d09;
}

/* Kulaté červené × – signature prvek shopu (.cms_popup .popup_close_button).
   Uvnitř panelu, protože panel má overflow: hidden. */
.grw-rmodal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    background: #ab0d09;
    border: 1px solid #ab0d09;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    transition: all 0.4s;
}

.grw-rmodal-close:hover,
.grw-rmodal-close:focus {
    background: #fff;
    color: #ab0d09;
}

.grw-rmodal-close svg {
    width: 15px;
    height: 15px;
}

.grw-rmodal-body {
    flex: 1;
    padding: 20px 26px 24px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    /* zabrání scroll-chainingu na stránku pod popupem */
    overscroll-behavior: contain;
}

/* -------------------------------------------------------------------------
 * MOBIL: stejný DOM → bottom sheet
 * Breakpoint 1024px je shodný s editorem (isMobile = innerWidth < 1024).
 * ---------------------------------------------------------------------- */
@media (max-width: 1023px) {
    .grw-rmodal-wrap {
        align-items: flex-end;
        padding: 0;
    }

    .grw-rmodal-panel {
        max-width: none;
        height: 98%;
        max-height: 98%;
        border-radius: 3px 3px 0 0;
        box-shadow: 0 -1px 16px rgba(16, 39, 71, 0.5);
        opacity: 1;
        transform: translateY(100%);
        transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    }

    .grw-rmodal.is-visible .grw-rmodal-panel {
        transform: translateY(0);
    }

    /* při swipe drží panel prst, ne transition */
    .grw-rmodal-panel.is-dragging {
        transition: none;
    }

    .grw-rmodal-handle {
        display: block;
        flex-shrink: 0;
        padding: 9px 0 3px;
        touch-action: none;
        cursor: grab;
    }

    .grw-rmodal-handle:active {
        cursor: grabbing;
    }

    .grw-rmodal-handle > i {
        display: block;
        width: 36px;
        height: 4px;
        margin: 0 auto;
        background: #cfcfcf;
        border-radius: 100px;
    }

    .grw-rmodal-head {
        padding: 8px 52px 12px;
    }

    .grw-rmodal-head h3 {
        font-size: 18px;
    }

    .grw-rmodal-close {
        top: 4px;
        right: 12px;
        width: 27px;
        height: 27px;
    }

    .grw-rmodal-close svg {
        width: 13px;
        height: 13px;
    }

    .grw-rmodal-body {
        padding: 14px 18px 24px;
        scrollbar-width: auto;
        scrollbar-color: #ab0d09 rgba(0, 0, 0, 0.08);
    }

    .grw-rmodal-body::-webkit-scrollbar {
        width: 14px;
    }

    .grw-rmodal-body::-webkit-scrollbar-track {
        background: rgba(0, 0, 0, 0.08);
        border-radius: 9999px;
    }

    .grw-rmodal-body::-webkit-scrollbar-thumb {
        background: #ab0d09;
        border-radius: 9999px;
        border: 2px solid rgba(0, 0, 0, 0.08);
    }

    .grw-rmodal-body::-webkit-scrollbar-thumb:hover {
        background: #8a0a07;
    }
}

/* -------------------------------------------------------------------------
 * Obsah popupu
 * ---------------------------------------------------------------------- */
.grw-rsummary {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 2px 0 20px;
    border-bottom: 3px solid #f1f1f1;
    margin-bottom: 4px;
}

.grw-rstars {
    display: inline-flex;
    gap: 3px;
}

.grw-rstars .grw-star {
    fill: #d5d5d5;
}

.grw-rstars .grw-star.is-filled {
    fill: #ffae00;
}

.grw-rstars--lg .grw-star {
    width: 28px;
    height: 28px;
}

.grw-rstars--sm .grw-star {
    width: 15px;
    height: 15px;
}

.grw-rsummary-meta {
    font-family: 'Oswald', 'Oswald Regular', sans-serif;
    font-size: 17px;
    font-weight: 400;
    letter-spacing: 0.025em;
    text-transform: uppercase;
    color: #37474f;
}

/* Průměr zvýrazněný brandovou červenou – stejně jako skóre v heureka
   widgetu na homepage (custom.css:1305) */
.grw-rsummary-rating {
    font-family: 'Oswald', 'Oswald Bold', sans-serif;
    font-weight: 800;
    font-size: 21px;
    color: #ab0d09;
}

.grw-rstate {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 32px 0;
    font-family: Helvetica, Arial, sans-serif;
    font-size: 15px;
    color: #acaeaf;
}

.grw-rspinner {
    width: 28px;
    height: 28px;
    border: 3px solid #e3e3e3;
    border-top-color: #ab0d09;
    border-radius: 50%;
    animation: grw-rspin 0.8s linear infinite;
}

.grw-rspinner--sm {
    width: 22px;
    height: 22px;
    border-width: 2px;
}

@keyframes grw-rspin {
    to { transform: rotate(360deg); }
}

.grw-rlist {
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    list-style: none;
}

.grw-ritem {
    margin: 0;
    padding: 18px 0;
    border-bottom: 1px solid #e3e3e3;
    list-style: none;
}

.grw-ritem:last-child {
    border-bottom: none;
}

/* pojistka proti theme, které si kreslí vlastní odrážky přes :before */
.grw-ritem:before {
    content: none;
}

.grw-rhead {
    display: flex;
    align-items: center;
    gap: 11px;
    margin-bottom: 7px;
}

.grw-ravatar {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    font-family: 'Oswald', 'Oswald Regular', sans-serif;
    font-size: 16px;
    font-weight: 400;
    color: #fff;
    text-transform: uppercase;
}

.grw-rauthor {
    font-family: 'Oswald', 'Oswald Regular', sans-serif;
    font-size: 17px;
    font-weight: 400;
    letter-spacing: 0.01em;
    color: #37474f;
}

.grw-rwhen {
    margin-left: auto;
    font-family: Helvetica, Arial, sans-serif;
    font-size: 13px;
    color: #acaeaf;
    white-space: nowrap;
}

.grw-rtext {
    margin: 7px 0 0;
    font-family: Helvetica, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    letter-spacing: 0.01em;
    color: #423f3f;
    white-space: pre-line;
}

/* Sentinel pro infinite scroll + spinner dolazování */
.grw-rsentinel {
    height: 1px;
}

.grw-rmore {
    display: flex;
    justify-content: center;
    padding: 16px 0;
}
