/**
 * Uniweb — Avis Google : widget front + pop-up « Voir tous les avis ».
 *
 * - Toutes les icônes sont en CSS (data-URI) : aucun <svg> dans le HTML, qui
 *   survit donc à wp_kses_post() et aux filtres des thèmes.
 * - Sélecteurs préfixés par .dgr (et !important ciblés) : le CSS du thème
 *   (img, a, p, ul, button du contenu) ne déborde pas sur le widget.
 */

.dgr {
    --dgr-gold: #fbbc05;
    --dgr-card: #ffffff;
    --dgr-panel: #f7f8fa;
    --dgr-border: #e8e9ee;
    --dgr-ink: #1f2430;
    --dgr-text: #3c4149;
    --dgr-muted: #70757a;
    --dgr-star-empty: #dadce0;
    --dgr-shadow: 0 12px 30px -22px rgba(20, 25, 40, 0.5);
    box-sizing: border-box;
    color: var(--dgr-ink);
    font-family: inherit;
    -webkit-font-smoothing: antialiased;
}

.dgr.dgr-widget {
    width: 100%;
}

.dgr *,
.dgr *::before,
.dgr *::after {
    box-sizing: border-box;
}

/* ---------------------------------------------------------------- En-tête */

.dgr .dgr-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 20px;
    padding: 18px 22px;
    background: var(--dgr-panel);
    border-radius: 16px;
    margin-bottom: 22px;
}

.dgr .dgr-head__brand {
    display: flex;
    align-items: baseline;
    gap: 8px;
    line-height: 1;
}

.dgr .dgr-gword {
    font-size: 1.6rem;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.dgr .dgr-head__label {
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--dgr-muted);
}

