/* =========================================================
   Review Ratings Widget v3 — Front-End Styles
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,400;9..40,500;9..40,600;9..40,700&display=swap');

/* ── Variables ─────────────────────────────────────────── */
.rrw-wrapper {
    --rrw-font:           'DM Sans', system-ui, -apple-system, sans-serif;
    --rrw-star:           #F4B400;
    --rrw-star-empty:     #E0E0E0;
    --rrw-radius:         14px;
    --rrw-surface:        #F8F9FC;
    --rrw-border:         rgba(0,0,0,0.07);
    --rrw-shadow:         0 2px 16px rgba(0,0,0,0.07), 0 1px 3px rgba(0,0,0,0.04);
    --rrw-shadow-hover:   0 8px 28px rgba(0,0,0,0.13), 0 2px 6px rgba(0,0,0,0.05);
    --rrw-text-primary:   #0F1117;
    --rrw-text-secondary: #6B7280;
    --rrw-ease:           cubic-bezier(0.34, 1.56, 0.64, 1);
    font-family: var(--rrw-font);
    width: 100%;
    box-sizing: border-box;
}

/* ── Dark Theme ────────────────────────────────────────── */
.rrw-wrapper.rrw-theme--dark {
    --rrw-surface:        #1C1F2A;
    --rrw-border:         rgba(255,255,255,0.08);
    --rrw-shadow:         0 4px 24px rgba(0,0,0,0.4);
    --rrw-shadow-hover:   0 12px 40px rgba(0,0,0,0.5);
    --rrw-text-primary:   #F9FAFB;
    --rrw-text-secondary: #9CA3AF;
    --rrw-star-empty:     rgba(255,255,255,0.15);
}

/* ── Tagline ───────────────────────────────────────────── */
.rrw-tagline {
    font-family: var(--rrw-font);
    text-align: center;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--rrw-text-secondary);
    margin: 0 0 14px;
    padding: 0;
}

/* ── Cards outer ───────────────────────────────────────── */
.rrw-cards-outer { width: 100%; }

/* ── Cards container ───────────────────────────────────── */
.rrw-cards {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    list-style: none;
    margin: 0;
    padding: 0;
}

.rrw-layout--side-by-side .rrw-cards { flex-direction: row; flex-wrap: nowrap; }
.rrw-layout--stacked      .rrw-cards { flex-direction: column; }
.rrw-layout--grid-2       .rrw-cards { flex-direction: row; flex-wrap: wrap; }
.rrw-layout--grid-2       .rrw-card  { flex: 1 1 calc(50% - 6px); min-width: 0; }

/* ── Individual Card ───────────────────────────────────── */
.rrw-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 13px;
    flex: 1;
    min-width: 185px;
    padding: 14px 18px;
    background: var(--rrw-surface);
    border: 1px solid var(--rrw-border);
    border-radius: var(--rrw-radius);
    box-shadow: var(--rrw-shadow);
    text-decoration: none;
    color: inherit;
    overflow: hidden;
    transition: transform 0.22s var(--rrw-ease), box-shadow 0.22s ease;
    box-sizing: border-box;
    animation: rrw-fadein 0.4s ease both;
}
.rrw-card:nth-child(2) { animation-delay: 0.07s; }
.rrw-card:nth-child(3) { animation-delay: 0.14s; }
.rrw-card:nth-child(4) { animation-delay: 0.21s; }
.rrw-card:nth-child(5) { animation-delay: 0.28s; }

a.rrw-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--rrw-shadow-hover);
    text-decoration: none;
}

