/* =============================================================
   Charl Google-Style Reviews — Frontend Styles
   ============================================================= */

/* ---- Variables ---- */
:root {
    --cgr-star-full:  #FBBC05;
    --cgr-star-empty: #dadce0;
    --cgr-blue:       #4285F4;
    --cgr-green:      #34A853;
    --cgr-text:       #3c4043;
    --cgr-muted:      #70757a;
    --cgr-border:     #e8eaed;
    --cgr-bg-reply:   #f8f9fa;
    --cgr-bg-verified:#e6f4ea;
    --cgr-radius:     8px;
    --cgr-radius-sm:  4px;
}

/* ---- Wrapper ---- */
.cgr-reviews {
    max-width: 860px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--cgr-text);
    line-height: 1.6;
}

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

/* ---- Aggregate summary ---- */
.cgr-summary {
    display: flex;
    align-items: flex-start;
    gap: 40px;
    padding: 24px 0 28px;
    border-bottom: 1px solid var(--cgr-border);
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.cgr-summary__score {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 80px;
}
.cgr-summary__average {
    font-size: 48px;
    font-weight: 400;
    line-height: 1;
    color: var(--cgr-text);
}
.cgr-summary__stars-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-top: 6px;
}
.cgr-summary__count {
    font-size: 13px;
    color: var(--cgr-muted);
}
.cgr-summary__distribution {
    flex: 1;
    min-width: 200px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.cgr-summary__bar-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--cgr-muted);
}
.cgr-summary__bar-label {
    min-width: 32px;
    text-align: right;
}
.cgr-summary__bar-track {
    flex: 1;
    height: 10px;
    background: var(--cgr-border);
    border-radius: 5px;
    overflow: hidden;
}
.cgr-summary__bar-fill {
    height: 100%;
    background: var(--cgr-star-full);
    border-radius: 5px;
    transition: width 0.3s ease;
}
.cgr-summary__bar-count {
    min-width: 20px;
}

/* ---- Toolbar ---- */
.cgr-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.cgr-sort {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.cgr-sort__label {
    font-size: 13px;
    color: var(--cgr-muted);
}
.cgr-sort__option {
    font-size: 13px;
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid var(--cgr-border);
    color: var(--cgr-text);
    text-decoration: none;
    transition: all 0.15s ease;
    white-space: nowrap;
}
.cgr-sort__option:hover {
    border-color: var(--cgr-blue);
    color: var(--cgr-blue);
    text-decoration: none;
}
.cgr-sort__option--active {
    background: var(--cgr-blue);
    border-color: var(--cgr-blue);
    color: #fff !important;
}
.cgr-toolbar__google-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: var(--cgr-radius-sm);
    border: 1px solid var(--cgr-border);
    color: var(--cgr-text);
    text-decoration: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    white-space: nowrap;
}
.cgr-toolbar__google-btn:hover {
    border-color: #bbb;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
    text-decoration: none;
    color: var(--cgr-text);
}

/* ---- Review list ---- */
.cgr-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.cgr-review {
    padding: 22px 0;
    border-bottom: 1px solid var(--cgr-border);
}
.cgr-review:last-child {
    border-bottom: none;
}

/* ---- Review header ---- */
.cgr-review__header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 12px;
}
.cgr-review__avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    flex-shrink: 0;
    object-fit: cover;
}
.cgr-review__meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.cgr-review__author-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.cgr-review__author {
    font-weight: 600;
    font-size: 14px;
    color: var(--cgr-text);
}
.cgr-review__verified {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 500;
    color: var(--cgr-green);
    background: var(--cgr-bg-verified);
    padding: 2px 8px;
    border-radius: 12px;
}
.cgr-review__verified svg {
    flex-shrink: 0;
}
.cgr-review__rating-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.cgr-review__date {
    font-size: 12px;
    color: var(--cgr-muted);
}
.cgr-review__rating-row .cgr-stars {
    font-size: 16px;
}

