/* ============================================================
   WP Reviews - CTQT  v1.4
   Font: Lato | #E1BA37 | #212121 | #757575
   ============================================================ */
:root {
    --wpr-primary: #E1BA37;
    --wpr-text: #212121;
    --wpr-muted: #757575;
    --wpr-border: #e5e7eb;
    --wpr-bg: #ffffff;
    --wpr-radius: 12px;
    --wpr-font: 'Lato', sans-serif;
    --wpr-nav-w: 36px;
    /* nav button width */
    --wpr-nav-gap: 8px;
    /* gap between nav and swiper */
}

/* ============================================================
   WRAPPER
   ============================================================ */
.wpr-wrapper {
    font-family: var(--wpr-font);
    color: var(--wpr-text);
}

.wpr-section-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 16px;
    font-family: var(--wpr-font);
}

/* ============================================================
   MAIN LAYOUT
   [aggregate]  [swiper với nav nhô ra ngoài]
   ─────────────────────────────────────────
   Desktop: aggregate khoảng 160px, còn lại là swiper
   Mobile:  stack vertical
   ============================================================ */

.wpr-aggregate {
    margin-bottom: 40px;
    display: flex;
    align-items: center;
    gap: 20px;
}

/* ── Aggregate (left) ── */
.wpr-aggregate {
    flex-shrink: 0;
}

.wpr-agg-score {
    display: flex;
    align-items: baseline;
    gap: 3px;
    flex-wrap: wrap;
}

.wpr-big-rating {
    font-size: 48px;
    font-weight: 900;
    color: var(--wpr-primary);
    line-height: 1;
    font-family: var(--wpr-font);
}

.wpr-out-of {
    font-size: 16px;
    font-weight: 700;
    color: var(--wpr-primary);
    align-self: flex-end;
    padding-bottom: 6px;
}

.wpr-agg-label {
    font-size: 20px;
    font-weight: 700;
    color: var(--wpr-text);
    align-self: flex-end;
    font-family: var(--wpr-font);
}

.wpr-agg-total {
    font-size: 13px;
    color: var(--wpr-muted);
    margin-top: 2px;
}

/* ── Swiper wrap (right) ── */
.wpr-swiper-wrap {
    flex: 1;
    min-width: 0;
    position: relative;
}

/* Swiper overflow hidden để clip slides */
.wpr-swiper {
    overflow: hidden;
    width: 100%;
}

.wpr-swiper .swiper-slide {
    height: auto;
}

/* Nav buttons — absolute, nhô ra ngoài padding */
.wpr-nav-prev,
.wpr-nav-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: var(--wpr-nav-w);
    height: var(--wpr-nav-w);
    border-radius: 50%;
    border: 1px solid var(--wpr-border);
    background: #fff;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .1);
    color: var(--wpr-text);
    padding: 0;
    transition: background .2s, border-color .2s, box-shadow .2s;
}

.wpr-nav-prev {
    left: -50px;
}

.wpr-nav-next {
    right: -50px;
}

.wpr-nav-prev:hover,
.wpr-nav-next:hover {
    background: #f5f5f5;
    border-color: #bbb;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
}

.wpr-nav-prev.wpr-nav-disabled,
.wpr-nav-next.wpr-nav-disabled {
    opacity: .35;
    cursor: default;
    pointer-events: none;
}

/* Card */
.wpr-card {
    background: var(--wpr-bg);
    border: 1px solid var(--wpr-border);
    border-radius: var(--wpr-radius);
    padding: 20px;
    height: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-family: var(--wpr-font);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .05);
}

.wpr-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.wpr-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    overflow: hidden;
}

.wpr-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wpr-reviewer-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.wpr-reviewer-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--wpr-text);
}

.wpr-date {
    font-size: 12px;
    color: var(--wpr-muted);
}

.wpr-card-rating {
    display: flex;
    align-items: center;
    gap: 6px;
}

.wpr-stars {
    display: inline-flex;
    align-items: baseline;
    gap: 1px;
    font-weight: 900;
    color: var(--wpr-primary);
}