/* ── Top colour bar ────────────────────────────────────── */
.rrw-card__topbar {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    border-radius: var(--rrw-radius) var(--rrw-radius) 0 0;
    pointer-events: none;
}
.rrw-card--google      .rrw-card__topbar { background: linear-gradient(90deg,#4285F4,#34A853,#FBBC05,#EA4335); }
.rrw-card--checkatrade .rrw-card__topbar { background: linear-gradient(90deg,#003087,#0055B8,#0081FF); }
.rrw-card--trustatrader .rrw-card__topbar { background: linear-gradient(90deg,#C8121A,#E8161B,#FF4B50); }
/* custom1 / custom2 bar colours set inline */

/* ── Logo ──────────────────────────────────────────────── */
.rrw-card__logo {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-sizing: border-box;
}
/* Google gets white bg */
.rrw-card--google .rrw-card__logo {
    background: #ffffff;
    box-shadow: 0 1px 5px rgba(0,0,0,0.13);
    padding: 5px;
}
.rrw-card__logo svg,
.rrw-card__logo img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

/* ── Body ──────────────────────────────────────────────── */
.rrw-card__body {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
    min-width: 0;
}

.rrw-card__platform {
    font-size: 0.67rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--rrw-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rrw-card__rating-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
}

.rrw-card__score {
    font-size: 1.85rem;
    font-weight: 700;
    line-height: 1;
    color: var(--rrw-text-primary);
    letter-spacing: -0.02em;
    white-space: nowrap;
}
.rrw-card__score small {
    font-size: 0.6em;
    font-weight: 500;
    color: var(--rrw-text-secondary);
}

.rrw-card__count {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--rrw-text-secondary);
}

/* ── Stars ─────────────────────────────────────────────── */
.rrw-stars { display: inline-flex; align-items: center; gap: 1px; flex-shrink: 0; }
.rrw-star  { width: 13px; height: 13px; flex-shrink: 0; }
.rrw-star--full    { fill: var(--rrw-star); }
.rrw-star--empty   { fill: var(--rrw-star-empty); }
.rrw-star--partial { color: var(--rrw-star); }
.rrw-star--partial polygon { stroke: none; }

/* ── Arrow ─────────────────────────────────────────────── */
.rrw-card__arrow {
    position: absolute;
    top: 11px; right: 11px;
    font-size: 0.78rem;
    color: var(--rrw-text-secondary);
    opacity: 0;
    transform: translate(-3px, 3px);
    transition: opacity 0.15s, transform 0.15s;
    pointer-events: none;
}
a.rrw-card:hover .rrw-card__arrow { opacity: 0.5; transform: translate(0,0); }

/* ── Animation ─────────────────────────────────────────── */
@keyframes rrw-fadein {
    from { opacity: 0; transform: translateY(7px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ==========================================================
   MOBILE  ≤ 600px
   ========================================================== */
@media (max-width: 600px) {

    /* Horizontal swipe */
    .rrw-mobile--scroll .rrw-cards-outer {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -webkit-mask-image: linear-gradient(to right, black 82%, transparent 100%);
        mask-image:         linear-gradient(to right, black 82%, transparent 100%);
        padding-bottom: 2px;
    }
    .rrw-mobile--scroll .rrw-cards-outer::-webkit-scrollbar { display: none; }
    .rrw-mobile--scroll .rrw-cards {
        flex-direction: row;
        flex-wrap: nowrap;
    }
    .rrw-mobile--scroll .rrw-card {
        flex: 0 0 190px;
        min-width: 190px;
    }

    /* Stacked */
    .rrw-mobile--stacked .rrw-cards {
        flex-direction: column;
        flex-wrap: nowrap;
    }
    .rrw-mobile--stacked .rrw-card {
        min-width: 0;
        width: 100%;
        flex: none;
    }

    /* 2-column grid */
    .rrw-mobile--grid-2 .rrw-cards {
        flex-direction: row;
        flex-wrap: wrap;
    }
    .rrw-mobile--grid-2 .rrw-card {
        flex: 1 1 calc(50% - 6px);
        min-width: 0;
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        padding: 11px 12px;
    }
    .rrw-mobile--grid-2 .rrw-card__score     { font-size: 1.4rem; }
    .rrw-mobile--grid-2 .rrw-card__rating-row { flex-wrap: wrap; gap: 3px; }

    /* Shared mobile tweaks */
    .rrw-card__score { font-size: 1.6rem; }
    .rrw-tagline     { font-size: 0.67rem; margin-bottom: 10px; }
    .rrw-card        { padding: 12px 14px; gap: 11px; }
    .rrw-card__logo  { width: 34px; height: 34px; }
}
