/* ============================================================
   All-in-one Reviews widget (native, DB-backed) — Trustindex-style
   masonry wall. Replaces the former Elfsight embed.
   Loaded alongside review.min.css (.r-header + #all-in-one-reviews).
   ============================================================ */
.reviews-widget {
    --rw-star: #f5a623;
    --rw-card-bg: #ffffff;
    --rw-card-border: #ececef;
    --rw-text: #1f2430;
    --rw-muted: #949aa5;
    --rw-radius: 16px;
    --rw-dot: rgba(28, 38, 66, 0.16);
    --rw-btn: #1f2430;
    width: 100%;
    color: var(--rw-text);
}

/* ---- Source tabs (no inline scores) ----
   On narrow viewports the 3 tabs (esp. "All reviews") don't fit the available
   width, so the strip scrolls horizontally instead of overflowing the page
   (a standard mobile tab-bar pattern) — scrollbar hidden but still touch/wheel
   scrollable, and each tab keeps `flex: 0 0 auto` so it never shrinks/wraps. */
.rw-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid #ececef;
    padding: 0.5rem 1rem 0 1rem;
    background: rgb(0,0,0,0.05);
    border-radius: 12px 12px 0 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.rw-tabs::-webkit-scrollbar { display: none; }
.rw-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 18px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    font-size: 16px;
    font-weight: 600;
    color: var(--rw-muted);
    cursor: pointer;
    transition: color .2s, border-color .2s;
    flex: 0 0 auto;
    white-space: nowrap;
}
.rw-tab:hover { color: var(--rw-text); }
.rw-tab.is-active { color: var(--rw-text); border-bottom-color: var(--rw-text); }
.rw-tab-ico svg { height: 20px; width: auto; display: block; }

