/**
 * Feefo Reviews – CSS
 *
 * Lightweight (~5KB), mobile-first, CSS custom properties for theming.
 */

:root {
    --rjg-feefo-star-color: #ffd000;
    --rjg-feefo-star-empty: #d4d4d4;
    --rjg-feefo-text: #333;
    --rjg-feefo-text-muted: #666;
    --rjg-feefo-border: #e5e5e5;
    --rjg-feefo-bg: #fafafa;
    --rjg-feefo-bar-bg: #eee;
    --rjg-feefo-bar-fill: #ffd000;
    --rjg-feefo-radius: 6px;
    --rjg-feefo-font: inherit;
}

/* ── Stars ─────────────────────────────────────────────────────── */

.rjg-feefo-star-rating {
    float: none;
    display: inline-block;
    width: 4.9em;
    height: 1em;
    line-height: 1;
    letter-spacing: -0.04em;
    margin: 0;
    color: var(--rjg-feefo-star-color);
    vertical-align: middle;
}

.rjg-feefo-star-rating::before {
    color: var(--rjg-feefo-star-empty);
}

.rjg-feefo-star-rating span::before {
    color: var(--rjg-feefo-star-color);
}

.star-rating.rjg-feefo-star-rating.rjg-feefo-star-rating--small {
    font-size: 16px;
    margin-top: 0;
    margin-bottom: 0;
}

.rjg-feefo-star-rating--large {
    font-size: 18px;
}

/* ── Loop rating (product cards) ──────────────────────────────── */

.rjg-feefo-loop-rating {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 4px 0;
    font-family: var(--rjg-feefo-font);
    font-size: 13px;
    color: var(--rjg-feefo-text-muted);
}

.rjg-feefo-loop-rating .rjg-feefo-star-rating {
    font-size: 16px;
}

ul.products li.product .rjg-feefo-loop-rating .star-rating.rjg-feefo-star-rating {
    font-size: 16px;
}

/* ── Hover tooltip: star distribution (loop, PDP, shortcodes) ── */

.rjg-feefo-has-tooltip {
    position: relative;
    cursor: default;
}

.rjg-feefo-loop-rating.rjg-feefo-has-tooltip {
    cursor: default;
}

.rjg-feefo-pdp-rating.rjg-feefo-has-tooltip,
.rjg-feefo-product-badge.rjg-feefo-has-tooltip,
.rjg-feefo-service-badge.rjg-feefo-has-tooltip {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    max-width: 100%;
}

.rjg-feefo-tooltip {
    display: none !important;
    position: fixed !important;
    z-index: 999999 !important;
    background: #fff;
    border: 1px solid var(--rjg-feefo-border);
    border-radius: var(--rjg-feefo-radius);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
    padding: 14px 16px 12px;
    min-width: 248px;
    max-width: 300px;
    font-size: 13px;
    color: var(--rjg-feefo-text);
    pointer-events: none;
}

.rjg-feefo-tooltip::before,
.rjg-feefo-tooltip::after {
    content: '';
    position: absolute;
    left: var(--rjg-feefo-tooltip-arrow-left, 25%);
    transform: translateX(-50%);
    width: 0;
    height: 0;
    pointer-events: none;
}

.rjg-feefo-tooltip--below::before {
    top: -9px;
    border-right: 9px solid transparent;
    border-bottom: 9px solid var(--rjg-feefo-border);
    border-left: 9px solid transparent;
}

.rjg-feefo-tooltip--below::after {
    top: -8px;
    border-right: 8px solid transparent;
    border-bottom: 8px solid #fff;
    border-left: 8px solid transparent;
}

.rjg-feefo-tooltip--above::before {
    bottom: -9px;
    border-top: 9px solid var(--rjg-feefo-border);
    border-right: 9px solid transparent;
    border-left: 9px solid transparent;
}

.rjg-feefo-tooltip--above::after {
    bottom: -8px;
    border-top: 8px solid #fff;
    border-right: 8px solid transparent;
    border-left: 8px solid transparent;
}

