/* ============================================================
   Google Reviews Widget — widget.css
   Light & Dark themes, all layouts
   ============================================================ */

/* ── Design tokens ─────────────────────────────────────────── */
.grw-widget {
    --grw-font:        -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --grw-radius:      12px;
    --grw-radius-sm:   8px;
    --grw-shadow:      0 2px 12px rgba(0,0,0,.08), 0 1px 3px rgba(0,0,0,.06);
    --grw-shadow-hover:0 6px 24px rgba(0,0,0,.12);
    --grw-transition:  .22s cubic-bezier(.4,0,.2,1);
    --grw-star-color:  #F9AB00;
    --grw-star-empty:  #D1D5DB;

    /* Light defaults */
    --grw-bg:          #FFFFFF;
    --grw-bg-card:     #FFFFFF;
    --grw-bg-hover:    #F8FAFC;
    --grw-border:      #E5E7EB;
    --grw-text:        #111827;
    --grw-text-muted:  #6B7280;
    --grw-text-link:   #4285F4;
    --grw-header-bg:   #FFFFFF;
    --grw-dot-bg:      #D1D5DB;
    --grw-dot-active:  #4285F4;
    --grw-btn-bg:      #F3F4F6;
    --grw-btn-text:    #374151;
    --grw-cta-bg:      #4285F4;
    --grw-cta-text:    #FFFFFF;
}

/* Dark theme */
.grw-widget.grw-theme-dark {
    --grw-bg:          #1F2937;
    --grw-bg-card:     #1F2937;
    --grw-bg-hover:    #263040;
    --grw-border:      #374151;
    --grw-text:        #F9FAFB;
    --grw-text-muted:  #9CA3AF;
    --grw-text-link:   #60A5FA;
    --grw-header-bg:   #111827;
    --grw-dot-bg:      #4B5563;
    --grw-dot-active:  #60A5FA;
    --grw-btn-bg:      #374151;
    --grw-btn-text:    #F9FAFB;
    --grw-star-empty:  #4B5563;
    --grw-cta-bg:      #3B82F6;
    --grw-cta-text:    #FFFFFF;
}

/* Auto theme (follow system preference) */
@media (prefers-color-scheme: dark) {
    .grw-widget.grw-theme-auto {
        --grw-bg:         #1F2937;
        --grw-bg-card:    #1F2937;
        --grw-bg-hover:   #263040;
        --grw-border:     #374151;
        --grw-text:       #F9FAFB;
        --grw-text-muted: #9CA3AF;
        --grw-text-link:  #60A5FA;
        --grw-header-bg:  #111827;
        --grw-dot-bg:     #4B5563;
        --grw-dot-active: #60A5FA;
        --grw-btn-bg:     #374151;
        --grw-btn-text:   #F9FAFB;
        --grw-star-empty: #4B5563;
        --grw-cta-bg:     #3B82F6;
        --grw-cta-text:   #FFFFFF;
    }
}

/* ── Base widget ────────────────────────────────────────────── */
.grw-widget {
    font-family: var(--grw-font);
    color: var(--grw-text);
    background: var(--grw-bg);
    border-radius: var(--grw-radius);
    border: 1px solid var(--grw-border);
    box-shadow: var(--grw-shadow);
    padding: 24px;
    max-width: 100%;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
}

.grw-widget *,
.grw-widget *::before,
.grw-widget *::after {
    box-sizing: border-box;
}

/* ── Header ─────────────────────────────────────────────────── */
.grw-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--grw-border);
    flex-wrap: wrap;
}

.grw-header__brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.grw-google-logo {
    flex-shrink: 0;
}

.grw-header__info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.grw-place-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--grw-text);
    line-height: 1.3;
}

.grw-platform-label {
    font-size: 12px;
    color: var(--grw-text-muted);
    text-decoration: none;
    transition: color var(--grw-transition);
}
.grw-platform-label:hover { color: var(--grw-text-link); }

.grw-header__score {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.grw-score-number {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -.5px;
    color: var(--grw-text);
    line-height: 1;
}

.grw-score-total {
    font-size: 13px;
    color: var(--grw-text-muted);
    white-space: nowrap;
}

/* ── Stars ──────────────────────────────────────────────────── */
.grw-stars {
    display: inline-flex;
    gap: 1px;
    line-height: 1;
}
.grw-star { font-size: 18px; line-height: 1; }
.grw-star--full  { color: var(--grw-star-color); }
.grw-star--half  { color: var(--grw-star-color); opacity: .6; }
.grw-star--empty { color: var(--grw-star-empty); }

/* ── Avatar ─────────────────────────────────────────────────── */
.grw-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    display: block;
}
.grw-avatar--initials {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    text-transform: uppercase;
}

