/* ==========================================================
   SD Tools — Widgets CSS  v1.2
   ========================================================== */

/* ══════════════════════════════════════════════════════════
   WIDGET BADGE
   ══════════════════════════════════════════════════════════ */

.sd-badges-wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.sd-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 99px;
    border: 1px solid #e5e7eb;
    background-color: #f3f4f6;
    color: #374151;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    white-space: nowrap;
    text-decoration: none;
    cursor: default;
    transition-property: color, background-color, border-color, box-shadow, transform;
    transition-duration: 200ms;
    transition-timing-function: ease;
    box-sizing: border-box;
}

a.sd-badge {
    cursor: pointer;
}

.sd-badge-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    line-height: 1;
}

.sd-badge-icon svg {
    width: 13px;
    height: 13px;
    fill: currentColor;
}

.sd-badge-icon i {
    font-size: inherit;
}

.sd-badge-text {
    display: inline;
}

/* ── Double Bouton ──────────────────────────────────────── */

.sd-double-buttons {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
}

.sd-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    cursor: pointer;
    line-height: 1.2;
    white-space: nowrap;
    border: 2px solid transparent;
    transition-property: color, background-color, border-color, box-shadow, transform, opacity;
    transition-duration: 250ms;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

.sd-btn-1 {
    background-color: #2791F5;
    color: #ffffff;
    padding: 13px 28px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
}

.sd-btn-2 {
    background-color: #ffffff;
    color: #111111;
    padding: 13px 28px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    border-color: #e5e7eb;
}

.sd-btn:focus-visible {
    outline: 3px solid rgba(39, 145, 245, 0.5);
    outline-offset: 3px;
}

/* ── Modal Overlay ──────────────────────────────────────── */

.sd-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.sd-modal-overlay.sd-modal-open,
.sd-modal-overlay.sd-modal-preview {
    opacity: 1;
    visibility: visible;
}

/* ── Modal Box ──────────────────────────────────────────── */

.sd-modal-box {
    background: #ffffff;
    border-radius: 16px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 32px 100px rgba(0, 0, 0, 0.28);
    transform: scale(0.96) translateY(10px);
    transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.sd-modal-overlay.sd-modal-open .sd-modal-box,
.sd-modal-overlay.sd-modal-preview .sd-modal-box {
    transform: scale(1) translateY(0);
}

/* ── Bouton Fermer ──────────────────────────────────────── */

.sd-modal-close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: rgba(255, 255, 255, 0.18);
    border: none;
    border-radius: 50% !important;  /* forcer le rond malgré les styles Astra/theme */
    width: 32px !important;
    height: 32px !important;
    min-width: 32px;
    min-height: 32px;
    padding: 0 !important;
    margin: 0;
    box-sizing: border-box !important;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 15px;
    line-height: 1;
    color: #ffffff;
    cursor: pointer;
    z-index: 2;
    transition: background 0.2s;
    aspect-ratio: 1 / 1;
}

.sd-modal-close:hover        { background: rgba(255, 255, 255, 0.32); }
.sd-modal-close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* ── Entête gradient ────────────────────────────────────── */

.sd-modal-head {
    background: linear-gradient(135deg, #2791F5 0%, #1259c3 100%);
    padding: 28px 28px 24px;
    border-radius: 16px 16px 0 0;
    color: #ffffff;
    text-align: center;
}

.sd-modal-icon-wrap {
    width: 52px;
    height: 52px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 22px;
    line-height: 1;
}

.sd-modal-title {
    font-size: 20px;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 6px;
}

.sd-modal-subtitle {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.85);
    margin: 0 0 16px;
    line-height: 1.5;
}

.sd-modal-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 4px;
}

.sd-modal-badges span {
    background: rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    padding: 4px 13px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.92);
}

/* ── Corps ──────────────────────────────────────────────── */

.sd-modal-body {
    padding: 26px 28px 30px;
}

/* ── CF7 dans la modal ──────────────────────────────────── */

.sd-modal-body .wpcf7 { margin: 0; }
.sd-modal-body .wpcf7-form p { margin: 0 0 14px; }
.sd-modal-body .wpcf7-form .wpcf7-form-control-wrap { display: block; }

