/*
 * Cole's Plumbing — Google Reviews
 * Stylesheet for [coles_reviews_full], [coles_reviews_summary], [coles_reviews_compact]
 *
 * Breakpoints:
 *   <375px         → 1 column (tiny phones), compact cards
 *   375-767px      → 2 columns, compact cards, ~80 char preview + Read More
 *   768-1023px     → 3 columns, full cards
 *   ≥1024px        → 5 columns, full cards
 *
 * Colors are CSS variables, injected from admin settings:
 *   --cr-color-heading  (default Deep Navy)
 *   --cr-color-accent   (default Steel Blue)
 *   --cr-color-text     (default Charcoal)
 *   --cr-color-card-bg  (default Light Grey)
 *   --cr-color-star     (default Google Gold)
 */

:root {
    --cr-color-heading: #001C38;
    --cr-color-accent: #104D70;
    --cr-color-text: #333333;
    --cr-color-card-bg: #F0F0F0;
    --cr-color-star: #FBBC04;
    --cr-color-star-empty: #D8D8D8;
    --cr-color-white: #FFFFFF;
    --cr-color-google-blue: #4285F4;
    --cr-color-google-blue-hover: #357AE8;
    --cr-radius: 12px;
    --cr-radius-sm: 8px;
    --cr-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ========== Container & headings ========== */
.cr-section {
    font-family: var(--cr-font);
    color: var(--cr-color-text);
    line-height: 1.5;
}

.cr-heading {
    text-align: center;
    font-size: 1.75rem;
    color: var(--cr-color-heading);
    margin: 0 0 1.5rem 0;
    font-weight: 700;
}

/* ========== Summary bar (top of reviews page) ========== */
.cr-summary-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    background: var(--cr-color-card-bg);
    border-radius: var(--cr-radius);
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
}

.cr-summary-bar-left {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.cr-summary-rating-number {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--cr-color-heading);
}

.cr-summary-text {
    color: var(--cr-color-text);
    font-size: 0.95rem;
}

.cr-google-logo {
    vertical-align: middle;
}

.cr-cta-button {
    display: inline-block;
    background: var(--cr-color-accent);
    color: var(--cr-color-white) !important;
    text-decoration: none !important;
    padding: 0.6rem 1.25rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: opacity 0.15s ease, transform 0.15s ease;
    border: none;
    cursor: pointer;
}

.cr-cta-button:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* ========== Grid ========== */
.cr-grid {
    display: grid;
    gap: 1rem;
    /* Default to 5 columns on desktop, breakpoints below override. */
    grid-template-columns: repeat(5, 1fr);
}

@media (max-width: 1023px) {
    .cr-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 767px) {
    .cr-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
}

@media (max-width: 374px) {
    .cr-grid {
        grid-template-columns: 1fr;
    }
}

/* ========== Card ========== */
.cr-card {
    background: var(--cr-color-card-bg);
    border-radius: var(--cr-radius);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.cr-card-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.cr-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
    object-fit: cover;
}

.cr-avatar-initials {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--cr-color-white);
    font-weight: 600;
    font-size: 0.85rem;
}

.cr-avatar-ai {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--cr-color-white);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.cr-card-meta {
    flex: 1;
    min-width: 0; /* allow truncation */
}

.cr-author {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--cr-color-heading);
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.cr-author-ai {
    background: linear-gradient(90deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.cr-verified {
    flex-shrink: 0;
    vertical-align: middle;
}

.cr-date {
    font-size: 0.8rem;
    color: #666;
}

.cr-rating .cr-star {
    font-size: 1rem;
    line-height: 1;
}

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

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

.cr-star-half {
    color: var(--cr-color-star);
    opacity: 0.6;
}

.cr-text {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--cr-color-text);
}

.cr-read-more,
.cr-read-on-google {
    display: inline;
    background: none;
    border: none;
    padding: 0;
    color: var(--cr-color-google-blue);
    cursor: pointer;
    font-size: inherit;
    font-family: inherit;
    text-decoration: none;
}

.cr-read-more:hover,
.cr-read-on-google:hover {
    text-decoration: underline;
    color: var(--cr-color-google-blue-hover);
}

.cr-read-on-google {
    display: block;
    margin-top: 0.4rem;
    font-size: 0.85rem;
}

/* ========== AI Summary Card ========== */
.cr-summary-card .cr-author {
    /* author treatment is overridden by .cr-author-ai */
}

.cr-summary-bullets {
    list-style: none;
    padding: 0;
    margin: 0;
}

.cr-summary-bullets li {
    position: relative;
    padding-left: 1.25rem;
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
    line-height: 1.4;
}

.cr-summary-bullets li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: #6BBF59; /* Forest, brand trust color. */
    font-weight: 700;
}

/* Hide AI summary card on mobile (its content lives in the summary bar there). */
@media (max-width: 767px) {
    .cr-summary-card {
        display: none;
    }
}

/* ========== Load More button ========== */
.cr-load-more-wrap {
    text-align: center;
    margin-top: 1.5rem;
}

.cr-load-more {
    background: var(--cr-color-card-bg);
    color: var(--cr-color-text);
    border: 1px solid #d0d0d0;
    border-radius: 999px;
    padding: 0.7rem 2rem;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s ease;
}

.cr-load-more:hover {
    background: #e5e5e5;
}

.cr-load-more[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========== Empty state ========== */
.cr-empty {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 2rem;
}

/* ========== Compact (header/footer) ========== */
.cr-compact {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-family: var(--cr-font);
    font-size: 0.9rem;
}

.cr-compact .cr-stars {
    line-height: 1;
}

.cr-compact .cr-star {
    font-size: 0.95rem;
}

.cr-compact-text {
    color: inherit;
    font-weight: 500;
}

/* ========== JS-controlled visibility for Load More pagination ========== */
.cr-grid .cr-card[data-hidden="1"] {
    display: none;
}

/* ========== Mobile summary bar fold (the summary becomes the bar on mobile) ========== */
@media (max-width: 767px) {
    .cr-summary-bar {
        flex-direction: column;
        align-items: flex-start;
        padding: 1rem;
    }

    .cr-summary-bar-left {
        width: 100%;
    }

    .cr-cta-button {
        width: 100%;
        text-align: center;
    }

    .cr-heading {
        font-size: 1.4rem;
    }

    .cr-card {
        padding: 0.75rem;
    }

    .cr-author {
        font-size: 0.85rem;
    }

    .cr-text {
        font-size: 0.85rem;
    }
}
