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

/* ── Google Font import ─── */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&display=swap');

/* ── CSS Variables ─────────────────────────────────────── */
.rrw-wrapper {
    --rrw-font:       'DM Sans', system-ui, sans-serif;
    --rrw-star-color: #F4B400;
    --rrw-star-empty: #E0E0E0;
    --rrw-radius:     16px;
    --rrw-gap:        16px;
    --rrw-transition: 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Light theme defaults */
    --rrw-bg:           #ffffff;
    --rrw-surface:      #F8F9FC;
    --rrw-border:       rgba(0,0,0,0.07);
    --rrw-shadow:       0 4px 24px rgba(0,0,0,0.08), 0 1px 4px rgba(0,0,0,0.04);
    --rrw-shadow-hover: 0 12px 40px rgba(0,0,0,0.14), 0 2px 8px rgba(0,0,0,0.06);
    --rrw-text-primary:   #0F1117;
    --rrw-text-secondary: #6B7280;
    --rrw-text-platform:  #374151;
    --rrw-score-size:     2.4rem;

    font-family: var(--rrw-font);
    width: 100%;
    box-sizing: border-box;
}

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

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

/* ── Cards Container ───────────────────────────────────── */
.rrw-cards {
    display: flex;
    gap: var(--rrw-gap);
    flex-wrap: wrap;
}

.rrw-layout--side-by-side .rrw-cards {
    flex-direction: row;
}

.rrw-layout--stacked .rrw-cards {
    flex-direction: column;
}

/* ── Individual Card ───────────────────────────────────── */
.rrw-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
    min-width: 220px;
    padding: 20px 22px;
    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 var(--rrw-transition),
                box-shadow var(--rrw-transition);
    box-sizing: border-box;
}

/* Subtle shimmer strip on top */
.rrw-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: var(--rrw-radius) var(--rrw-radius) 0 0;
    opacity: 0.85;
}

.rrw-card--google::before {
    background: linear-gradient(90deg, #4285F4, #34A853, #FBBC05, #EA4335);
}

.rrw-card--checkatrade::before {
    background: linear-gradient(90deg, #003087, #0055B8, #0081FF);
}

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

/* ── Logo ──────────────────────────────────────────────── */
.rrw-card__logo {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.rrw-card__logo--google {
    background: #ffffff;
    box-shadow: 0 1px 6px rgba(0,0,0,0.12);
    padding: 4px;
}

.rrw-card__logo--checkatrade {
    background: transparent;
}

.rrw-card__logo svg {
    width: 100%;
    height: 100%;
    display: block;
}

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

.rrw-card__platform {
    font-size: 0.72rem;
    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: 8px;
    flex-wrap: wrap;
}

.rrw-card__score {
    font-size: var(--rrw-score-size);
    font-weight: 700;
    line-height: 1;
    color: var(--rrw-text-primary);
    letter-spacing: -0.02em;
}

.rrw-card__score small {
    font-size: 0.7em;
    font-weight: 500;
    color: var(--rrw-text-secondary);
}

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

/* ── Stars ─────────────────────────────────────────────── */
.rrw-stars {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.rrw-star {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.rrw-star--full {
    fill: var(--rrw-star-color);
    color: var(--rrw-star-color);
}

.rrw-star--empty {
    fill: var(--rrw-star-empty);
    color: var(--rrw-star-empty);
}

.rrw-star--partial {
    color: var(--rrw-star-color);
}

.rrw-star--partial polygon {
    stroke: none;
}

/* ── Arrow indicator ───────────────────────────────────── */
.rrw-card__arrow {
    position: absolute;
    top: 14px;
    right: 14px;
    font-size: 0.9rem;
    color: var(--rrw-text-secondary);
    opacity: 0;
    transform: translate(-4px, 4px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

a.rrw-card:hover .rrw-card__arrow {
    opacity: 0.6;
    transform: translate(0, 0);
}

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 580px) {
    .rrw-layout--side-by-side .rrw-cards {
        flex-direction: column;
    }
    .rrw-card {
        min-width: 0;
    }
    .rrw-card__score {
        font-size: 2rem;
    }
}

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

.rrw-card {
    animation: rrw-fadein 0.45s ease both;
}

.rrw-card:nth-child(2) {
    animation-delay: 0.1s;
}