.dgr .dgr-head__score {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dgr .dgr-head__num {
    font-size: 1.35rem;
    font-weight: 700;
    color: #e7711b;
}

.dgr .dgr-head__count {
    color: var(--dgr-muted);
    font-size: 0.95rem;
}

.dgr a.dgr-head__cta,
.dgr a.dgr-head__cta:hover,
.dgr a.dgr-head__cta:focus,
.dgr a.dgr-head__cta:visited {
    color: var(--dgr-accent-ink, #12141c) !important;
    text-decoration: none !important;
}

.dgr .dgr-head__cta {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    padding: 11px 20px;
    border-radius: 999px;
    background: var(--dgr-accent, #ffc93c);
    font-weight: 600;
    font-size: 0.92rem;
    line-height: 1.3;
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
    white-space: nowrap;
}

.dgr .dgr-head__cta:hover {
    transform: translateY(-1px);
    filter: brightness(1.05);
    box-shadow: 0 8px 20px -8px rgba(0, 0, 0, 0.45);
}

/* -------------------------------------------------------------- Étoiles */
/* Un seul élément : 5 étoiles en masque répété, remplissage exact en ::before
   (--dgr-fill posé par le PHP ; repli sur la note arrondie si le style inline
   est filtré). Étoile 18 px + 2 px d'espace. */

.dgr .dgr-stars {
    position: relative;
    display: inline-block;
    flex: 0 0 auto;
    align-self: flex-start;
    width: 98px;
    max-width: none;
    height: 18px;
    vertical-align: middle;
    background: var(--dgr-star-empty);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='18' viewBox='0 0 20 18'%3E%3Cpath transform='scale(.75)' d='M12 2l2.9 6.26L21.6 9.2l-4.8 4.68 1.14 6.62L12 17.27 6.06 20.5l1.14-6.62L2.4 9.2l6.7-.94z'/%3E%3C/svg%3E") 0 0 / 20px 18px repeat-x;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='18' viewBox='0 0 20 18'%3E%3Cpath transform='scale(.75)' d='M12 2l2.9 6.26L21.6 9.2l-4.8 4.68 1.14 6.62L12 17.27 6.06 20.5l1.14-6.62L2.4 9.2l6.7-.94z'/%3E%3C/svg%3E") 0 0 / 20px 18px repeat-x;
}

.dgr .dgr-stars::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: var(--dgr-fill, var(--dgr-fill-int, 0px));
    background: var(--dgr-gold);
}

.dgr .dgr-r0 { --dgr-fill-int: 0px; }
.dgr .dgr-r1 { --dgr-fill-int: 20px; }
.dgr .dgr-r2 { --dgr-fill-int: 40px; }
.dgr .dgr-r3 { --dgr-fill-int: 60px; }
.dgr .dgr-r4 { --dgr-fill-int: 80px; }
.dgr .dgr-r5 { --dgr-fill-int: 100px; }

/* ------------------------------------------------------------- Carrousel */

.dgr .dgr-body {
    position: relative;
}

/* Marge intérieure verticale compensée par une marge négative : les ombres
   des cartes ne sont plus coupées, et la mise en page ne bouge pas. */
.dgr .dgr-viewport {
    overflow: hidden;
    padding: 10px 0 34px;
    margin: -10px 0 -34px;
    touch-action: pan-y; /* laisse le scroll vertical, on gère l'horizontal */
}

.dgr .dgr-viewport.dgr-grab {
    cursor: grab;
}

.dgr .dgr-viewport.dgr-grab.is-dragging {
    cursor: grabbing;
}

.dgr .dgr-viewport.is-dragging {
    user-select: none;
}

.dgr .dgr-track img {
    -webkit-user-drag: none;
    user-select: none;
    pointer-events: none;
}

.dgr ul.dgr-track {
    display: flex;
    gap: 18px;
    margin: 0 !important;
    padding: 6px 2px !important;
    list-style: none !important;
    transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: auto;
}

.dgr.dgr-layout-grid ul.dgr-track {
    flex-wrap: wrap;
    transition: none;
}

/* -------------------------------------------------------------- Cartes */

.dgr .dgr-card {
    flex: 0 0 300px;
    min-width: 0; /* un nom très long ne doit pas élargir la carte */
    max-width: 84vw;
    background: var(--dgr-card);
    border: 1px solid var(--dgr-border);
    border-radius: 16px;
    padding: 20px !important;
    margin: 0 !important;
    box-shadow: var(--dgr-shadow);
    display: flex;
    flex-direction: column;
    gap: 12px;
    list-style: none !important;
    text-indent: 0 !important;
    text-align: left;
}

.dgr.dgr-layout-grid .dgr-card {
    flex: 1 1 280px;
    max-width: none;
}

/* Blindage : certains thèmes ajoutent une puce (::before) aux <li> du contenu. */
.dgr .dgr-card::before,
.dgr .dgr-card::after {
    content: none !important;
    display: none !important;
}

.dgr .dgr-card__head {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ---------------------------------------------------------------- Avatar */

.dgr .dgr-avatar {
    position: relative;
    flex: 0 0 auto;
    display: block;
    width: 46px;
    height: 46px;
}

/* Blindage : thèmes qui stylent img (fond gris des images « lazy », coins
   carrés, bordure, padding, height:auto…). */
.dgr img.dgr-avatar__img {
    display: block !important;
    width: 46px !important;
    height: 46px !important;
    min-width: 0 !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 50% !important;
    background: transparent !important;
    box-shadow: none !important;
    object-fit: cover;
}

.dgr .dgr-avatar__initial {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    color: #fff;
    font-weight: 600;
    font-size: 1.15rem;
    line-height: 1;
}

/* Pastille « G » Google (4 couleurs) en image CSS. */
.dgr .dgr-avatar__badge {
    position: absolute;
    right: -3px;
    bottom: -3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cpath fill='%234285F4' d='M45.12 24.5c0-1.56-.14-3.06-.4-4.5H24v8.51h11.84c-.51 2.75-2.06 5.08-4.39 6.64v5.52h7.11c4.16-3.83 6.56-9.47 6.56-16.17z'/%3E%3Cpath fill='%2334A853' d='M24 46c5.94 0 10.92-1.97 14.56-5.33l-7.11-5.52c-1.97 1.32-4.49 2.1-7.45 2.1-5.73 0-10.58-3.87-12.31-9.07H4.34v5.7C7.96 41.07 15.4 46 24 46z'/%3E%3Cpath fill='%23FBBC05' d='M11.69 28.18c-.44-1.32-.69-2.73-.69-4.18s.25-2.86.69-4.18v-5.7H4.34C2.85 17.09 2 20.45 2 24s.85 6.91 2.34 9.88l7.35-5.7z'/%3E%3Cpath fill='%23EA4335' d='M24 10.75c3.23 0 6.13 1.11 8.41 3.29l6.31-6.31C34.91 4.18 29.93 2 24 2 15.4 2 7.96 6.93 4.34 14.12l7.35 5.7c1.73-5.2 6.58-9.07 12.31-9.07z'/%3E%3C/svg%3E") center / 13px 13px no-repeat;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.28);
}

.dgr .dgr-card__id {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dgr .dgr-card__name {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
    font-weight: 600;
    font-size: 0.98rem;
    line-height: 1.3;
    color: var(--dgr-ink);
}

.dgr .dgr-card__author {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Coche « vérifié » bleue en masque CSS. */
.dgr .dgr-card__check {
    flex: 0 0 auto;
    width: 15px;
    height: 15px;
    background: #4285f4;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.dgr .dgr-card__date {
    font-size: 0.82rem;
    line-height: 1.3;
    color: var(--dgr-muted);
}

/* ------------------------------------------------------------------ Texte */

.dgr .dgr-card__text {
    font-size: 0.94rem;
    line-height: 1.55;
    color: var(--dgr-text);
}

.dgr .dgr-card__text p {
    margin: 0 !important;
    white-space: pre-line; /* retours à la ligne de l'avis */
    overflow-wrap: anywhere;
    font-size: inherit;
    line-height: inherit;
    color: inherit;
}

.dgr .dgr-card__text.is-clamped p {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.dgr .dgr-card__text.is-open p {
    -webkit-line-clamp: unset;
    overflow: visible;
}

.dgr button.dgr-more {
    margin: 6px 0 0;
    padding: 0;
    border: 0;
    background: none;
    box-shadow: none;
    color: var(--dgr-muted);
    font: inherit;
    font-size: 0.9rem;
    line-height: 1.4;
    text-transform: none;
    letter-spacing: normal;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.dgr button.dgr-more:hover {
    color: var(--dgr-ink);
}

/* -------------------------------------------------------------- Flèches */

.dgr button.dgr-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    width: 42px;
    height: 42px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid var(--dgr-border);
    background: #fff;
    color: #3c4149;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 24px -12px rgba(20, 25, 40, 0.55);
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.dgr button.dgr-nav::before {
    content: "";
    width: 22px;
    height: 22px;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 18l6-6-6-6'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 18l6-6-6-6'/%3E%3C/svg%3E") center / contain no-repeat;
}

.dgr button.dgr-nav--prev::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 18l-6-6 6-6'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 18l-6-6 6-6'/%3E%3C/svg%3E");
}

.dgr button.dgr-nav:hover {
    transform: translateY(-50%) scale(1.07);
}

/* display:flex l'emporterait sur le [hidden] natif → on force le masquage. */
.dgr button.dgr-nav[hidden] {
    display: none;
}

.dgr .dgr-nav--prev {
    left: -14px;
}

.dgr .dgr-nav--next {
    right: -14px;
}

/* ------------------------------------------------------ Pied : points + bouton */

.dgr .dgr-foot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    margin-top: 20px;
}

.dgr .dgr-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.dgr .dgr-dots:empty {
    display: none;
}

.dgr button.dgr-dot {
    width: 8px;
    height: 8px;
    min-width: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #cfd3da;
    box-shadow: none;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease;
}

.dgr button.dgr-dot.is-active {
    background: var(--dgr-accent, #ffc93c);
    transform: scale(1.3);
}

.dgr button.dgr-all {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 10px 22px;
    border-radius: 999px;
    border: 1.5px solid var(--dgr-accent, #ffc93c);
    background: transparent;
    box-shadow: none;
    color: var(--dgr-ink);
    font: inherit;
    font-weight: 600;
    font-size: 0.92rem;
    line-height: 1.3;
    text-transform: none;
    letter-spacing: normal;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.dgr button.dgr-all:hover,
.dgr button.dgr-all:focus-visible {
    background: var(--dgr-accent, #ffc93c);
    color: var(--dgr-accent-ink, #12141c);
}

/* ---------------------------------------------------------------- États */

.dgr.dgr-empty {
    padding: 20px;
    border: 1px dashed var(--dgr-border);
    border-radius: 12px;
    color: var(--dgr-muted);
    text-align: center;
}

/* --------------------------------------------- Pop-up « Voir tous les avis » */

dialog.dgr-modal {
    position: fixed;
    inset: 0;
    margin: auto;
    padding: 0;
    border: 0;
    border-radius: 20px;
    width: min(1120px, calc(100vw - 32px));
    max-width: none;
    height: min(88vh, 1000px);
    max-height: none;
    background: var(--dgr-panel);
    color: var(--dgr-ink);
    box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.45);
    overflow: hidden;
}

dialog.dgr-modal[open] {
    display: flex;
    flex-direction: column;
}

dialog.dgr-modal::backdrop {
    background: rgba(15, 18, 28, 0.6);
}

.dgr .dgr-modal__head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 16px;
    padding: 16px 20px;
    background: var(--dgr-card);
    border-bottom: 1px solid var(--dgr-border);
}

.dgr button.dgr-modal__close {
    margin-left: auto;
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid var(--dgr-border);
    background: var(--dgr-card);
    color: var(--dgr-ink);
    box-shadow: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.dgr button.dgr-modal__close::before {
    content: "";
    width: 18px;
    height: 18px;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E") center / contain no-repeat;
}

.dgr button.dgr-modal__close:hover {
    background: var(--dgr-panel);
}

.dgr .dgr-modal__body {
    flex: 1 1 auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 22px;
}

.dgr ul.dgr-modal__list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 18px;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

.dgr .dgr-modal__list .dgr-card {
    max-width: none;
}

.dgr .dgr-modal__foot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 24px 0 6px;
    color: var(--dgr-muted);
    font-size: 0.9rem;
}

.dgr .dgr-modal__foot:empty {
    display: none;
}

.dgr .dgr-spinner {
    width: 30px;
    height: 30px;
    border: 3px solid var(--dgr-border);
    border-top-color: var(--dgr-accent, #ffc93c);
    border-radius: 50%;
    animation: dgr-spin 0.8s linear infinite;
}

@keyframes dgr-spin {
    to { transform: rotate(360deg); }
}

/* --------------------------------------------------------- Thème sombre */

.dgr.dgr-theme-dark {
    --dgr-card: #12151d;
    --dgr-panel: #0d1016;
    --dgr-border: #262b36;
    --dgr-ink: #eef1f6;
    --dgr-text: #eef1f6;
    --dgr-muted: #99a0ad;
    --dgr-star-empty: #3a4150;
}

.dgr.dgr-theme-dark .dgr-head {
    border: 1px solid var(--dgr-border);
    background: var(--dgr-card);
}

.dgr.dgr-theme-dark button.dgr-nav {
    background: #1b1f29;
    color: #eef1f6;
}

.dgr.dgr-theme-dark .dgr-avatar__badge {
    background-color: #f2f2f2;
}

@media (prefers-color-scheme: dark) {
    .dgr.dgr-theme-auto {
        --dgr-card: #12151d;
        --dgr-panel: #0d1016;
        --dgr-border: #262b36;
        --dgr-ink: #eef1f6;
        --dgr-text: #eef1f6;
        --dgr-muted: #99a0ad;
        --dgr-star-empty: #3a4150;
    }
    .dgr.dgr-theme-auto .dgr-head {
        background: var(--dgr-card);
    }
    .dgr.dgr-theme-auto button.dgr-nav {
        background: #1b1f29;
        color: #eef1f6;
    }
}

/* --------------------------------------------------------- Responsive */

@media (max-width: 640px) {
    .dgr .dgr-head {
        padding: 16px;
    }
    .dgr .dgr-head__cta {
        margin-left: 0;
        width: 100%;
        justify-content: center;
    }
    .dgr button.dgr-nav {
        display: none;
    }
    .dgr .dgr-card {
        flex-basis: 86%;
        max-width: 86%;
    }
    dialog.dgr-modal {
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        border-radius: 0;
    }
    .dgr .dgr-modal__body {
        padding: 14px;
    }
    .dgr ul.dgr-modal__list {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .dgr ul.dgr-track {
        transition: none;
    }
    .dgr .dgr-spinner {
        animation-duration: 2s;
    }
}