/* ── Review card ────────────────────────────────────────────── */
.grw-review {
    background: var(--grw-bg-card);
    border: 1px solid var(--grw-border);
    border-radius: var(--grw-radius-sm);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: box-shadow var(--grw-transition), background var(--grw-transition);
}
.grw-review:hover {
    background: var(--grw-bg-hover);
    box-shadow: var(--grw-shadow-hover);
}

.grw-review__header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.grw-review__meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.grw-review__author {
    font-weight: 600;
    font-size: 14px;
    color: var(--grw-text);
}

.grw-review__date {
    font-size: 12px;
    color: var(--grw-text-muted);
}

.grw-review__rating .grw-star { font-size: 15px; }

.grw-review__text {
    font-size: 14px;
    line-height: 1.6;
    color: var(--grw-text);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.grw-review__link {
    font-size: 12px;
    color: var(--grw-text-link);
    text-decoration: none;
    font-weight: 500;
    align-self: flex-start;
    transition: opacity var(--grw-transition);
}
.grw-review__link:hover { opacity: .75; text-decoration: underline; }

/* ── Layout: list ───────────────────────────────────────────── */
.grw-layout-list .grw-reviews {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ── Layout: grid ───────────────────────────────────────────── */
.grw-layout-grid .grw-reviews {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}

/* ── Layout: carousel ───────────────────────────────────────── */
.grw-layout-carousel .grw-carousel {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-behavior: smooth;
    padding-bottom: 4px;
}
.grw-layout-carousel .grw-carousel::-webkit-scrollbar { display: none; }
.grw-layout-carousel .grw-review {
    min-width: 280px;
    max-width: 320px;
    flex-shrink: 0;
    scroll-snap-align: start;
}

/* Carousel nav */
.grw-carousel-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 16px;
}

.grw-nav-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--grw-border);
    background: var(--grw-btn-bg);
    color: var(--grw-btn-text);
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--grw-transition), box-shadow var(--grw-transition);
    line-height: 1;
}
.grw-nav-btn:hover {
    background: var(--grw-bg-hover);
    box-shadow: var(--grw-shadow);
}

.grw-dots { display: flex; gap: 6px; align-items: center; }
.grw-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    border: none;
    background: var(--grw-dot-bg);
    cursor: pointer;
    padding: 0;
    transition: background var(--grw-transition), transform var(--grw-transition);
}
.grw-dot.active {
    background: var(--grw-dot-active);
    transform: scale(1.35);
}

/* ── Footer ─────────────────────────────────────────────────── */
.grw-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--grw-border);
    flex-wrap: wrap;
    gap: 10px;
}

.grw-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--grw-cta-bg);
    color: var(--grw-cta-text);
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: opacity var(--grw-transition), transform var(--grw-transition);
}
.grw-cta:hover { opacity: .9; transform: translateY(-1px); }

.grw-powered {
    font-size: 11px;
    color: var(--grw-text-muted);
}

/* ── Badge layout ───────────────────────────────────────────── */
.grw-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: var(--grw-bg);
    border: 1px solid var(--grw-border);
    border-radius: 50px;
    padding: 8px 16px 8px 10px;
    box-shadow: var(--grw-shadow);
    text-decoration: none;
    color: var(--grw-text);
    transition: box-shadow var(--grw-transition), transform var(--grw-transition);
    font-family: var(--grw-font);
}
.grw-badge:hover {
    box-shadow: var(--grw-shadow-hover);
    transform: translateY(-1px);
}
.grw-badge__logo { display: flex; align-items: center; }
.grw-badge__content {
    display: flex;
    align-items: center;
    gap: 6px;
}
.grw-badge__score {
    font-size: 16px;
    font-weight: 700;
    color: var(--grw-text);
}
.grw-badge__sep {
    color: var(--grw-border);
    font-size: 14px;
}
.grw-badge__count {
    font-size: 13px;
    color: var(--grw-text-muted);
}
.grw-badge .grw-stars { gap: 0; }
.grw-badge .grw-star  { font-size: 15px; }

/* ── Error ──────────────────────────────────────────────────── */
.grw-error {
    background: #FEF2F2;
    border: 1px solid #FECACA;
    border-radius: var(--grw-radius-sm);
    color: #991B1B;
    font-size: 13px;
    padding: 12px 16px;
}
.grw-error a { color: #1D4ED8; }

.grw-empty {
    color: var(--grw-text-muted);
    font-size: 14px;
    text-align: center;
    padding: 20px 0;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media ( max-width: 600px ) {
    .grw-widget { padding: 16px; }
    .grw-header { flex-direction: column; align-items: flex-start; }
    .grw-layout-grid .grw-reviews { grid-template-columns: 1fr; }
    .grw-layout-carousel .grw-review { min-width: 240px; }
}