.wpr-star-num {
    font-size: 17px;
}

.wpr-out-frac {
    font-size: 13px;
    color: var(--wpr-primary);
}

.wpr-star-label {
    font-size: 15px;
    font-weight: 700;
    color: var(--wpr-text);
}

.wpr-card-service {
    font-size: 13px;
    color: var(--wpr-muted);
}

.wpr-card-content {
    font-size: 14px;
    line-height: 1.65;
    color: var(--wpr-text);
    flex: 1;
}

/* Read All */
.wpr-read-all-wrap {
    text-align: center;
    margin-top: 28px;
}

.wpr-read-all-btn {
    display: inline-block;
    padding: 13px 48px;
    border: 1.5px solid var(--wpr-text);
    background: transparent;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    color: var(--wpr-text);
    font-family: var(--wpr-font);
    transition: background .2s, color .2s;
}

.wpr-read-all-btn:hover {
    background: var(--wpr-text);
    color: #fff;
}

/* Mobile: stack layout */
@media (max-width: 768px) {
    .wpr-layout {
        flex-direction: column;
        gap: 16px;
    }

    .wpr-aggregate {
        margin-bottom: 20px;
        width: 100%;
    }

    .wpr-big-rating {
        font-size: 40px;
    }

    .wpr-swiper{
        padding: 0 20px !important;
    }

    .wpr-swiper-wrap {
        padding-left: 0;
        padding-right: 0;
    }

    .wpr-nav-prev,
    .wpr-nav-next {
        display: none;
    }
}

/* ============================================================
   MODAL
   panel (flex-col, overflow:hidden, height:100%)
     ├── topbar       flex-shrink:0  ← KHÔNG bao giờ scroll
     └── scroll       flex:1, ov-y:auto
           ├── header   (rating + sub-bars)   ← scroll bình thường
           ├── filters  position:sticky top:0 ← sticky khi scroll qua
           └── body     (review items)
   ============================================================ */
.wpr-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: none;
    align-items: stretch;
    justify-content: flex-end;
}

.wpr-modal.is-open {
    display: flex;
}

.wpr-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    backdrop-filter: blur(2px);
}

.wpr-modal-panel {
    position: relative;
    z-index: 1;
    width: 560px;
    max-width: 100%;
    height: 100%;
    background: #fff;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 40px rgba(0, 0, 0, .15);
    animation: wprSlideIn .28s ease;
    overflow: hidden;
    font-family: var(--wpr-font);
}

@keyframes wprSlideIn {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(0);
    }
}

@media (max-width: 600px) {
    .wpr-modal {
        align-items: stretch;
        justify-content: stretch;
    }

    .wpr-modal-overlay {
        display: none;
    }

    .wpr-modal-panel {
        width: 100%;
        border-radius: 0;
        animation: wprSlideUp .28s ease;
    }

    @keyframes wprSlideUp {
        from {
            transform: translateY(100%);
        }

        to {
            transform: translateY(0);
        }
    }
}

/* ① TOPBAR — flex-shrink:0 */
.wpr-modal-topbar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    padding: 12px 16px 10px;
    background: #fff;
    border-bottom: 1px solid var(--wpr-border);
    transition: border-color .25s, box-shadow .25s;
}

.wpr-modal-topbar.scrolled {
    border-color: var(--wpr-border);
    box-shadow: 0 2px 6px rgba(0, 0, 0, .07);
}

.wpr-modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #f3f4f6;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--wpr-text);
    padding: 0;
}

.wpr-modal-close:hover {
    background: #e5e7eb;
}

/* ② SCROLL — flex:1, overflow-y:auto */
.wpr-modal-scroll {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
}

/* Rating header — cuộn bình thường */
.wpr-modal-header {
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--wpr-border);
    background: #fff;
}

