/**
 * Google Reviews Display - Stili Frontend
 * Compatibile con DIVI
 */

.grd-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 20px;
    font-family: inherit;
    box-sizing: border-box;
    background: #fafafa;
    border-radius: 4px;
}

.grd-layout-slider .grd-container,
.grd-layout-carousel .grd-container {
    background: transparent;
    padding: 0;
}

.grd-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
    flex-wrap: wrap;
    gap: 20px;
}

.grd-layout-slider .grd-header,
.grd-layout-carousel .grd-header {
    margin-bottom: 40px;
    padding-bottom: 25px;
}

.grd-header-left {
    flex: 1;
    min-width: 200px;
}

.grd-header-right {
    flex-shrink: 0;
}

.grd-all-reviews-btn {
    display: inline-block;
    padding: 12px 24px;
    background: #4285f4;
    color: #fff !important;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 500;
    font-size: 14px;
    transition: background 0.3s ease;
    white-space: nowrap;
}

.grd-all-reviews-btn:hover {
    background: #3367d6;
    color: #fff !important;
    text-decoration: none;
}

.grd-business-name {
    margin: 0 0 10px 0;
    font-size: 24px;
    font-weight: 500;
    color: #333;
    text-align: left;
}

.grd-overall-rating {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.grd-rating-value {
    font-size: 24px;
    font-weight: 500;
    color: #333;
}

.grd-stars {
    display: inline-flex;
    gap: 2px;
    align-items: center;
}

.grd-overall-stars .grd-star {
    color: #ffc107;
}

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

.grd-star-empty {
    color: #e0e0e0;
}

.grd-star-half {
    opacity: 0.5;
}

.grd-total-ratings {
    font-size: 14px;
    color: #666;
    font-weight: normal;
}

/* Layout Griglia */
.grd-layout-grid .grd-reviews-wrapper {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.grd-layout-grid.grd-columns-1 .grd-reviews-wrapper {
    grid-template-columns: 1fr;
}

.grd-layout-grid.grd-columns-2 .grd-reviews-wrapper {
    grid-template-columns: repeat(2, 1fr);
}

.grd-layout-grid.grd-columns-3 .grd-reviews-wrapper {
    grid-template-columns: repeat(3, 1fr);
}

.grd-layout-grid.grd-columns-4 .grd-reviews-wrapper {
    grid-template-columns: repeat(4, 1fr);
}

.grd-layout-grid.grd-columns-5 .grd-reviews-wrapper {
    grid-template-columns: repeat(5, 1fr);
}

.grd-layout-grid.grd-columns-6 .grd-reviews-wrapper {
    grid-template-columns: repeat(6, 1fr);
}

/* Layout Lista */
.grd-layout-list .grd-reviews-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.grd-layout-list .grd-review-item {
    margin-bottom: 0;
    border-bottom: 1px solid #f0f0f0;
}

.grd-layout-list .grd-review-item:last-child {
    border-bottom: none;
}

/* Layout Slider */
.grd-layout-slider .grd-reviews-wrapper {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 20px;
    padding-bottom: 20px;
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
}

.grd-layout-slider .grd-reviews-wrapper::-webkit-scrollbar {
    height: 8px;
}

.grd-layout-slider .grd-reviews-wrapper::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.grd-layout-slider .grd-reviews-wrapper::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.grd-layout-slider .grd-reviews-wrapper::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.grd-layout-slider .grd-review-item {
    min-width: 300px;
    scroll-snap-align: start;
}

/* Item Recensione */
.grd-review-item {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 0;
    box-shadow: none;
    transition: none;
    box-sizing: border-box;
}

.grd-review-item:hover {
    box-shadow: none;
}

.grd-review-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.grd-review-avatar {
    flex-shrink: 0;
}

.grd-review-avatar img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: none;
}

.grd-review-author {
    flex: 1;
}

.grd-author-name {
    margin: 0 0 6px 0;
    font-size: 15px;
    font-weight: 500;
    color: #333;
    line-height: 1.4;
}

.grd-review-stars {
    margin-bottom: 4px;
}

.grd-review-stars .grd-star {
    font-size: 16px;
}

.grd-review-date {
    font-size: 13px;
    color: #666;
    display: block;
    margin-top: 4px;
}

.grd-review-content {
    color: #333;
    line-height: 1.6;
    font-size: 14px;
    margin-top: 8px;
}

.grd-review-content p {
    margin: 0;
}

/* Badge fonte recensione */
.grd-review-source-badge {
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    text-align: center;
    line-height: 20px;
    font-size: 12px;
    font-weight: bold;
    margin-left: 8px;
    vertical-align: middle;
}

.grd-google-badge {
    background: #4285f4;
    color: #fff;
}

.grd-facebook-badge {
    background: #1877f2;
    color: #fff;
    font-family: Arial, sans-serif;
}

/* Carousel Styles */
.grd-carousel-wrapper {
    position: relative;
    margin: 30px 0;
    padding: 0 20px;
}

.grd-carousel-container {
    overflow: hidden;
    position: relative;
    width: 100%;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
}

.grd-carousel-container:active {
    cursor: grabbing;
}

.grd-carousel-track {
    display: flex;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
    gap: 20px; /* Default, sovrascritto dallo stile inline */
}

.grd-carousel-slide {
    flex: 0 0 auto;
    flex-basis: calc((100% - (var(--grd-carousel-spacing, 20px) * 3)) / 4); /* 4 slide per default */
    padding: 0;
    box-sizing: border-box;
}

@media (max-width: 1440px) {
    .grd-carousel-slide {
        flex-basis: calc((100% - (var(--grd-carousel-spacing, 20px) * 2)) / 3); /* 3 slide */
    }
}

@media (max-width: 1024px) {
    .grd-carousel-slide {
        flex-basis: calc((100% - (var(--grd-carousel-spacing, 20px) * 1)) / 2); /* 2 slide */
    }
}

@media (max-width: 768px) {
    .grd-carousel-wrapper {
        padding: 0 20px;
    }
    
    .grd-carousel-slide {
        flex-basis: 100%; /* 1 slide */
    }
}

.grd-carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 28px;
    font-weight: 300;
    color: #333;
    z-index: 10;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    line-height: 1;
    padding: 0;
}

