/**
 * Google Reviews Manager — Frontend Styles
 * Dark-themed full-width carousel with left summary panel.
 * Version: 2.0.0
 * Author: Steve Austen — The PCGP
 */

/* =============================================
   Section wrapper injected on the homepage
   ============================================= */
.grm-home-reviews-section {
    padding: 60px 0;
    background-color: #1a1a1a;
}

.grm-home-reviews-section .section-title {
    text-align: center;
    margin-bottom: 40px;
    font-size: 2.2em;
    color: #ffffff;
    font-weight: 700;
}

/* =============================================
   Main wrapper — summary + carousel side-by-side
   ============================================= */
.grm-wrapper {
    display: flex;
    align-items: center;
    gap: 40px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* =============================================
   Left-hand summary panel
   ============================================= */
.grm-summary {
    flex: 0 0 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    padding: 20px 0;
}

/* "Excellent" label */
.grm-summary-label {
    font-size: 1.6em;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.2;
}

/* Overall stars row */
.grm-summary-stars {
    display: flex;
    gap: 2px;
    justify-content: center;
}

.grm-summary-stars .grm-star {
    font-size: 26px;
}

/* "Based on X reviews" text */
.grm-summary-count {
    font-size: 0.9em;
    color: #cccccc;
    line-height: 1.4;
    margin-top: 4px;
}

.grm-summary-count strong {
    color: #ffffff;
}

/* Google logo link / span */
.grm-summary-logo {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    text-decoration: none;
}

.grm-summary-logo:hover {
    opacity: 0.85;
}

/* Google wordmark beside the G icon */
.grm-google-wordmark {
    font-size: 1.3em;
    font-weight: 600;
    color: #ffffff;
    letter-spacing: -0.02em;
}

/* =============================================
   Carousel container
   ============================================= */
.grm-carousel {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    min-width: 0; /* prevent flex overflow */
}

.grm-carousel-viewport {
    overflow: hidden;
    width: 100%;
}

.grm-carousel-track {
    display: flex;
    transition: transform 0.45s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
}

/* Each slide — 3 per view on desktop */
.grm-carousel-item {
    min-width: 33.3333%;
    padding: 0 8px;
    box-sizing: border-box;
}

/* Prev / Next buttons */
.grm-carousel-button {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.grm-carousel-button:hover,
.grm-carousel-button:focus {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    outline: none;
}

.grm-carousel-icon {
    font-size: 1.6em;
    line-height: 1;
}

/* =============================================
   Review card — dark themed
   ============================================= */
.grm-review-card {
    background: #2a2a2a;
    border: none;
    border-radius: 12px;
    padding: 24px;
    height: 100%;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.grm-review-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

/* ── Card header: initial + reviewer name + Google icon ── */
.grm-review-header {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    gap: 10px;
}

/* Coloured circular initial */
.grm-author-initial {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2em;
    color: #ffffff;
    text-transform: uppercase;
}

/* Reviewer name — sits beside the initial, fills available space */
.grm-author-name {
    flex: 1 1 auto;
    font-weight: 700;
    font-size: 1em;
    color: #ffffff;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

/* Small Google G icon on the right of the header */
.grm-card-google-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.grm-card-google-icon svg {
    width: 22px;
    height: 22px;
}

/* ── Star rating + date row (side by side) ── */
.grm-rating-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.grm-rating {
    display: flex;
    gap: 2px;
}

/* Date displayed beside the stars */
.grm-date {
    font-size: 0.8em;
    color: #999999;
    white-space: nowrap;
}

.grm-star {
    font-size: 18px;
    color: #ffc107;
    line-height: 1;
}

.grm-star.empty {
    color: #555555;
}

/* ── Review content / excerpt ── */
.grm-review-content {
    color: #cccccc;
    line-height: 1.65;
    font-size: 0.92em;
    flex: 1;
}

.grm-review-excerpt {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 5;
    line-clamp: 5;
    overflow: hidden;
}

/* "Read full review" button */
.grm-review-open {
    margin-top: 10px;
    background: transparent;
    border: 0;
    padding: 0;
    color: #4fc3f7;
    font-weight: 600;
    font-size: 0.88em;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.grm-review-open:hover,
.grm-review-open:focus {
    color: #81d4fa;
}

/* Hidden full-text container (used by JS for modal) */
.grm-review-full {
    display: none;
}

/* =============================================
   No reviews fallback
   ============================================= */
.grm-no-reviews {
    text-align: center;
    padding: 40px;
    color: #999999;
    font-size: 1em;
}

/* =============================================
   Screen reader text utility
   ============================================= */
.grm-screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* =============================================
   Modal overlay for full review
   ============================================= */
.grm-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
}

.grm-modal.is-open {
    display: block;
}

.grm-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
}

.grm-modal-dialog {
    position: relative;
    max-width: 680px;
    width: calc(100% - 30px);
    margin: 8vh auto 0;
    background: #2a2a2a;
    border-radius: 12px;
    padding: 28px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    max-height: 84vh;
    overflow: auto;
    color: #cccccc;
}

.grm-modal-title {
    margin: 0 0 14px;
    font-size: 1.5em;
    color: #ffffff;
}

.grm-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.3em;
    color: #ffffff;
    line-height: 1;
    transition: background 0.2s ease;
}

.grm-modal-close:hover,
.grm-modal-close:focus {
    background: rgba(255, 255, 255, 0.2);
    outline: none;
}

.grm-modal-content {
    color: #cccccc;
    line-height: 1.7;
}

body.grm-modal-open {
    overflow: hidden;
}

/* =============================================
   Responsive — Tablet (2 cards)
   ============================================= */
@media (max-width: 1024px) {
    .grm-carousel-item {
        min-width: 50%;
    }

    .grm-wrapper {
        gap: 24px;
    }

    .grm-summary {
        flex: 0 0 170px;
    }
}

/* =============================================
   Responsive — Mobile (stacked, 1 card)
   ============================================= */
@media (max-width: 768px) {
    .grm-home-reviews-section {
        padding: 40px 0;
    }

    .grm-home-reviews-section .section-title {
        font-size: 1.6em;
        margin-bottom: 24px;
        padding: 0 15px;
    }

    /* Stack summary above carousel on small screens */
    .grm-wrapper {
        flex-direction: column;
        gap: 24px;
        padding: 0 15px;
    }

    .grm-summary {
        flex: none;
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 6px 16px;
        padding: 0;
    }

    .grm-summary-label {
        font-size: 1.3em;
        width: 100%;
    }

    .grm-summary-stars .grm-star {
        font-size: 22px;
    }

    .grm-summary-count {
        width: 100%;
    }

    .grm-carousel-item {
        min-width: 100%;
        padding: 0 4px;
    }

    .grm-carousel {
        gap: 6px;
    }

    .grm-carousel-button {
        width: 36px;
        height: 36px;
    }

    .grm-carousel-icon {
        font-size: 1.3em;
    }

    .grm-review-card {
        padding: 20px;
    }

    .grm-modal-dialog {
        margin: 5vh auto 0;
        padding: 20px;
    }

    .grm-modal-title {
        font-size: 1.25em;
        padding-right: 50px;
    }
}
