/*
 * SOT Google Reviews Carousel - Frontend styles
 *
 * Lightweight carousel based on CSS scroll-snap (no third-party JS/CSS libs).
 */

.sot-grc {
    /* Light theme */
    --sot-grc-bg: transparent;
    --sot-grc-panel: #ffffff;
    --sot-grc-card: #ffffff;
    --sot-grc-border: rgba(17, 24, 39, 0.12);
    --sot-grc-text: #111827;
    --sot-grc-muted: rgba(17, 24, 39, 0.65);

    /* Accent (links, dots, etc.) */
    --sot-grc-accent: #1a73e8; /* Google blue */

    /* Button background (kept Google-ish by default) */
    --sot-grc-button: #1a73e8;

    /* Effects */
    --sot-grc-shadow: 0 8px 18px rgba(0, 0, 0, 0.06);
    --sot-grc-radius: 16px;
    --sot-grc-gap: 16px;

    color: var(--sot-grc-text);
    font-family: inherit;
    line-height: 1.45;
}

.sot-grc.is-dark {
    /* Dark theme tuned to match SOT's darker hero UI */
    --sot-grc-bg: transparent;
    --sot-grc-panel: rgba(20, 20, 20, 0.98);
    --sot-grc-card: rgba(20, 20, 20, 0.98);
    --sot-grc-border: rgba(255, 255, 255, 0.14);
    --sot-grc-text: rgba(255, 255, 255, 0.92);
    --sot-grc-muted: rgba(255, 255, 255, 0.72);

    /* Use brand-gold for accents in dark mode */
    --sot-grc-accent: #c08d2d;

    /* Keep the CTA button in Google blue unless overridden */
    --sot-grc-button: #1a73e8;

    --sot-grc-shadow: 0 14px 34px rgba(0, 0, 0, 0.35);
}

.sot-grc {
    display: grid;
    gap: var(--sot-grc-gap);
    align-items: start;

    /* Keep the widget aligned with page content on mobile */
    --sot-grc-edge-pad: 0px;
    padding-inline: var(--sot-grc-edge-pad);

    width: 100%;
    max-width: 100%;
    margin-inline: auto;
    box-sizing: border-box;
}

@media (max-width: 781px) {
    .sot-grc {
        --sot-grc-edge-pad: clamp(18px, 6vw, 32px);
    }
}

@media (min-width: 782px) {
    .sot-grc {
        grid-template-columns: 260px 1fr;
    }
}


/* Prevent grid children from overflowing the container */
.sot-grc-summary,
.sot-grc-carousel {
    min-width: 0;
}