.rjg-feefo-tooltip--visible {
    display: block !important;
    /* Keep none so the pointer never “enters” the panel (avoids flicker vs. carousel siblings). */
    pointer-events: none;
}

.rjg-feefo-tooltip__header {
    font-weight: 700;
    font-size: 16px;
    margin: 0 0 12px;
    color: var(--rjg-feefo-text);
    text-align: center;
}

.rjg-feefo-tooltip__lines {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.rjg-feefo-tooltip__line {
    display: grid;
    grid-template-columns: minmax(58px, auto) 1fr minmax(24px, auto);
    gap: 8px 10px;
    align-items: center;
}

.rjg-feefo-tooltip__label {
    font-size: 12px;
    color: var(--rjg-feefo-text-muted);
    white-space: nowrap;
}

.rjg-feefo-tooltip__count {
    font-size: 13px;
    font-weight: 700;
    color: var(--rjg-feefo-text);
    text-align: right;
    line-height: 1.2;
}

.rjg-feefo-tooltip__bar {
    height: 9px;
    background: var(--rjg-feefo-bar-bg);
    border-radius: 5px;
    overflow: hidden;
    min-width: 0;
}

.rjg-feefo-tooltip__fill {
    height: 100%;
    background: var(--rjg-feefo-star-color);
    border-radius: 5px;
    transition: width 0.25s ease;
}

/* ── PDP rating (near title) ─────────────────────────────────── */

.rjg-feefo-pdp-rating {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 6px 0 12px;
    font-family: var(--rjg-feefo-font);
    width: 100%;
    clear: both;
}

.rjg-feefo-pdp-rating.rjg-feefo-has-tooltip {
    display: flex;
}

.rjg-feefo-pdp-rating-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
    color: inherit;
    text-decoration: none;
    cursor: pointer;
}

.rjg-feefo-pdp-rating-link:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 3px;
    border-radius: 2px;
}

.rjg-feefo-pdp-rating-link:hover .rjg-feefo-count-link,
.rjg-feefo-pdp-rating-link:focus-visible .rjg-feefo-count-link {
    border-bottom-color: var(--rjg-feefo-text-muted);
}

.rjg-feefo-pdp-rating .rjg-feefo-star-rating {
    font-size: 16px;
}