/* ---- Review body ---- */
.cgr-review__body {
    font-size: 14px;
    color: var(--cgr-text);
    padding-left: 62px;
}
.cgr-review__body p {
    margin: 0 0 8px;
}
.cgr-review__body p:last-child {
    margin-bottom: 0;
}

/* ---- Owner reply ---- */
.cgr-review__reply {
    margin: 14px 0 0 62px;
    background: var(--cgr-bg-reply);
    border-radius: var(--cgr-radius);
    padding: 14px 16px;
}
.cgr-review__reply-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--cgr-muted);
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.cgr-review__reply-header strong {
    color: var(--cgr-text);
}
.cgr-review__reply-date {
    font-size: 12px;
}
.cgr-review__reply-text {
    font-size: 13px;
    color: var(--cgr-text);
}
.cgr-review__reply-text p {
    margin: 0;
}

/* ---- Empty state ---- */
.cgr-empty {
    padding: 40px 0;
    text-align: center;
    color: var(--cgr-muted);
    font-size: 14px;
}

/* ---- Write a review form ---- */
.cgr-write-review {
    margin-top: 40px;
    padding-top: 32px;
    border-top: 1px solid var(--cgr-border);
}
.cgr-write-review__title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--cgr-text);
}

/* ---- Thank You page CTA ---- */
.cgr-thankyou-cta {
    margin: 32px 0;
    border: 1px solid var(--cgr-border);
    border-radius: var(--cgr-radius);
    overflow: hidden;
}
.cgr-thankyou-cta__inner {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 24px;
    background: #fff;
    flex-wrap: wrap;
}
.cgr-thankyou-cta__icon {
    flex-shrink: 0;
}
.cgr-thankyou-cta__content {
    flex: 1;
    min-width: 200px;
}
.cgr-thankyou-cta__message {
    font-size: 14px;
    color: var(--cgr-text);
    margin: 0 0 12px;
}
.cgr-thankyou-cta__button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--cgr-blue);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    padding: 10px 20px;
    border-radius: var(--cgr-radius-sm);
    text-decoration: none;
    transition: background 0.15s, box-shadow 0.15s;
}
.cgr-thankyou-cta__button:hover {
    background: #3367d6;
    color: #fff;
    text-decoration: none;
    box-shadow: 0 2px 6px rgba(66,133,244,0.35);
}
.cgr-thankyou-cta__stars {
    flex-shrink: 0;
    font-size: 22px;
}

/* ---- Responsive ---- */
@media ( max-width: 600px ) {
    .cgr-summary {
        flex-direction: column;
        gap: 20px;
    }
    .cgr-review__body,
    .cgr-review__reply {
        padding-left: 0;
        margin-left: 0;
    }
    .cgr-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }
    .cgr-thankyou-cta__stars {
        display: none;
    }
}

/* ---- Review form — WooCommerce native star rating ---- */
.cgr-form .comment-form-rating {
    margin-bottom: 16px;
}
.cgr-form .comment-form-rating label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--cgr-text);
}
/* Style the WC star widget */
.cgr-form .stars span a {
    font-size: 28px;
    color: var(--cgr-star-empty);
}
.cgr-form .stars span a:hover,
.cgr-form .stars span a.active {
    color: var(--cgr-star-full);
}
/* Hide the raw select — WC JS replaces it with the star widget */
.cgr-form .comment-form-rating select {
    display: none;
}

/* ---- Hide empty stars widget that renders above the form ---- */
.cgr-write-review .woocommerce-Reviews-title,
.cgr-write-review #respond .comment-reply-title {
    display: none;
}
/* Hide cookies checkbox */
.cgr-form .comment-form-cookies-consent {
    display: none !important;
}
/* Ensure rating appears first */
.cgr-form .comment-form-rating {
    order: -1;
}
.cgr-form {
    display: flex;
    flex-direction: column;
}

/* ---- Force hide duplicate rating row and cookies checkbox ---- */
.cgr-write-review #respond .comment-form-rating:not(.cgr-rating-field) {
    display: none !important;
}
.cgr-write-review .comment-form-cookies-consent {
    display: none !important;
}
