/**
 * BBX Reviews Embedder - Styles
 * Tous les sélecteurs sont scopés dans .bbx-reviews-wrapper
 * pour éviter les conflits avec d'autres plugins Swiper
 */

/* === CONTAINER === */
.bbx-reviews-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    overflow: hidden; /* Empêcher le débordement */
    box-sizing: border-box;
}

@media (min-width: 768px) {
    .bbx-reviews-container {
        padding: 0 30px;
    }
}

@media (min-width: 1024px) {
    .bbx-reviews-container {
        padding: 0 40px;
    }
}

.bbx-reviews-wrapper {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    font-family: inherit;
    box-sizing: border-box;
}

/* Empêcher tout débordement horizontal */
body .bbx-reviews-container * {
    box-sizing: border-box;
}

/* === SLIDER LAYOUT === */
.bbx-reviews-slider {
    padding: 20px 0;
    position: relative;
}

.bbx-reviews-slider .bbx-reviews-swiper {
    overflow: hidden;
    padding: 40px 50px; /* Padding horizontal pour les boutons */
    margin: 0;
    width: 100%;
}

.bbx-reviews-slider .swiper-wrapper {
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 768px) {
    .bbx-reviews-slider .bbx-reviews-swiper {
        padding: 40px 0; /* Pas de padding sur mobile */
    }
}

/* Navigation buttons - SCOPED ! */
.bbx-reviews-wrapper .swiper-button-prev,
.bbx-reviews-wrapper .swiper-button-next {
    width: 44px !important;
    height: 44px !important;
    background: #fff !important;
    border: 2px solid #ddd !important;
    border-radius: 50% !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
    color: #333 !important;
}

/* Position des boutons pour éviter le débordement */
.bbx-reviews-wrapper .swiper-button-prev {
    left: 0 !important;
}

.bbx-reviews-wrapper .swiper-button-next {
    right: 0 !important;
}

.bbx-reviews-wrapper .swiper-button-prev:after,
.bbx-reviews-wrapper .swiper-button-next:after {
    font-size: 20px !important;
    font-weight: bold !important;
}

.bbx-reviews-wrapper .swiper-button-prev:hover,
.bbx-reviews-wrapper .swiper-button-next:hover {
    background: #f5f5f5 !important;
}

.bbx-reviews-wrapper .swiper-button-disabled {
    opacity: 0.3 !important;
    cursor: not-allowed !important;
}

/* Pagination - SCOPED ! */
.bbx-reviews-wrapper .swiper-pagination {
    position: relative !important;
    margin-top: 20px !important;
}

.bbx-reviews-wrapper .swiper-pagination-bullet {
    width: 10px !important;
    height: 10px !important;
    background: #ddd !important;
    opacity: 1 !important;
}

.bbx-reviews-wrapper .swiper-pagination-bullet-active {
    background: #007bff !important;
}

/* === GRID LAYOUT === */
.bbx-reviews-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

.bbx-reviews-grid .bbx-review-card {
    height: 320px; /* Même hauteur que le slider */
}

/* === BADGE LAYOUT === */
.bbx-reviews-badge {
    display: inline-block;
}

.bbx-reviews-badge-inner {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 25px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.bbx-reviews-google-logo {
    width: 40px;
    height: 40px;
}

.bbx-reviews-badge-rating {
    text-align: left;
}

.bbx-reviews-badge-rating strong {
    font-size: 24px;
    color: #333;
    display: block;
    line-height: 1;
    margin-bottom: 5px;
}

.bbx-reviews-badge-rating span {
    font-size: 12px;
    color: #666;
}

/* === REVIEW CARD === */
.bbx-review-card {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    height: 320px; /* Hauteur fixe pour toutes les cartes */
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.bbx-review-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

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

/* Avatar wrapper */
.bbx-avatar-wrapper {
    position: relative;
    width: 50px;
    height: 50px;
    flex-shrink: 0;
}

.bbx-review-avatar-wrapper {
    position: relative;
    width: 50px;
    height: 50px;
    flex-shrink: 0;
}

/* Avatar image */
.bbx-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

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

.bbx-review-avatar-placeholder {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    /* Background défini dynamiquement en inline pour varier les couleurs */
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

/* Avatar initials container */
.bbx-avatar-initials {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.5px;
    user-select: none;
    flex-shrink: 0;
}

/* Avatar color variations with gradients */
.bbx-avatar-color-1 {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.bbx-avatar-color-2 {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.bbx-avatar-color-3 {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.bbx-avatar-color-4 {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.bbx-avatar-color-5 {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

.bbx-avatar-color-6 {
    background: linear-gradient(135deg, #30cfd0 0%, #330867 100%);
}

.bbx-review-avatar-placeholder svg {
    width: 30px;
    height: 30px;
    fill: white;
    opacity: 0.9;
}

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

.bbx-review-author strong {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.bbx-review-author time {
    display: block;
    font-size: 12px;
    color: #999;
    margin-top: 5px;
}

/* === STARS === */
.bbx-review-stars {
    display: flex;
    gap: 2px;
    margin: 5px 0;
}

.bbx-star {
    font-size: 16px;
    line-height: 1;
}

.bbx-star-full {
    color: #ffa500;
}

.bbx-star-half {
    background: linear-gradient(90deg, #ffa500 50%, #ddd 50%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.bbx-star-empty {
    color: #ddd;
}

/* === REVIEW BODY === */
.bbx-review-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.bbx-review-body p {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    color: #555;
    overflow: hidden;
    flex: 1;
}

/* === BOUTON "LIRE PLUS" === */
.bbx-read-more,
.bbx-review-read-more {
    background: none;
    border: none;
    color: #5e72e4;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 5px 0;
    margin-top: 8px;
    text-align: left;
    transition: color 0.2s;
}

.bbx-read-more:hover,
.bbx-review-read-more:hover {
    color: #324cdd;
    text-decoration: underline;
}

/* === MODAL === */
.bbx-review-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
}

.bbx-review-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    animation: bbxFadeIn 0.2s;
}

.bbx-review-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: bbxSlideUp 0.3s;
}

.bbx-review-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #f0f0f0;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: #666;
    transition: all 0.2s;
}

.bbx-review-modal-close:hover {
    background: #e0e0e0;
    color: #333;
}

.bbx-review-modal-body {
    margin-top: 10px;
}

.bbx-review-modal-body .bbx-review-card {
    height: auto;
    box-shadow: none;
    border: none;
    padding: 0;
}

.bbx-review-modal-body .bbx-review-body p {
    overflow: visible;
    white-space: normal;
}

@keyframes bbxFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes bbxSlideUp {
    from {
        opacity: 0;
        transform: translate(-50%, -45%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

/* === ERROR MESSAGE === */
.bbx-reviews-error {
    padding: 20px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    color: #856404;
    text-align: center;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .bbx-reviews-grid {
        grid-template-columns: 1fr;
    }

    .bbx-reviews-wrapper .swiper-button-prev,
    .bbx-reviews-wrapper .swiper-button-next {
        display: none !important;
    }
    
    .bbx-review-card {
        height: auto; /* Hauteur automatique sur mobile */
        min-height: 280px;
    }
    
    .bbx-review-modal-content {
        width: 95%;
        padding: 20px;
        max-height: 90vh;
    }
}

@media (min-width: 1400px) {
    .bbx-reviews-container {
        max-width: 1320px;
    }
}