.rjg-feefo-pdp-rating .rjg-feefo-count-link {
    color: var(--rjg-feefo-text-muted);
    font-size: 14px;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

/* ── Summary section (PDP tab) ───────────────────────────────── */

.rjg-feefo-reviews-tab {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 24px 0;
    font-family: var(--rjg-feefo-font);
}

.woocommerce-tabs .rjg-feefo-reviews-tab,
.woocommerce-Tabs-panel .rjg-feefo-reviews-tab {
    clear: both;
}

.rjg-feefo-reviews-tab *,
.rjg-feefo-reviews-tab *::before,
.rjg-feefo-reviews-tab *::after {
    box-sizing: border-box;
}

.rjg-feefo-summary {
    display: block;
    padding: 24px;
    background: var(--rjg-feefo-bg);
    border: 1px solid var(--rjg-feefo-border);
    border-radius: var(--rjg-feefo-radius);
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.rjg-feefo-summary__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 24px;
}

.rjg-feefo-summary__product-image {
    width: 60px;
    height: 60px;
    flex: 0 0 60px;
    overflow: hidden;
    border-radius: var(--rjg-feefo-radius);
    background: #fff;
}

.rjg-feefo-summary__product-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.rjg-feefo-summary__product-title {
    flex: 1 1 auto;
    margin: 0;
    font-size: 18px;
    line-height: 1.35;
    color: var(--rjg-feefo-text);
}

.rjg-feefo-summary__branding {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex: 0 0 auto;
    color: var(--rjg-feefo-text-muted);
    font-size: 11px;
    line-height: 1.2;
    text-align: right;
}

.rjg-feefo-summary__branding img {
    display: block;
    width: 100px;
    height: auto;
}

.rjg-feefo-summary__content {
    display: flex;
    align-items: center;
    gap: 36px;
}

.rjg-feefo-summary__avg {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 0 0 132px;
    text-align: center;
}

.rjg-feefo-summary__number {
    font-size: 44px;
    font-weight: 700;
    line-height: 1;
    color: var(--rjg-feefo-text);
}

.rjg-feefo-summary__avg .rjg-feefo-star-rating {
    font-size: 20px;
}

.rjg-feefo-summary__total {
    font-size: 13px;
    color: var(--rjg-feefo-text-muted);
}

/* ── Review controls ─────────────────────────────────────────── */

.rjg-feefo-review-controls {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 14px;
    margin: 0 0 16px;
    flex-wrap: wrap;
}

.rjg-feefo-review-control {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    color: var(--rjg-feefo-text-muted);
    font-size: 13px;
    line-height: 1;
    white-space: nowrap;
}

.rjg-feefo-review-control span {
    font-weight: 500;
    flex: 0 0 auto;
    white-space: nowrap;
}

.rjg-feefo-review-control select {
    display: block;
    min-width: 156px;
    height: 40px;
    margin: 0;
    padding: 0 34px 0 12px;
    border: 1px solid var(--rjg-feefo-border);
    border-radius: var(--rjg-feefo-radius);
    background-color: #fff;
    color: var(--rjg-feefo-text);
    font: inherit;
    line-height: 40px;
}

.site-content .rjg-feefo-reviews-tab .rjg-feefo-review-control select {
    margin: 0;
}

.rjg-feefo-reviews-tab--loading .rjg-feefo-reviews-list {
    opacity: 0.55;
}

.rjg-feefo-no-reviews {
    padding: 18px 20px;
    border: 1px solid var(--rjg-feefo-border);
    border-radius: var(--rjg-feefo-radius);
    background: #fff;
    color: var(--rjg-feefo-text-muted);
    text-align: center;
}

/* ── Rating breakdown bar graph ──────────────────────────────── */

.rjg-feefo-breakdown {
    flex: 1;
    min-width: 220px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    justify-content: center;
}

.rjg-feefo-breakdown__row {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: default;
}

.rjg-feefo-breakdown__label {
    width: 64px;
    text-align: left;
    font-size: 13px;
    color: var(--rjg-feefo-text-muted);
    flex-shrink: 0;
}

.rjg-feefo-breakdown__bar {
    flex: 1;
    height: 16px;
    background: var(--rjg-feefo-bar-bg);
    border-radius: 999px;
    overflow: hidden;
}

.rjg-feefo-breakdown__fill {
    height: 100%;
    background: var(--rjg-feefo-bar-fill);
    border-radius: 999px;
    transition: width 0.3s ease;
}

.rjg-feefo-breakdown__count {
    width: 72px;
    font-size: 12px;
    color: var(--rjg-feefo-text-muted);
    text-align: right;
    flex-shrink: 0;
}

/* ── Review cards ────────────────────────────────────────────── */

.rjg-feefo-reviews-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.rjg-feefo-review {
    padding: 18px 20px;
    background: #fff;
    border-radius: var(--rjg-feefo-radius);
    border: 1px solid var(--rjg-feefo-border);
    transition: box-shadow 0.2s ease;
}

.rjg-feefo-review:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.rjg-feefo-review__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 12px;
}

.rjg-feefo-review__title {
    margin: 0 0 8px;
    font-weight: 600;
    color: var(--rjg-feefo-text);
    font-size: 15px;
    line-height: 1.35;
}

.rjg-feefo-review__body {
    color: var(--rjg-feefo-text);
    font-size: 14px;
    line-height: 1.6;
}

.rjg-feefo-review__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    min-width: 0;
    font-size: 13px;
    color: var(--rjg-feefo-text-muted);
}

.rjg-feefo-review__author {
    font-weight: 500;
    color: var(--rjg-feefo-text);
}

.rjg-feefo-review__verified {
    flex: 0 0 auto;
}

