/* Google Reviews Slider - Swiper.js Styles */
/* Optimized for iOS/Safari */

/* Swiper core styles scoped to our slider (no CDN CSS loaded to avoid conflicts with Elementor etc.) */
.grs-swiper {
    overflow: hidden;
    position: relative;
}

.grs-swiper .swiper-wrapper {
    display: flex;
    position: relative;
    width: 100%;
    transition-property: transform;
}

.grs-swiper .swiper-slide {
    flex-shrink: 0;
    position: relative;
}

/* Reset */
.grs-direct-wrapper,
.grs-direct-wrapper * {
    box-sizing: border-box !important;
    -webkit-tap-highlight-color: transparent;
}

/* Main container */
.grs-direct-container {
    display: flex;
    gap: 30px;
    align-items: flex-start;
    max-width: 1200px;
    margin: 0 auto;
}

/* Summary box */
.grs-direct-summary {
    flex: 0 0 250px;
    background: #ffffff;
    padding: 30px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    text-align: center;
    position: sticky;
    top: 20px;
    min-height: 260px;
}

.grs-direct-summary .grs-direct-stars {
    justify-content: center;
}

.grs-direct-summary .dashicons-star-filled {
    color: #FFC107;
}

.grs-direct-rating-large {
    font-size: 24px;
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.grs-direct-business-name {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
    font-weight: 500;
}

.grs-direct-rating-text {
    font-size: 14px;
    color: #666;
    margin: 15px 0;
}

.grs-direct-logo img {
    max-width: 110px;
    height: auto;
    display: block;
    margin: 0 auto;
}

/* Slider container - flexbox layout for [prev] [slider] [next] */
.grs-direct-slider-container {
    flex: 1;
    min-width: 0;
    overflow: visible;
    position: relative;
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Swiper container */
.grs-swiper {
    flex: 1;
    min-width: 0;
    padding-bottom: 50px;
}

.grs-swiper .swiper-wrapper {
    align-items: stretch;
}

.grs-swiper .swiper-slide {
    height: auto;
    display: flex;
}

/* Review cards */
.grs-direct-review {
    width: 100%;
    min-height: 260px;
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
}

/* Review header */
.grs-direct-header {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.grs-direct-profile-img {
    width: 45px;
    height: 45px;
    margin-right: 12px;
    flex-shrink: 0;
}

.grs-direct-profile-img img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.grs-direct-profile-details {
    flex: 1;
    min-width: 0;
}

.grs-direct-name {
    font-weight: 600;
    color: #333;
    font-size: 15px;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.grs-direct-date {
    color: #999;
    font-size: 13px;
}

/* Stars */
.grs-direct-stars {
    display: flex;
    margin-bottom: 15px;
}

.grs-direct-stars.small .dashicons-star-filled {
    color: #FFC107;
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* Content */
.grs-direct-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.grs-direct-text {
    color: #555;
    line-height: 1.5;
    font-size: 14px;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.grs-direct-text.truncated {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-height: 4.5em; /* 3 lines * 1.5 line-height */
}

.grs-direct-text.expanded {
    display: block;
    -webkit-line-clamp: unset;
    max-height: none;
    overflow: visible;
}

.grs-direct-read-more,
.grs-direct-hide {
    color: #0073aa;
    font-size: 13px;
    text-decoration: none;
    cursor: pointer;
    margin-top: 8px;
    display: inline-block;
    font-weight: 500;
}

.grs-direct-read-more:hover,
.grs-direct-hide:hover {
    color: #005a87;
    text-decoration: underline;
}

/* Navigation Buttons - Outside Swiper */
.grs-nav-button {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    background-color: #ffffff;
    border: 1px solid #d9d9d9;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 200ms ease-out;
    padding: 0;
    color: #666;
    margin-bottom: 50px; /* Offset for pagination area - aligns with review cards */
    position: relative;
    z-index: 10;
    pointer-events: auto;
    -webkit-user-select: none;
    user-select: none;
}

.grs-nav-button:hover {
    background-color: #f0f0f0 !important;
    border-color: #b8b8b8 !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12) !important;
    color: #555 !important;
}

.grs-nav-button:active {
    transform: scale(0.95);
}

.grs-nav-button svg {
    width: 24px;
    height: 24px;
}

/* Swiper Pagination */
.grs-swiper .swiper-pagination {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
}

.grs-swiper .swiper-pagination-bullet {
    width: 10px;
    height: 10px;
    display: inline-block;
    border-radius: 50%;
    background: #ccc;
    opacity: 1;
    cursor: pointer;
    margin: 0 4px;
    transition: all 0.3s ease;
}

.grs-swiper .swiper-pagination-bullet-active {
    background: #333;
    transform: scale(1.2);
}

/* Dynamic Bullets - required when dynamicBullets: true is used in Swiper */
.grs-swiper .swiper-pagination-bullets-dynamic {
    overflow: hidden;
    font-size: 0;
}

.grs-swiper .swiper-pagination-bullets-dynamic .swiper-pagination-bullet {
    transform: scale(0.33);
    position: relative;
    transition: transform 0.3s ease, left 0.3s ease;
}

.grs-swiper .swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active {
    transform: scale(1);
}

.grs-swiper .swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-main {
    transform: scale(1);
}

.grs-swiper .swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-prev {
    transform: scale(0.66);
}

.grs-swiper .swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-prev-prev {
    transform: scale(0.33);
}

.grs-swiper .swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-next {
    transform: scale(0.66);
}

.grs-swiper .swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-next-next {
    transform: scale(0.33);
}

/* MOBILE RESPONSIVE */
@media (max-width: 768px) {
    .grs-direct-container {
        flex-direction: column;
        padding: 0;
        gap: 20px;
    }

    .grs-direct-summary {
        flex: none;
        width: calc(100% - 30px);
        max-width: 500px;
        position: static;
        margin: 0 auto 25px auto;
        padding: 25px 20px;
        min-height: auto;
        border-radius: 12px;
    }

    .grs-direct-summary .grs-direct-rating-large {
        font-size: 32px;
        margin-bottom: 5px;
    }

    .grs-direct-summary .grs-direct-business-name {
        font-size: 13px;
        margin-bottom: 8px;
    }

    .grs-direct-summary .dashicons-star-filled {
        font-size: 24px;
        width: 24px;
        height: 24px;
    }

    .grs-direct-summary .grs-direct-rating-text {
        font-size: 16px;
    }

    .grs-direct-wrapper {
        padding: 20px 0;
        overflow-x: hidden;
    }

    .grs-direct-slider-container {
        padding: 0 5px;
        width: 100%;
        gap: 5px;
    }

    /* Smaller nav buttons on mobile */
    .grs-nav-button {
        width: 32px;
        height: 32px;
        min-width: 32px;
        margin-bottom: 40px; /* Match mobile pagination padding */
    }

    .grs-nav-button svg {
        width: 18px;
        height: 18px;
    }

    .grs-swiper {
        padding-bottom: 40px;
    }

    .grs-swiper .swiper-slide {
        padding: 0 2px;
    }

    .grs-direct-review {
        width: 100%;
        max-width: none; /* Remove max-width limit on mobile */
        margin: 0;
        padding: 20px 15px;
        min-height: 220px;
        border-radius: 10px;
        box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    }

    .grs-direct-text {
        font-size: 14px;
        line-height: 1.5;
        color: #333;
    }

    .grs-direct-text.truncated {
        -webkit-line-clamp: 3;
        max-height: 4.5em;
    }

    .grs-direct-profile-img {
        width: 40px;
        height: 40px;
    }

    .grs-direct-profile-img img {
        width: 40px;
        height: 40px;
    }

    /* Mobile pagination */
    .grs-swiper .swiper-pagination-bullet {
        width: 8px;
        height: 8px;
    }
}

@media (max-width: 480px) {
    .grs-direct-text.truncated {
        -webkit-line-clamp: 4;
        max-height: 6em;
    }
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
    .grs-swiper {
        -webkit-transform: translate3d(0, 0, 0);
        transform: translate3d(0, 0, 0);
    }

    .grs-direct-review {
        -webkit-transform: translate3d(0, 0, 0);
        transform: translate3d(0, 0, 0);
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }

    .grs-nav-button {
        cursor: pointer;
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
        touch-action: manipulation;
    }
}

/* Theme Compatibility */

/* Avada */
.fusion-body .grs-swiper .swiper-pagination {
    position: relative;
    bottom: auto;
    left: auto;
    transform: none;
    margin: 20px auto 0;
}

/* Elementor */
.elementor-widget-container .grs-swiper .swiper-pagination,
.elementor .grs-swiper .swiper-pagination {
    position: relative;
    bottom: auto;
    left: auto;
    transform: none;
    margin: 20px auto 0;
}

/* Divi */
.et_pb_module .grs-swiper .swiper-pagination,
#et-main-area .grs-swiper .swiper-pagination {
    position: relative;
    bottom: auto;
    left: auto;
    transform: none;
    margin: 20px auto 0;
}