.sd-modal-body .wpcf7-form input:not([type="submit"]),
.sd-modal-body .wpcf7-form textarea,
.sd-modal-body .wpcf7-form select {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    color: #111;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.sd-modal-body .wpcf7-form input:not([type="submit"]):focus,
.sd-modal-body .wpcf7-form textarea:focus {
    outline: none;
    border-color: #2791F5;
    box-shadow: 0 0 0 3px rgba(39, 145, 245, 0.15);
}

.sd-modal-body .wpcf7-form input[type="submit"] {
    width: 100%;
    padding: 13px;
    background: #2791F5;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s;
}

.sd-modal-body .wpcf7-form input[type="submit"]:hover {
    background: #1a7de8;
}

/* Grille 2 colonnes pour les champs côte à côte (sd-row-2col ou cf7-row-2col) */
.sd-modal-body .wpcf7-form .sd-row-2col,
.sd-modal-body .wpcf7-form .cf7-row-2col,
.etre-rappele-form .cf7-row-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* Style général formulaire etre-rappele (hors modal aussi) */
.etre-rappele-form input:not([type="submit"]),
.etre-rappele-form textarea,
.etre-rappele-form select {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    color: #111;
    background: #fff;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.etre-rappele-form input:not([type="submit"]):focus,
.etre-rappele-form textarea:focus {
    outline: none;
    border-color: #2791F5;
    box-shadow: 0 0 0 3px rgba(39, 145, 245, 0.15);
}

.etre-rappele-form input[type="submit"] {
    width: 100%;
    padding: 13px;
    background: #2791F5;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s;
}

.etre-rappele-form input[type="submit"]:hover {
    background: #1a7de8;
}

/* ── Responsive ─────────────────────────────────────────── */

@media (max-width: 520px) {
    .sd-modal-box   { border-radius: 12px; }
    .sd-modal-head  { padding: 22px 20px 18px; border-radius: 12px 12px 0 0; }
    .sd-modal-body  { padding: 20px 20px 24px; }
    .sd-modal-title { font-size: 17px; }
}

/* ── Option Calendly en bas de la modal ─────────────────── */

.sd-modal-calendly {
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid #f3f4f6;
    text-align: center;
}

.sd-modal-calendly-msg {
    font-size: 13px;
    color: #6b7280;
    margin: 0 0 12px;
    line-height: 1.5;
}

.sd-modal-calendly-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 13px 20px;
    background: transparent;
    color: #374151;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    box-sizing: border-box;
    transition: border-color 0.2s, background 0.2s, color 0.2s;
}

.sd-modal-calendly-btn:hover {
    border-color: #2791F5;
    background: #f0f8ff;
    color: #2791F5;
}

/* ── Prévisualisation éditeur Elementor ─────────────────── */

.elementor-editor-active .sd-modal-preview.sd-modal-overlay {
    position: relative;
    inset: auto;
    background: rgba(0, 0, 0, 0.08);
    padding: 16px;
    border-radius: 12px;
    margin-top: 14px;
}

/* ══════════════════════════════════════════════════════════
   WIDGETS CARD GRID & CARD CAROUSEL — Cartes
   ══════════════════════════════════════════════════════════ */

/* ── Grille ─────────────────────────────────────────────── */

.sd-cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    align-items: stretch; /* clé pour l'égalité des hauteurs */
}

/* ── Carte individuelle ─────────────────────────────────── */

.sd-card {
    display: flex;
    flex-direction: column;
    background-color: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.07);
    transition: box-shadow 280ms ease, transform 280ms ease;
    text-decoration: none;
    color: inherit;
    height: 100%; /* remplit la cellule de grille */
}

.sd-card:hover {
    transform: translateY(-4px);
}

a.sd-card,
a.sd-card:visited {
    color: inherit;
    text-decoration: none;
}

/* ── Image ──────────────────────────────────────────────── */

.sd-card-image {
    flex-shrink: 0;
    height: 220px;
    overflow: hidden;
    border-radius: 12px 12px 0 0;
    background-color: #f3f4f6;
}