.rjg-feefo-review__verified img {
    display: block;
    width: 59px;
    height: auto;
}

/* ── Load more button ────────────────────────────────────────── */

.rjg-feefo-load-more-wrap {
    text-align: center;
    margin: 24px 0;
}

.rjg-feefo-load-more {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 28px;
    font-size: 14px;
    font-weight: 500;
    color: var(--rjg-feefo-text);
    background: #fff;
    border: 1px solid var(--rjg-feefo-border);
    border-radius: var(--rjg-feefo-radius);
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.rjg-feefo-load-more:hover {
    border-color: #999;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.rjg-feefo-load-more:disabled {
    opacity: 0.6;
    cursor: default;
}

.rjg-feefo-load-more--loading::after {
    content: '';
    width: 14px;
    height: 14px;
    border: 2px solid var(--rjg-feefo-border);
    border-top-color: var(--rjg-feefo-text);
    border-radius: 50%;
    animation: rjg-feefo-spin 0.6s linear infinite;
}

@keyframes rjg-feefo-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ── Service badge (shortcode) ───────────────────────────────── */

.rjg-feefo-service-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--rjg-feefo-text-muted);
}

.rjg-feefo-product-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: var(--rjg-feefo-text-muted);
}

.rjg-feefo-service-badge-widget__count {
    display: inline-block;
    margin-left: 4px;
}

.rjg-feefo-service-summary .feefo-rating-stars,
.carousel-summary-wrapper .feefo-rating-stars {
    display: inline-flex;
    align-items: center;
    line-height: 1;
}

.rjg-feefo-service-summary .feefo-rating-stars .star-rating.rjg-feefo-star-rating,
.carousel-summary-wrapper .feefo-rating-stars .star-rating.rjg-feefo-star-rating {
    font-size: 20px;
}

/* ── Service reviews list (shortcode) ────────────────────────── */

.rjg-feefo-service-reviews {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ── Count display ───────────────────────────────────────────── */

.rjg-feefo-count {
    font-size: 13px;
    color: var(--rjg-feefo-text-muted);
}

/* ── Responsive ──────────────────────────────────────────────── */

@media (max-width: 600px) {
    .rjg-feefo-summary {
        padding: 16px;
    }

    .rjg-feefo-summary__header {
        align-items: flex-start;
        gap: 12px;
    }

    .rjg-feefo-summary__product-image {
        width: 48px;
        height: 48px;
        flex-basis: 48px;
    }

    .rjg-feefo-summary__product-title {
        font-size: 16px;
    }

    .rjg-feefo-summary__branding {
        width: 100%;
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        text-align: left;
    }

    .rjg-feefo-summary__branding img {
        width: 78px;
    }

    .rjg-feefo-summary__content {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }

    .rjg-feefo-review-controls {
        justify-content: flex-start;
        align-items: center;
        gap: 10px;
    }

    .rjg-feefo-review-control {
        flex: 1 1 220px;
        justify-content: flex-start;
    }

    .rjg-feefo-review-control select {
        flex: 1 1 auto;
        min-width: 0;
    }

    .rjg-feefo-summary__avg {
        flex-direction: row;
        flex-basis: auto;
        justify-content: flex-start;
        gap: 12px;
        padding: 10px 12px;
        border: 1px solid var(--rjg-feefo-border);
        border-radius: var(--rjg-feefo-radius);
    }

    .rjg-feefo-summary__number {
        font-size: 32px;
    }

    .rjg-feefo-breakdown__label {
        width: 48px;
    }

    .rjg-feefo-breakdown__bar {
        height: 12px;
    }

    .rjg-feefo-breakdown__count {
        width: 24px;
    }

    .rjg-feefo-breakdown__count span {
        display: none;
    }

    .rjg-feefo-review__header {
        align-items: flex-start;
    }

    .rjg-feefo-review__verified img {
        width: 52px;
    }

    .rjg-feefo-review {
        padding: 12px 14px;
    }
}

/* ── Accessibility: screen reader only ───────────────────────── */

.rjg-feefo-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}