/* Summary panel */
.sot-grc-summary {
    background: var(--sot-grc-panel);
    border: 1px solid var(--sot-grc-border);
    border-radius: var(--sot-grc-radius);
    padding: 18px;
    box-shadow: var(--sot-grc-shadow);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.sot-grc-summary-top {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.sot-grc-store-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: rgba(26, 115, 232, 0.12);
    display: grid;
    place-items: center;
    color: #1a73e8;
    flex: 0 0 auto;
}

.sot-grc.is-dark .sot-grc-store-icon {
    background: rgba(192, 141, 45, 0.18);
    color: var(--sot-grc-accent);
}

.sot-grc-store-icon svg {
    fill: currentColor;
}

.sot-grc-business-name {
    font-weight: 700;
    font-size: 15px;
}

.sot-grc-business-rating {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
}

.sot-grc-rating-number {
    font-weight: 800;
    font-size: 22px;
}

.sot-grc-business-count {
    color: var(--sot-grc-muted);
    font-size: 13px;
    margin-top: 2px;
}

.sot-grc-powered {
    color: var(--sot-grc-muted);
    font-size: 12px;
    display: flex;
    gap: 6px;
    align-items: baseline;
}

.sot-grc-google-word {
    font-weight: 700;
    letter-spacing: 0.2px;
}

.sot-grc-powered-sep {
    opacity: 0.7;
}

.sot-grc-ta-word {
    font-weight: 700;
    letter-spacing: 0.2px;
    color: #00af87; /* TripAdvisor green */
}

.sot-grc.is-dark .sot-grc-ta-word {
    color: #3bd0a5;
}

.sot-grc-review-button {
    display: inline-flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
    padding: 12px 14px;
    border-radius: 999px;
    background: var(--sot-grc-button);
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    box-shadow: 0 10px 22px rgba(26, 115, 232, 0.28);
    transition: transform 120ms ease, box-shadow 120ms ease, opacity 120ms ease;
}

.sot-grc.is-dark .sot-grc-review-button {
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}

.sot-grc-review-button:hover {
    transform: translateY(-1px);
    opacity: 0.98;
}

.sot-grc-review-button:focus {
    outline: 2px solid rgba(26, 115, 232, 0.35);
    outline-offset: 2px;
}

/* Carousel wrapper (transparent like the widget style you referenced) */
.sot-grc-carousel {
    position: relative;
    padding: 0 46px; /* space for nav buttons */
}

@media (max-width: 520px) {
    .sot-grc-carousel {
        padding: 0;
    }
}

.sot-grc-viewport {
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    outline: none;
}

.sot-grc-viewport::-webkit-scrollbar {
    display: none;
}

.sot-grc-track {
    display: flex;
    gap: 16px;
    padding: 4px;
}

.sot-grc-slide {
    flex: 0 0 92%;
    scroll-snap-align: start;
    border: 1px solid var(--sot-grc-border);
    border-radius: var(--sot-grc-radius);
    padding: 14px 14px 12px;
    background: var(--sot-grc-card);
    box-shadow: var(--sot-grc-shadow);
    display: flex;
    flex-direction: column;
    gap: 10px;
    height: 240px;
    overflow: hidden;
}

@media (min-width: 640px) {
    .sot-grc-slide {
        flex-basis: calc(50% - 8px);
    }
}

@media (min-width: 1024px) {
    /* Desktop:
     * - With summary panel (two-column): show 3 review cards = 4 blocks total (summary + 3)
     * - Without summary: show 4 review cards
     */
    .sot-grc.has-summary .sot-grc-slide {
        flex-basis: calc((100% - 32px) / 3);
    }

    .sot-grc:not(.has-summary) .sot-grc-slide {
        flex-basis: calc((100% - 48px) / 4);
    }
}

.sot-grc-review-header {
    display: flex;
    gap: 10px;
    align-items: center;
}

.sot-grc-avatar {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.08);
    display: grid;
    place-items: center;
    overflow: hidden;
    flex: 0 0 auto;
    font-weight: 700;
    color: var(--sot-grc-text);
}

.sot-grc.is-dark .sot-grc-avatar {
    background: rgba(255, 255, 255, 0.12);
}

.sot-grc-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.sot-grc-meta {
    min-width: 0;
    flex: 1 1 auto;
}

.sot-grc-author {
    font-weight: 700;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sot-grc-time {
    color: var(--sot-grc-muted);
    font-size: 12px;
    margin-top: 2px;
}

.sot-grc-gmark {
    flex: 0 0 auto;
    opacity: 0.9;
}

.sot-grc-google-g {
    display: block;
}

.sot-grc-ta-icon {
    display: block;
}

.sot-grc-stars-wrap {
    display: inline-flex;
    gap: 2px;
    vertical-align: middle;
}

.sot-grc-star {
    fill: #fbbc04;
}

.sot-grc-star.is-empty {
    fill: rgba(0, 0, 0, 0.18);
}

.sot-grc.is-dark .sot-grc-star.is-empty {
    fill: rgba(255, 255, 255, 0.22);
}

.sot-grc-star.is-half {
    fill: #fbbc04;
}

.sot-grc-star-outline {
    fill: rgba(0, 0, 0, 0.18);
}

.sot-grc.is-dark .sot-grc-star-outline {
    fill: rgba(255, 255, 255, 0.22);
}

/* Review text area: fixed height + internal scroll (similar to the reference widget) */
.sot-grc-text {
    flex: 1 1 auto;
    overflow-y: auto;
    padding-right: 6px;
    scrollbar-width: thin;
}

.sot-grc-text::-webkit-scrollbar {
    width: 8px;
}

.sot-grc-text::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.18);
    border-radius: 99px;
}

