/*
 * EKR Reviews - Hyva PDP presentation.
 *
 * Ported from:
 * - Ekrcover_Reviews/view/frontend/web/css/source/_module.less
 * - Smartwave/porto_child/Magento_Review/web/css/source/_extend.less
 *
 * Business/query/media logic stays in Ekrcover_Reviews. This file only owns the
 * Hyva presentation and is scoped to the PDP review component.
 */

html.ekr-review-modal-open,
html.ekr-review-modal-open body {
    overflow: hidden;
}

body.catalog-product-view .ekr-reviews {
    --ekr-review-ink: #111827;
    --ekr-review-muted: #667085;
    --ekr-review-border: #e5e7eb;
    --ekr-review-soft: #f8fafc;
    --ekr-review-summary: #efe0b6;
    --ekr-review-accent: #e6332e;
    --ekr-review-star: #f59e0b;
    --ekr-review-star-empty: rgba(17, 24, 39, .18);

    width: 100%;
    max-width: none;
    margin-top: 54px;
    color: var(--ekr-review-ink);
}

body.catalog-product-view .ekr-reviews__heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 18px;
}

body.catalog-product-view .ekr-reviews__eyebrow {
    display: block;
    margin-bottom: 6px;
    color: var(--ekr-review-accent);
    font-size: 12px;
    line-height: 1.2;
    font-weight: 800;
    letter-spacing: .1em;
}

body.catalog-product-view .ekr-reviews__heading h2 {
    margin: 0;
    color: var(--ekr-review-ink);
    font-size: clamp(24px, 2.1vw, 32px);
    line-height: 1.18;
    font-weight: 750;
    letter-spacing: -.02em;
}

body.catalog-product-view .ekr-reviews__heading-actions {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}

body.catalog-product-view .ekr-reviews__text-link {
    color: var(--ekr-review-ink);
    font-size: 13px;
    font-weight: 750;
    text-decoration: underline;
    text-underline-offset: 3px;
}

body.catalog-product-view .ekr-reviews__text-link:hover {
    color: var(--ekr-review-accent);
}

body.catalog-product-view .ekr-reviews__summary {
    display: grid;
    grid-template-columns: 170px minmax(0, 1fr) 250px;
    gap: 20px;
    align-items: center;
    padding: 20px 22px;
    border: 1px solid rgba(0, 0, 0, .06);
    border-radius: 12px;
    background: var(--ekr-review-summary);
}

body.catalog-product-view .ekr-reviews__score {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 7px;
}

body.catalog-product-view .ekr-reviews__score-number {
    font-size: 46px;
    line-height: .95;
    font-weight: 850;
    letter-spacing: -.04em;
}

body.catalog-product-view .ekr-reviews__score-sub {
    color: rgba(17, 24, 39, .72);
    font-size: 13px;
}

body.catalog-product-view .ekr-reviews__score-sub strong {
    color: var(--ekr-review-ink);
}