.sd-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.sd-card-image--placeholder {
    background: linear-gradient(135deg, #e5e7eb 0%, #d1d5db 100%);
}

/* ── Corps de carte ─────────────────────────────────────── */

.sd-card-body {
    display: flex;
    flex-direction: column;
    flex: 1; /* remplit la hauteur restante */
    padding: 20px;
}

/* Zone principale : prend tout l'espace disponible,
   pousse le footer vers le bas */
.sd-card-content {
    flex: 1;
}

/* Footer : toujours en bas */
.sd-card-footer {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* ── Éléments textuels ──────────────────────────────────── */

.sd-card-category {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 3px 10px;
    border-radius: 99px;
    background-color: #eff6ff;
    color: #2563eb;
    margin-bottom: 12px;
    line-height: 1.5;
}

.sd-card-title {
    font-size: 17px;
    font-weight: 700;
    line-height: 1.45;
    color: #111827;
    margin: 0 0 8px;
    transition: color 200ms ease;
}

.sd-card-excerpt {
    font-size: 14px;
    line-height: 1.65;
    color: #6b7280;
    margin: 0;
}

.sd-card-meta {
    font-size: 12px;
    color: #9ca3af;
    margin-bottom: 2px;
}

.sd-card-link {
    display: inline-flex;
    align-items: center;
    font-size: 14px;
    font-weight: 600;
    color: #2791F5;
    text-decoration: none;
    transition: color 200ms ease;
}

.sd-card-link:hover {
    color: #1a7de8;
}

/* ── Message vide ───────────────────────────────────────── */

.sd-no-items {
    color: #9ca3af;
    font-size: 14px;
    text-align: center;
    padding: 40px 20px;
    width: 100%;
}

/* ══════════════════════════════════════════════════════════
   CAROUSEL
   ══════════════════════════════════════════════════════════ */

.sd-carousel {
    position: relative;
    width: 100%;
}

.sd-carousel-inner {
    overflow: hidden;
    width: 100%;
}

.sd-carousel-track {
    display: flex;
    align-items: stretch; /* hauteur égale entre slides */
    gap: 20px;
    transition: transform 400ms cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.sd-carousel-slide {
    flex-shrink: 0;
    display: flex; /* permet à .sd-card de prendre toute la hauteur */
}

/* La carte dans le carousel s'étire en hauteur */
.sd-carousel-slide .sd-card {
    flex: 1;
}

/* ── Mode aperçu éditeur : affiche en grille ────────────── */

.sd-carousel--preview .sd-carousel-track {
    flex-wrap: wrap;
    transform: none !important;
    transition: none;
}

.sd-carousel--preview .sd-carousel-slide {
    flex: 1 1 calc(33% - 14px);
    min-width: 180px;
}

/* ── Flèches navigation ─────────────────────────────────── */

.sd-carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 99px;
    background-color: #ffffff;
    color: #374151;
    border: 1px solid #e5e7eb;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.10);
    transition: background-color 180ms ease, box-shadow 180ms ease;
    padding: 0;
    line-height: 1;
}

.sd-carousel-btn:hover {
    background-color: #f3f4f6;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.14);
}

.sd-carousel-btn:disabled {
    opacity: 0.35;
    cursor: default;
}

.sd-carousel-btn svg {
    width: 18px;
    height: 18px;
    pointer-events: none;
}

.sd-carousel-prev {
    left: -20px;
}

.sd-carousel-next {
    right: -20px;
}

/* ── Points de pagination ───────────────────────────────── */

.sd-carousel-dots {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-top: 20px;
}

.sd-dot {
    width: 8px;
    height: 8px;
    border-radius: 99px;
    background-color: #d1d5db;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: background-color 200ms ease, width 200ms ease;
}

.sd-dot.active {
    background-color: #2791F5;
    width: 22px;
}

/* ── Responsive cartes ──────────────────────────────────── */

@media (max-width: 1023px) {
    .sd-cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 767px) {
    .sd-cards-grid {
        grid-template-columns: 1fr;
    }
    .sd-carousel-prev { left: -12px; }
    .sd-carousel-next { right: -12px; }
}

/* ══════════════════════════════════════════════════════════
   WIDGET LOGO CAROUSEL
   Défilement infini CSS (translateX -50%), fondu sur les bords
   ══════════════════════════════════════════════════════════ */

/* ── Conteneur ──────────────────────────────────────────── */

.sd-logo-carousel {
    position: relative;
    overflow: hidden;
    width: 100%;
    --sd-fade-w: 120px;
    --sd-gap: 48px;
    --sd-visible: 5;
    /* Active les container queries pour le mode "N visibles" */
    container-type: inline-size;
    container-name: sd-logos;
}

/* Fondu gauche/droite avec CSS mask */
.sd-logo-carousel--fade {
    -webkit-mask-image: linear-gradient(
        to right,
        transparent 0%,
        black var(--sd-fade-w),
        black calc(100% - var(--sd-fade-w)),
        transparent 100%
    );
    mask-image: linear-gradient(
        to right,
        transparent 0%,
        black var(--sd-fade-w),
        black calc(100% - var(--sd-fade-w)),
        transparent 100%
    );
}

/* ── Track animé ────────────────────────────────────────── */

.sd-logo-track {
    display: flex;
    align-items: center;
    gap: 48px;
    width: max-content;      /* s'étend sur le contenu total */
    animation: sd-logo-scroll 25s linear infinite;
    will-change: transform;
}

/* Direction droite → gauche (défaut) */
@keyframes sd-logo-scroll {
    from { transform: translateX(0); }
    to   { transform: translateX(-50%); }
}

/* Direction gauche → droite */
.sd-logo-track--reverse {
    animation-name: sd-logo-scroll-reverse;
}

@keyframes sd-logo-scroll-reverse {
    from { transform: translateX(-50%); }
    to   { transform: translateX(0); }
}

/* Pause au survol */
.sd-logo-carousel--pause-hover:hover .sd-logo-track {
    animation-play-state: paused;
}

/* ── Logo item ──────────────────────────────────────────── */

.sd-logo-item {
    flex-shrink: 0;
    width: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Mode "N logos visibles" — la largeur de chaque logo = largeur du carousel
   moins les N-1 gaps, divisée par N. Utilise cqw (container query) pour se
   baser sur la largeur du carousel, et non sur la largeur du .sd-logo-track
   (qui est en width: max-content). */
.sd-logo-carousel--fit .sd-logo-item {
    width: calc(
        (100cqw - var(--sd-gap) * (var(--sd-visible) - 1))
        / var(--sd-visible)
    );
}

/* Fallback pour navigateurs sans container queries — on tombe sur 150px. */
@supports not (container-type: inline-size) {
    .sd-logo-carousel--fit .sd-logo-item {
        width: 150px;
    }
}

.sd-logo-item a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.sd-logo-item img {
    width: 100%;
    height: auto;
    max-height: 48px;
    object-fit: contain;
    display: block;
    filter: grayscale(100%);
    opacity: 0.55;
    transition: filter 300ms ease, opacity 300ms ease;
    -webkit-filter: grayscale(100%);
}

.sd-logo-item:hover img {
    filter: grayscale(0%);
    opacity: 1;
    -webkit-filter: grayscale(0%);
}

/* Placeholder texte si pas d'image */
.sd-logo-placeholder {
    font-size: 13px;
    font-weight: 600;
    color: #9ca3af;
    text-align: center;
    white-space: nowrap;
}

/* ── Accessibilité : stopper l'animation si préférences système ── */

/* ══════════════════════════════════════════════════════════
   WIDGET TABLEAU
   ══════════════════════════════════════════════════════════ */

/* ── Wrapper ────────────────────────────────────────────── */

.sd-table-wrap {
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.10);
    box-sizing: border-box;
}

/* Scroll horizontal sur mobile */
.sd-table-wrap--scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ── Table ──────────────────────────────────────────────── */

.sd-table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    min-width: 100%;
}

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

.sd-table thead th {
    background-color: #f8fafc;
    color: #374151;
    font-weight: 600;
    font-size: 14px;
    padding: 14px 20px;
    text-align: left;
    border: 1px solid rgba(0, 0, 0, 0.06);
    white-space: nowrap;
}

/* ── Cellules de données ────────────────────────────────── */

.sd-table td {
    font-size: 14px;
    padding: 14px 20px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    vertical-align: middle;
    line-height: 1.5;
}

.sd-table tbody tr:last-child td {
    border-bottom: none;
}

/* ── Pied de tableau (tfoot) ────────────────────────────── */

.sd-table tfoot td {
    font-weight: 600;
    font-size: 14px;
    padding: 14px 20px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    vertical-align: middle;
    background-color: #f1f5f9;
    color: #374151;
}

/* ── Lignes alternées ───────────────────────────────────── */
/*
 * Les couleurs sont injectées via un bloc <style> dynamique dans le widget PHP.
 * Les règles ci-dessous sont des fallbacks de base uniquement.
 * Le CSS dynamique utilise !important pour surpasser les couleurs de colonnes.
 */

/* ── Survol ─────────────────────────────────────────────── */
/*
 * Même principe : le CSS dynamique du widget injecte les règles hover avec !important.
 * La transition est définie dans le bloc CSS dynamique.
 */

/* ── Responsive ─────────────────────────────────────────── */

@media (max-width: 640px) {
    .sd-table-wrap--scroll {
        border-radius: 8px;
    }
    .sd-table td,
    .sd-table th {
        white-space: nowrap;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sd-logo-track {
        animation: none;
        flex-wrap: wrap;
        width: 100%;
        justify-content: center;
    }
    .sd-logo-dup {
        display: none;
    }
    .sd-logo-carousel--fade {
        -webkit-mask-image: none;
        mask-image: none;
    }
}