.grd-carousel-nav:hover {
    background: #f8f8f8;
    border-color: #4285f4;
    color: #4285f4;
    box-shadow: 0 4px 12px rgba(66, 133, 244, 0.2);
    transform: translateY(-50%) scale(1.1);
}

.grd-carousel-nav:active {
    transform: translateY(-50%) scale(0.95);
}

.grd-carousel-prev {
    left: 0;
}

.grd-carousel-next {
    right: 0;
}

@media (max-width: 768px) {
    .grd-carousel-nav {
        width: 40px;
        height: 40px;
        font-size: 24px;
    }
    
    .grd-carousel-prev {
        left: 0;
    }
    
    .grd-carousel-next {
        right: 0;
    }
}

.grd-carousel-dots {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 30px;
    padding: 0;
}

.grd-carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: none;
    background: #ddd;
    cursor: pointer;
    padding: 0;
    transition: all 0.3s ease;
}

.grd-carousel-dot:hover {
    background: #bbb;
    transform: scale(1.2);
}

.grd-carousel-dot.active {
    background: #4285f4;
    width: 24px;
    height: 8px;
    border-radius: 4px;
}

/* Carousel review items */
.grd-layout-slider .grd-review-item,
.grd-layout-carousel .grd-review-item {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    padding: 24px;
    height: 100%;
    display: flex;
    flex-direction: column;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    margin: 0;
}

.grd-layout-slider .grd-review-item:hover,
.grd-layout-carousel .grd-review-item:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    border-color: #d0d0d0;
    transform: translateY(-2px);
}

.grd-layout-slider .grd-review-header,
.grd-layout-carousel .grd-review-header {
    margin-bottom: 16px;
}

.grd-layout-slider .grd-review-content,
.grd-layout-carousel .grd-review-content {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.grd-layout-slider .grd-review-content p,
.grd-layout-carousel .grd-review-content p {
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.6;
    margin: 0;
    font-size: 14px;
    color: #555;
}

/* Messaggio Errore */
.grd-error {
    padding: 15px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 4px;
    color: #856404;
    text-align: center;
}

/* Messaggio Avviso */
.grd-warning {
    padding: 12px 15px;
    background: #e7f3ff;
    border: 1px solid #2271b1;
    border-radius: 4px;
    color: #0a4b78;
    margin-bottom: 20px;
    font-size: 14px;
    text-align: center;
}

/* Responsive Design */
@media (max-width: 768px) {
    .grd-layout-grid.grd-columns-2 .grd-reviews-wrapper,
    .grd-layout-grid.grd-columns-3 .grd-reviews-wrapper,
    .grd-layout-grid.grd-columns-4 .grd-reviews-wrapper,
    .grd-layout-grid.grd-columns-5 .grd-reviews-wrapper,
    .grd-layout-grid.grd-columns-6 .grd-reviews-wrapper {
        grid-template-columns: 1fr;
    }
    
    .grd-business-name {
        font-size: 24px;
    }
    
    .grd-rating-value {
        font-size: 28px;
    }
    
    .grd-container {
        padding: 15px;
    }
}

/* Compatibilità DIVI */
.et_pb_module .grd-container {
    padding: 0;
}

.et_pb_row .grd-container {
    width: 100%;
}

/* Smooth scroll per slider */
.grd-layout-slider .grd-reviews-wrapper {
    -webkit-overflow-scrolling: touch;
}