/* ---- Summary header ---- */
.rw-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding: 1rem 1rem 1rem 1.5rem;
    background: rgb(0,0,0,0.05);
    border-radius: 0 0 12px 12px;
}
.rw-summary-info {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 9px;
    font-size: 17px;
}
.rw-summary-label { font-weight: 700; }
.rw-summary-stars { display: inline-flex; gap: 2px; }
.rw-summary-score { font-weight: 700; }
.rw-summary-sep { color: #d5d8dd; }
.rw-summary-count { color: var(--rw-text); }
.rw-summary-count [data-rw-count] { font-weight: 700; }

/* ---- Write a review + dropdown ---- */
.rw-write { position: relative; }
.rw-write-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--rw-btn);
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    padding: 11px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background .2s, transform .15s;
}
.rw-write-btn:hover { background: #000; transform: translateY(-1px); }
.rw-write-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    min-width: 135px;
    background: #fff;
    border: 1px solid #ececef;
    border-radius: 12px;
    box-shadow: 0 12px 34px rgba(20, 30, 55, .14);
    overflow: hidden;
    z-index: 30;
}
.rw-write-menu[hidden] { display: none; }
.rw-write-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    color: var(--rw-text);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
}
.rw-write-menu a:hover { background: #f5f6f8; }
.rw-write-menu a svg { height: 18px; width: auto; display: block; }

/* ---- Masonry wall (CSS columns) ---- */
.rw-grid {
    column-count: 3;
    column-gap: 20px;
}
@media (max-width: 900px) { .rw-grid { column-count: 2; } }
@media (max-width: 600px) { .rw-grid { column-count: 1; } }

/* ---- Review card ---- */
.rw-card {
    position: relative;
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    page-break-inside: avoid;
    background: var(--rw-card-bg);
    border: 1px solid var(--rw-card-border);
    border-radius: var(--rw-radius);
    padding: 20px;
    margin: 0 0 20px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(20, 30, 55, .04);
    transition: scale 0.2s;
}
.rw-card:hover {
    scale: 1.03;
}
.rw-card--hidden { display: none !important; }
/* Minimal dotted fill, concentrated in the top-right corner and fading out
   toward the card centre. Pure CSS (radial-gradient dots + a radial fade mask),
   so it adapts to light/dark via --rw-dot. */
.rw-card::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image: radial-gradient(var(--rw-dot) 1.2px, transparent 1.4px);
    background-size: 13px 13px;
    background-position: top right;
    -webkit-mask: radial-gradient(135% 135% at 100% 0%, #000 0%, rgba(0, 0, 0, .5) 24%, transparent 52%);
    mask: radial-gradient(135% 135% at 100% 0%, #000 0%, rgba(0, 0, 0, .5) 24%, transparent 52%);
}
.rw-card > * { position: relative; z-index: 1; }

/* Platform icon, top-right of every card */
.rw-card-source {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 2;
    display: flex;
}
.rw-card-source svg { height: 22px; width: auto; display: block; }

.rw-card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; padding-right: 30px; }
.rw-avatar {
    position: relative;
    width: 44px; height: 44px;
    flex: 0 0 44px;
    border-radius: 50%;
    background: var(--rw-avatar-bg, #7c5c52);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 18px;
    overflow: hidden;
}
.rw-avatar::before { content: attr(data-initial); }
.rw-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.rw-card-meta { display: flex; flex-direction: column; min-width: 0; }
.rw-card-author { font-weight: 700; font-size: 15px; }
.rw-card-date { font-size: 13px; color: var(--rw-muted); margin-top: 2px; }

.rw-card-rating { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.rw-card-stars { display: inline-flex; gap: 2px; }
.rw-star { width: 18px; height: 18px; flex: 0 0 auto; }
.rw-star.is-on { fill: var(--rw-star); }
.rw-star.is-off { fill: #e0e2e6; }
.rw-verified { width: 16px; height: 16px; flex: 0 0 auto; }

.rw-card-title { font-size: 15px; font-weight: 700; margin: 0 0 6px; line-height: 1.3; }
.rw-card-text { font-size: 14.5px; line-height: 1.55; color: #3a3f4b; margin: 0; }
.rw-card-text--empty { color: var(--rw-muted); font-style: italic; }
.rw-card-text[data-rw-text] {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.rw-card--expanded .rw-card-text[data-rw-text] {
    -webkit-line-clamp: unset;
    line-clamp: unset;
    overflow: visible;
}
.rw-card-readmore {
    margin-top: 8px;
    padding: 0;
    background: none;
    border: none;
    color: var(--rw-muted);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
}
.rw-card-readmore:hover { color: var(--rw-text); }

/* ---- Load more ---- */
.rw-more-wrap { display: flex; justify-content: center; margin-top: 1.25rem; }
.rw-more {
    background: #fff;
    border: 1px solid #d8dbe0;
    color: var(--rw-text);
    font-weight: 600;
    font-size: 14px;
    padding: 11px 34px;
    border-radius: 8px;
    cursor: pointer;
    transition: background .2s;
}
.rw-more:hover { background: #f5f6f8; }

/* ---- Dark mode (site toggles body.bg-black) ---- */
body.bg-black .reviews-widget {
    --rw-card-bg: #1c1c1e;
    --rw-card-border: #2b2b2f;
    --rw-text: #f2f2f4;
    --rw-muted: #8a8f99;
    --rw-dot: rgba(255, 255, 255, .12);
    --rw-btn: #f2f2f4;
    color: #f2f2f4;
}
body.bg-black .rw-tabs { border-bottom-color: #2b2b2f; }
body.bg-black .rw-summary-sep { color: #3a3a3e; }
body.bg-black .rw-write-btn { color: #14161c; }
body.bg-black .rw-write-btn:hover { background: #fff; }
body.bg-black .rw-write-menu { background: #1c1c1e; border-color: #2b2b2f; }
body.bg-black .rw-write-menu a { color: #f2f2f4; }
body.bg-black .rw-write-menu a:hover { background: #2b2b2f; }
body.bg-black .rw-card-text { color: #c9ccd2; }
body.bg-black .rw-star.is-off { fill: #3a3a3e; }
body.bg-black .rw-more { background: #1c1c1e; border-color: #2b2b2f; color: #f2f2f4; }
body.bg-black .rw-more:hover { background: #2b2b2f; }

/* ---- Small screens ---- */
@media (max-width: 560px) {
    .rw-tab { padding: 12px 12px; font-size: 15px; }
    .rw-summary-info { font-size: 16px; }
}