/* Score row: 4.6/5  Very good  21,104 reviews — tất cả 1 hàng */
.wpr-modal-score-row {
    display: flex;
    align-items: baseline;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.wpr-modal-rating-num {
    font-size: 34px;
    font-weight: 900;
    color: var(--wpr-primary);
    line-height: 1;
    font-family: var(--wpr-font);
}

.wpr-modal-rating-out {
    font-size: 15px;
    color: var(--wpr-muted);
    margin-right: 2px;
}

.wpr-modal-rating-label {
    font-size: 18px;
    font-weight: 700;
    color: var(--wpr-text);
    margin-right: 6px;
    font-family: var(--wpr-font);
}

.wpr-modal-total {
    display: block;
    width: 100%;
    font-size: 13px;
    color: var(--wpr-muted);
    align-self: flex-end;
    padding-bottom: 2px;
}

/* Sub-ratings — 2 cột desktop */
.wpr-modal-sub-ratings {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 28px;
    margin-top: 12px;
}

@media (max-width: 600px) {
    .wpr-modal-header {
        padding: 16px 16px 14px;
    }

    .wpr-modal-rating-num {
        font-size: 28px;
    }

    .wpr-modal-rating-label {
        font-size: 16px;
    }

    .wpr-modal-total {
        font-size: 12px;
    }

    .wpr-modal-sub-ratings {
        grid-template-columns: 1fr;
        gap: 8px;
    }
}

.wpr-sub-rating-item {}

.wpr-sub-rating-label {
    font-size: 12px;
    color: var(--wpr-muted);
    margin-bottom: 4px;
    font-family: var(--wpr-font);
}

.wpr-sub-rating-bar-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.wpr-sub-rating-bar {
    flex: 1;
    height: 5px;
    background: #f0f0f0;
    border-radius: 99px;
    overflow: hidden;
}

.wpr-sub-rating-fill {
    height: 100%;
    background: var(--wpr-primary);
    border-radius: 99px;
    transition: width .6s ease;
}

.wpr-sub-rating-num {
    font-size: 12px;
    font-weight: 700;
    color: var(--wpr-text);
    min-width: 24px;
    font-family: var(--wpr-font);
}

/* ③ FILTER BAR — position:sticky top:0 bên trong scroll container */
.wpr-modal-filters {
    position: sticky;
    top: 0;
    z-index: 50;
    background: #fff;
    padding: 12px 20px;
    border-bottom: 1px solid var(--wpr-border);
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: box-shadow .2s;
}

.wpr-modal-filters.is-sticky {
    box-shadow: 0 3px 8px rgba(0, 0, 0, .08);
}

/* Sort */
.wpr-sort-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wpr-sort-label {
    font-size: 14px;
    color: var(--wpr-muted);
    font-family: var(--wpr-font);
}

.wpr-sort-dropdown {
    position: relative;
}

.wpr-sort-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 15px;
    font-weight: 700;
    color: var(--wpr-text);
    padding: 0;
    font-family: var(--wpr-font);
}

.wpr-sort-toggle svg {
    transition: transform .2s;
}

.wpr-sort-dropdown.is-open .wpr-sort-toggle svg {
    transform: rotate(180deg);
}

.wpr-sort-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: #fff;
    border: 1px solid var(--wpr-border);
    border-radius: 10px;
    min-width: 260px;
    z-index: 200;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
    list-style: none;
    margin: 0;
    padding: 6px 0;
}

.wpr-sort-dropdown.is-open .wpr-sort-menu {
    display: block;
}

.wpr-sort-option {
    padding: 12px 20px;
    font-size: 15px;
    cursor: pointer;
    color: var(--wpr-text);
    transition: background .15s;
    font-family: var(--wpr-font);
}

.wpr-sort-option:hover {
    background: #fafafa;
}

.wpr-sort-option.active {
    font-weight: 700;
    color: var(--wpr-primary);
}

/* Pills */
.wpr-filter-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.wpr-pill {
    padding: 6px 16px;
    border: 1.5px solid var(--wpr-border);
    border-radius: 999px;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    color: var(--wpr-text);
    transition: border-color .2s, background .2s, color .2s;
    white-space: nowrap;
    font-family: var(--wpr-font);
}

.wpr-pill:hover {
    border-color: #aaa;
}

.wpr-pill.active {
    background: var(--wpr-primary);
    border-color: var(--wpr-primary);
    color: #fff;
}