body.catalog-product-view .ekr-reviews__safety {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

body.catalog-product-view .ekr-reviews__safety-item {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    min-width: 0;
}

body.catalog-product-view .ekr-reviews__safety-item img {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    object-fit: contain;
}

body.catalog-product-view .ekr-reviews__safety-item strong {
    display: block;
    margin-bottom: 3px;
    color: var(--ekr-review-ink);
    font-size: 14px;
    line-height: 1.25;
    font-weight: 800;
}

body.catalog-product-view .ekr-reviews__safety-item p {
    margin: 0;
    color: rgba(17, 24, 39, .72);
    font-size: 12px;
    line-height: 1.45;
}

body.catalog-product-view .ekr-reviews__facts {
    display: grid;
    gap: 7px;
    justify-self: end;
    color: rgba(17, 24, 39, .84);
    font-size: 13px;
    line-height: 1.35;
    font-weight: 650;
}

body.catalog-product-view .ekr-reviews__facts span::before {
    content: "•";
    margin-right: 7px;
    color: var(--ekr-review-accent);
}

body.catalog-product-view .ekr-reviews__toolbar {
    margin-top: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

body.catalog-product-view .ekr-reviews__filters {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
}

body.catalog-product-view .ekr-reviews__filter {
    appearance: none;
    min-height: 38px;
    padding: 0 16px;
    border: 1px solid rgba(17, 24, 39, .16);
    border-radius: 999px;
    background: #fff;
    color: rgba(17, 24, 39, .78);
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    transition: border-color .15s ease, background-color .15s ease, color .15s ease;
}

body.catalog-product-view .ekr-reviews__filter:hover {
    border-color: rgba(17, 24, 39, .34);
}

body.catalog-product-view .ekr-reviews__filter.is-active {
    border-color: var(--ekr-review-ink);
    background: var(--ekr-review-ink);
    color: #fff;
}

body.catalog-product-view .ekr-reviews__loading {
    color: var(--ekr-review-muted);
    font-size: 12px;
}

body.catalog-product-view .ekr-reviews__error,
body.catalog-product-view .ekr-reviews__empty {
    margin-top: 14px;
    padding: 16px 18px;
    border: 1px solid var(--ekr-review-border);
    border-radius: 10px;
    background: var(--ekr-review-soft);
    color: var(--ekr-review-muted);
    font-size: 13px;
}

body.catalog-product-view .ekr-reviews__error {
    border-color: #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

body.catalog-product-view .ekr-reviews__list {
    margin-top: 14px;
    border: 1px solid rgba(17, 24, 39, .10);
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
}

body.catalog-product-view .ekr-review-card {
    margin: 0;
    padding: 20px 22px;
    border-bottom: 1px solid rgba(17, 24, 39, .09);
    background: #fff;
}

body.catalog-product-view .ekr-review-card:last-child {
    border-bottom: 0;
}

body.catalog-product-view .ekr-review-card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 10px;
}

body.catalog-product-view .ekr-review-card__identity {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

body.catalog-product-view .ekr-review-card__user {
    color: var(--ekr-review-ink);
    font-size: 14px;
    font-weight: 850;
}

body.catalog-product-view .ekr-review-card__date {
    color: var(--ekr-review-muted);
    font-size: 12px;
}

body.catalog-product-view .ekr-review-card__verified {
    display: block;
    width: auto;
    max-width: 110px;
    height: 22px;
    object-fit: contain;
}

body.catalog-product-view .ekr-review-card__product {
    appearance: none;
    flex: 0 0 auto;
    min-height: 34px;
    padding: 0 12px;
    border: 1px solid rgba(17, 24, 39, .16);
    border-radius: 8px;
    background: #fff;
    color: rgba(17, 24, 39, .86);
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}

body.catalog-product-view .ekr-review-card__product:hover {
    border-color: var(--ekr-review-ink);
    background: var(--ekr-review-ink);
    color: #fff;
}

body.catalog-product-view .ekr-review-card__title {
    margin: 7px 0 7px;
    color: var(--ekr-review-ink);
    font-size: 17px;
    line-height: 1.35;
    font-weight: 800;
}

body.catalog-product-view .ekr-review-card__content {
    max-width: 1050px;
    margin: 0;
    color: #344054;
    font-size: 14px;
    line-height: 1.65;
    white-space: pre-line;
}

body.catalog-product-view .ekr-review-stars {
    --rating-pct: 0%;
    --star-size: 17px;
    --star-gap: 2px;

    position: relative;
    display: inline-block;
    width: max-content;
    height: var(--star-size);
    line-height: var(--star-size);
    overflow: hidden;
    white-space: nowrap;
}

body.catalog-product-view .ekr-review-stars::before,
body.catalog-product-view .ekr-review-stars::after {
    content: "★★★★★";
    display: block;
    font-size: var(--star-size);
    line-height: var(--star-size);
    letter-spacing: var(--star-gap);
    white-space: nowrap;
}

body.catalog-product-view .ekr-review-stars::before {
    color: var(--ekr-review-star-empty);
}

body.catalog-product-view .ekr-review-stars::after {
    position: absolute;
    inset: 0 auto auto 0;
    width: var(--rating-pct);
    overflow: hidden;
    color: var(--ekr-review-star);
}

body.catalog-product-view .ekr-review-stars--summary {
    --star-size: 19px;
}

body.catalog-product-view .ekr-review-media {
    max-width: 830px;
    margin-top: 14px;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
}

body.catalog-product-view .ekr-review-media__item {
    appearance: none;
    position: relative;
    display: block;
    aspect-ratio: 1 / 1;
    min-width: 0;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--ekr-review-border);
    border-radius: 8px;
    background: #f3f4f6;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease;
}

body.catalog-product-view .ekr-review-media__item:hover {
    transform: translateY(-1px) scale(1.01);
    box-shadow: 0 6px 16px rgba(15, 23, 42, .14);
}

body.catalog-product-view .ekr-review-media__item img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

body.catalog-product-view .ekr-review-media__play {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 42px;
    height: 42px;
    transform: translate(-50%, -50%);
    border-radius: 999px;
    background: rgba(17, 24, 39, .82);
    box-shadow: 0 6px 16px rgba(0, 0, 0, .22);
}

body.catalog-product-view .ekr-review-media__play::after {
    content: "";
    position: absolute;
    left: 16px;
    top: 12px;
    border-top: 9px solid transparent;
    border-bottom: 9px solid transparent;
    border-left: 14px solid #fff;
}

body.catalog-product-view .ekr-reviews__more {
    margin-top: 14px;
    display: flex;
    justify-content: center;
}

body.catalog-product-view .ekr-reviews__more-button {
    appearance: none;
    min-width: 150px;
    min-height: 42px;
    padding: 0 20px;
    border: 1px solid rgba(17, 24, 39, .20);
    border-radius: 9px;
    background: #fff;
    color: rgba(17, 24, 39, .88);
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
}

body.catalog-product-view .ekr-reviews__more-button:hover:not(:disabled) {
    border-color: var(--ekr-review-ink);
    background: var(--ekr-review-ink);
    color: #fff;
}

body.catalog-product-view .ekr-reviews__more-button:disabled {
    opacity: .55;
    cursor: wait;
}

/* Review media lightbox: Alpine x-teleport keeps it outside PDP stacking contexts. */
.ekr-review-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000000;
    display: grid;
    place-items: center;
    padding: 28px;
}

.ekr-review-lightbox__backdrop {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: rgba(15, 23, 42, .82);
    cursor: default;
}

.ekr-review-lightbox__panel {
    position: relative;
    z-index: 1;
    width: min(100%, 1040px);
    min-height: 220px;
    max-height: calc(100dvh - 56px);
    padding: 18px 58px 34px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .34);
}

