/* STG Avis — slider de cards d'avis (Google + Immodvisor) */

/* v1.0.15 — NE PAS définir --stg-avis-cpv ni --stg-avis-gap ici.
   Elementor injecte ces variables sur {{WRAPPER}} (l'élément parent
   .elementor-element). Si on les redéfinit sur .stg-avis-wrap (enfant),
   on ÉCRASE le choix de l'admin → "cards visibles = 6" reste à 3.
   Les fallbacks sont dans les var(--xxx, fallback) plus bas. */
.stg-avis-wrap {
    --stg-avis-index: 0;      /* géré par JS pour le slide */
    position: relative;
    width: 100%;
    padding: 0 60px;          /* espace pour les flèches latérales */
    box-sizing: border-box;
}

.stg-avis-viewport {
    overflow: hidden;
    width: 100%;
}

/* v1.0.12 — !important + fallbacks dans calc :
   - Elementor injecte parfois ses propres règles flex sur les enfants de widgets
     → !important garantit le layout horizontal.
   - var(--xxx, fallback) protège quand la variable n'est pas définie dans
     l'éditeur (responsive control parfois muet en preview AJAX). */
.stg-avis-track {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: stretch;
    gap: var(--stg-avis-gap, 20px);
    transition: transform .5s cubic-bezier(.4, 0, .2, 1);
    will-change: transform;
}

/* Chaque card occupe (100% - gaps) / cards-par-view du viewport */
.stg-avis-card {
    flex: 0 0 calc((100% - (var(--stg-avis-cpv, 3) - 1) * var(--stg-avis-gap, 20px)) / var(--stg-avis-cpv, 3)) !important;
    width: calc((100% - (var(--stg-avis-cpv, 3) - 1) * var(--stg-avis-gap, 20px)) / var(--stg-avis-cpv, 3)) !important;
    box-sizing: border-box;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ===== Header card : avatar + meta + source ===== */
.stg-avis-card-head {
    display: flex;
    align-items: center;
    gap: 12px;
}

.stg-avis-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 18px;
}
.stg-avis-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.stg-avis-avatar-initial {
    line-height: 1;
}

.stg-avis-meta {
    flex: 1;
    min-width: 0;
    line-height: 1.3;
}

.stg-avis-name {
    font-weight: 700;
    font-size: 14px;
    color: #1f2937;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stg-avis-date {
    font-size: 12px;
    color: #6b7280;
    margin-top: 2px;
}

.stg-avis-src-badge {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.stg-avis-src-badge svg { display: block; }
.stg-avis-src-letter {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
}
.stg-avis-src-immo { background: #ff6b35; }

/* v1.0.26 — Logo officiel Immodvisor (icône maison violette) sur les cards */
.stg-avis-src-immo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* ===== Rating ===== */
.stg-avis-rating {
    display: flex;
    align-items: center;
    gap: 6px;
}
.stg-avis-stars {
    color: #fbbf24;
    font-size: 16px;
    letter-spacing: 2px;
    line-height: 1;
}
.stg-avis-verified svg { display: block; }

/* ===== Texte ===== */
.stg-avis-text {
    color: #374151;
    font-size: 14px;
    line-height: 1.55;
    flex: 1;
    /* Tronque visuellement à ~4 lignes max au cas où l'API renverrait plus */
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.stg-avis-more {
    display: inline-block;
    color: #2563eb;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    margin-top: 4px;
    align-self: flex-start;
}
.stg-avis-more:hover { text-decoration: underline; }

/* ===== Navigation arrows ===== */
.stg-avis-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid #e5e7eb;
    color: #1f2937;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
    transition: all .2s ease;
    z-index: 2;
    padding: 0;
}
.stg-avis-nav:hover {
    background: #f9fafb;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .15);
    transform: translateY(-50%) scale(1.05);
}
.stg-avis-nav-prev { left: 8px; }
.stg-avis-nav-next { right: 8px; }
.stg-avis-nav[disabled],
.stg-avis-nav.is-disabled {
    opacity: 0.4;
    cursor: default;
    pointer-events: none;
}
.stg-avis-nav svg { display: block; }

/* ===== Dots ===== */
.stg-avis-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 18px;
}
.stg-avis-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #d1d5db;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: all .2s ease;
}
.stg-avis-dot.is-active {
    background: #2563eb;
    width: 24px;
    border-radius: 4px;
}

/* ===== Responsive : on respecte les controls cards_per_view du widget ===== */
@media (max-width: 767px) {
    .stg-avis-wrap { padding: 0 44px; }
    .stg-avis-nav { width: 36px; height: 36px; }
    .stg-avis-nav-prev { left: 2px; }
    .stg-avis-nav-next { right: 2px; }
}

@media (prefers-reduced-motion: reduce) {
    .stg-avis-track { transition: none; }
}

/* ===== Footer banner (résumé notes par source) ===== */
.stg-avis-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 18px;
    padding: 14px 20px;
    margin-top: 20px;
    background: #f3f4f6;
    border-radius: 8px;
    color: #4b5563;
    font-size: 15px;
    line-height: 1.4;
}

.stg-avis-footer-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: inherit;
    text-decoration: none;
    transition: opacity .2s ease;
}
.stg-avis-footer-item:hover { opacity: 0.75; }

.stg-avis-footer-score {
    font-weight: 700;
    color: #1f2937;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.stg-avis-footer-count {
    color: #6b7280;
    font-size: 0.9em;
}

.stg-avis-footer-label {
    color: inherit;
}

.stg-avis-footer-brand {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
}

.stg-avis-brand-immo {
    color: #6b21a8;
}
.stg-avis-brand-immo svg {
    color: #6b21a8;
}

/* v1.0.26 — Wordmark Immodvisor officiel dans le footer */
.stg-avis-footer-brand-img {
    height: 18px;
    width: auto;
    display: inline-block;
    vertical-align: middle;
}
.stg-avis-brand-immo-logo {
    /* Le SVG d'origine est en noir → on le tente avec filter pour matcher le violet de la marque */
}

/* Logo "Google" multicolore (G=bleu, o=rouge, o=jaune, g=bleu, l=vert, e=rouge) */
.stg-avis-brand-google {
    background-image: linear-gradient(
        to right,
        #4285f4 0%, #4285f4 17%,
        #ea4335 17%, #ea4335 34%,
        #fbbc05 34%, #fbbc05 50%,
        #4285f4 50%, #4285f4 67%,
        #34a853 67%, #34a853 84%,
        #ea4335 84%, #ea4335 100%
    );
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.stg-avis-footer-sep {
    display: inline-block;
    width: 1px;
    height: 22px;
    background: #d1d5db;
}

@media (max-width: 600px) {
    .stg-avis-footer { gap: 12px; padding: 12px 14px; font-size: 13px; }
    .stg-avis-footer-sep { display: none; }
}