/* ── Review items ── */
.wpr-modal-body {
    padding: 0 20px 24px;
}

.wpr-modal-loading {
    text-align: center;
    padding: 48px 0;
    color: var(--wpr-muted);
    font-family: var(--wpr-font);
}

.wpr-modal-empty {
    text-align: center;
    padding: 48px 0;
    color: var(--wpr-muted);
    font-size: 15px;
    font-family: var(--wpr-font);
}

.wpr-modal-item {
    display: flex;
    gap: 12px;
    padding: 18px 0;
    border-bottom: 1px solid var(--wpr-border);
}

.wpr-modal-item:last-child {
    border-bottom: none;
}

.wpr-avatar-md {
    width: 44px;
    height: 44px;
    font-size: 18px;
    font-weight: 700;
}

.wpr-modal-item-left {
    flex-shrink: 0;
}

.wpr-modal-item-right {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-family: var(--wpr-font);
}

/* Row 1: Name | Date */
.wpr-modal-item-row1 {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.wpr-modal-item-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--wpr-text);
    line-height: 1.3;
}

.wpr-modal-item-date {
    font-size: 12px;
    color: var(--wpr-muted);
    white-space: nowrap;
    flex-shrink: 0;
    padding-top: 1px;
}

/* Row 2: 5/5 Excellent */
.wpr-modal-item-rating-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.wpr-modal-item-stars {
    display: inline-flex;
    align-items: baseline;
    gap: 1px;
    font-weight: 900;
    color: var(--wpr-primary);
}

.wpr-modal-item-stars .s-num {
    font-size: 15px;
}

.wpr-modal-item-stars .s-frac {
    font-size: 12px;
}

.wpr-modal-item-badge {
    font-size: 14px;
    font-weight: 700;
    color: var(--wpr-text);
}

.wpr-modal-item-service {
    font-size: 12px;
    color: var(--wpr-muted);
}

.wpr-modal-item-content {
    font-size: 14px;
    line-height: 1.65;
    color: var(--wpr-text);
}

.wpr-modal-item-original a {
    font-size: 13px;
    color: #2563eb;
    text-decoration: none;
}

.wpr-modal-item-original a:hover {
    text-decoration: underline;
}

.wpr-modal-item-helpful {
    margin-top: 2px;
}

.wpr-helpful-btn {
    border: 1.5px solid var(--wpr-border);
    background: #fff;
    border-radius: 999px;
    padding: 5px 14px;
    font-size: 13px;
    cursor: pointer;
    color: var(--wpr-text);
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: var(--wpr-font);
    font-weight: 400;
    transition: border-color .2s, background .2s;
}

.wpr-helpful-btn:hover {
    border-color: #aaa;
    background: #fafafa;
}

.wpr-helpful-btn.voted {
    border-color: var(--wpr-primary);
    color: var(--wpr-primary);
}

.wpr-load-more-wrap {
    text-align: center;
    padding: 20px 0;
}

.wpr-load-more-btn {
    padding: 10px 32px;
    border: 1.5px solid var(--wpr-border);
    background: #fff;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    color: var(--wpr-text);
    font-family: var(--wpr-font);
}

.wpr-load-more-btn:hover {
    border-color: #888;
}

/* Mobile item adjustments */
@media (max-width: 600px) {
    .wpr-modal-filters {
        padding: 10px 16px;
        gap: 8px;
    }

    .wpr-sort-toggle {
        font-size: 14px;
    }

    .wpr-pill {
        font-size: 12px;
        padding: 5px 13px;
    }

    .wpr-modal-body {
        padding: 0 16px 20px;
    }

    .wpr-modal-item {
        gap: 10px;
        padding: 14px 0;
    }

    .wpr-modal-item-name {
        font-size: 13px;
    }

    .wpr-modal-item-date {
        font-size: 11px;
    }

    .wpr-modal-item-content {
        font-size: 13px;
    }

    .wpr-avatar-md {
        width: 38px;
        height: 38px;
        font-size: 15px;
    }
}