.ekr-review-lightbox__image,
.ekr-review-lightbox__video {
    display: block;
    max-width: 100%;
    max-height: calc(100dvh - 135px);
    border-radius: 10px;
    object-fit: contain;
}

.ekr-review-lightbox__video {
    width: 100%;
    background: #000;
}

.ekr-review-lightbox__close,
.ekr-review-lightbox__arrow {
    appearance: none;
    position: absolute;
    z-index: 2;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 999px;
    cursor: pointer;
}

.ekr-review-lightbox__close {
    top: 13px;
    right: 13px;
    width: 38px;
    height: 38px;
    background: #f3f4f6;
    color: #111827;
    font-size: 27px;
    line-height: 1;
}

.ekr-review-lightbox__arrow {
    top: 50%;
    width: 42px;
    height: 42px;
    transform: translateY(-50%);
    background: rgba(15, 23, 42, .92);
    color: #fff;
    font-size: 30px;
    line-height: 1;
}

.ekr-review-lightbox__arrow--prev {
    left: 10px;
}

.ekr-review-lightbox__arrow--next {
    right: 10px;
}

.ekr-review-lightbox__count {
    position: absolute;
    left: 50%;
    bottom: 11px;
    transform: translateX(-50%);
    color: #667085;
    font-size: 12px;
    font-weight: 700;
}

@media (max-width: 1023px) {
    body.catalog-product-view .ekr-reviews__summary {
        grid-template-columns: 150px minmax(0, 1fr);
    }

    body.catalog-product-view .ekr-reviews__facts {
        grid-column: 1 / -1;
        justify-self: stretch;
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    body.catalog-product-view .ekr-review-media {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 767px) {
    body.catalog-product-view .ekr-reviews {
        margin-top: 38px;
    }

    body.catalog-product-view .ekr-reviews__heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }

    body.catalog-product-view .ekr-reviews__heading-actions {
        gap: 14px;
    }

    body.catalog-product-view .ekr-reviews__summary {
        grid-template-columns: 1fr;
        gap: 16px;
        padding: 18px;
    }

    body.catalog-product-view .ekr-reviews__score {
        align-items: center;
        text-align: center;
    }

    body.catalog-product-view .ekr-reviews__safety {
        grid-template-columns: 1fr;
    }

    body.catalog-product-view .ekr-reviews__facts {
        grid-column: auto;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        justify-self: stretch;
    }

    body.catalog-product-view .ekr-reviews__toolbar {
        align-items: flex-start;
        flex-direction: column;
    }

    body.catalog-product-view .ekr-review-card {
        padding: 16px 15px 18px;
    }

    body.catalog-product-view .ekr-review-card__header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    body.catalog-product-view .ekr-review-card__product {
        align-self: flex-start;
    }

    body.catalog-product-view .ekr-review-media {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .ekr-review-lightbox {
        padding: 12px;
    }

    .ekr-review-lightbox__panel {
        width: 100%;
        max-height: calc(100dvh - 24px);
        padding: 48px 12px 58px;
        border-radius: 10px;
    }

    .ekr-review-lightbox__image,
    .ekr-review-lightbox__video {
        max-height: calc(100dvh - 142px);
    }

    .ekr-review-lightbox__arrow {
        top: auto;
        bottom: 12px;
        width: 34px;
        height: 34px;
        transform: none;
        font-size: 24px;
    }

    .ekr-review-lightbox__arrow--prev {
        left: calc(50% - 58px);
    }

    .ekr-review-lightbox__arrow--next {
        right: calc(50% - 58px);
    }

    .ekr-review-lightbox__count {
        bottom: 20px;
    }
}

@media (max-width: 480px) {
    body.catalog-product-view .ekr-review-media {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    body.catalog-product-view .ekr-reviews__facts {
        grid-template-columns: 1fr;
    }
}