.sot-grc.is-dark .sot-grc-text::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.22);
}

.sot-grc-text p {
    margin: 0;
    color: var(--sot-grc-text);
    font-size: 14px;
}

/* Prevent huge emoji images (some themes replace emoji characters with <img>) */
.sot-grc-text img,
.sot-grc-text svg {
    width: 1em !important;
    height: 1em !important;
    max-width: 1em !important;
    max-height: 1em !important;
    vertical-align: -0.125em;
}

/* Hide the "Read more" button in the scrollable layout */
.sot-grc-more {
    display: none;
}

.sot-grc-footer {
    padding-top: 10px;
    border-top: 1px solid var(--sot-grc-border);
}

.sot-grc-footer a {
    color: var(--sot-grc-muted);
    font-size: 12px;
    text-decoration: none;
    background: transparent !important;
    box-shadow: none !important;
}

.sot-grc-footer a:hover {
    text-decoration: underline;
}

/* Nav buttons */
.sot-grc-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: 999px;
    border: 1px solid var(--sot-grc-border);
    background: var(--sot-grc-panel);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.10);
    display: grid;
    place-items: center;
    cursor: pointer;
    z-index: 2;
    transition: transform 120ms ease, opacity 120ms ease;
    opacity: 0.95;
}

.sot-grc-nav svg {
    fill: var(--sot-grc-text);
}

.sot-grc-prev { left: 8px; }
.sot-grc-next { right: 8px; }

.sot-grc-nav:hover {
    transform: translateY(-50%) scale(1.02);
    opacity: 1;
}

@media (max-width: 520px) {
    .sot-grc-nav {
        display: none;
    }
}

/* Dots */
.sot-grc-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
}

.sot-grc-dot {
    width: 8px;
    height: 8px;
    border-radius: 99px;
    border: 0;
    background: rgba(0, 0, 0, 0.18);
    cursor: pointer;
    padding: 0;
}

.sot-grc.is-dark .sot-grc-dot {
    background: rgba(255, 255, 255, 0.25);
}

.sot-grc-dot.is-active {
    width: 20px;
    background: var(--sot-grc-accent);
}

/* Messages */
.sot-grc-message {
    background: var(--sot-grc-panel);
    border: 1px solid var(--sot-grc-border);
    border-radius: var(--sot-grc-radius);
    padding: 14px;
}

.sot-grc-message.is-error {
    border-color: rgba(217, 48, 37, 0.4);
}

/* -------------------------------------------------------------------------
 * Mobile polish
 * -------------------------------------------------------------------------
 * On mobile, nested vertical scrolling inside each review card can make the
 * carousel feel “stuck” (because your swipe gets captured by the text area).
 *
 * So on small screens:
 *  - let cards grow naturally
 *  - clamp long text + show “Read more”
 *  - allow the CTA button to wrap nicely
 */

@media (max-width: 520px) {
    .sot-grc-summary {
        padding: 14px;
        gap: 12px;
    }

    /* Button: allow wrapping so it never clips on narrow screens */
    .sot-grc .sot-grc-review-button {
        flex-wrap: wrap;
        white-space: normal;
        text-align: center;
        row-gap: 6px;
        line-height: 1.25;
    }

    .sot-grc .sot-grc-review-button span {
        min-width: 0;
    }

    /* Cards: natural height on mobile */
    .sot-grc-slide {
        height: auto;
    }

    /* Text: remove the internal scrollbar and use clamping */
    .sot-grc-text {
        overflow: hidden;
        padding-right: 0;
    }

    /* Clamp only when we know the review is long */
    .sot-grc-text.has-more p {
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 6;
        overflow: hidden;
    }

    .sot-grc-text.has-more.is-expanded p {
        display: block;
        -webkit-line-clamp: unset;
    }

    /* “Read more” button (hidden on desktop, enabled on mobile) */
    .sot-grc-more {
        display: none;
        margin-top: 10px;
        border: 0;
        background: transparent;
        color: var(--sot-grc-accent);
        font-weight: 700;
        padding: 0;
        cursor: pointer;
    }

    .sot-grc-text.has-more .sot-grc-more {
        display: inline-flex;
        align-items: center;
        gap: 6px;
    }
}
