:root {
    --yt-bg: rgba(20, 20, 20, .45);
    --yt-card: rgba(250, 250, 252, .75);
    --yt-text: #0b0b0c;
    --yt-text-dim: #3b3b3f;
    --yt-ring: rgba(0, 0, 0, .08);
}

@media (prefers-color-scheme: dark) {
    :root {
        --yt-card: rgba(28, 28, 30, .62);
        --yt-text: #fafafc;
        --yt-text-dim: #c9c9cf;
        --yt-ring: rgba(255, 255, 255, .12);
    }
}

.yt-card {
    position: relative;
    overflow: hidden;
    border-radius: 20px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, .1), 0 2px 4px -1px rgba(0, 0, 0, .06);
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.yt-poster {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: saturate(.95) contrast(.98) brightness(.92);
}

.yt-card::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, .45), rgba(0, 0, 0, .05) 45%);
    pointer-events: none;
}

.yt-consent-container {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: 24px;
    padding: 24px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    cursor: pointer;
    z-index: 1;
}

/* Positionnement selon la position du texte d'impact */
.yt-impact-top .yt-consent-container {
    justify-content: flex-start;
}

.yt-impact-center .yt-consent-container {
    justify-content: center;
}

.yt-impact-bottom .yt-consent-container {
    justify-content: flex-end;
}

/* Zone du texte d'impact (en haut) */
.elementor-widget-yt-consent-embed .yt-impact-wrapper,
.yt-impact-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 1;
    flex-grow: 0;
    width: 100%;
    min-height: 0;
    overflow: hidden;
}

/* Zone des contrôles (bouton + messages, en bas) */
.elementor-widget-yt-consent-embed .yt-flex-wrapper,
.yt-flex-wrapper {
    display: flex !important;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 24px;
    width: 100%;
    flex-shrink: 1;
    flex-grow: 0;
    min-height: 0;
    overflow: hidden;
}

/* IMPORTANT : Retirer tous les positionnements absolus pour TOUS les styles */
.elementor-widget-yt-consent-embed .yt-play,
.yt-play {
    position: relative !important;
    top: auto !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    transform: none !important;
    margin: 0 !important;
    flex-shrink: 0;
}

/* Assurer que les messages restent dans le flux flexbox */
.elementor-widget-yt-consent-embed .yt-consent-messages,
.yt-consent-messages {
    position: relative !important;
    flex-shrink: 1;
}

.yt-consent-messages {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 8px;
    max-width: 400px;
}

.yt-chip {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--yt-card);
    color: var(--yt-text);
    font-weight: 600;
    font-size: 14px;
    letter-spacing: .2px;
    box-shadow: 0 1px 0 var(--yt-ring) inset;
}

.yt-note {
    margin: 0;
    color: var(--yt-text-dim);
    font-size: .95rem;
    line-height: 1.5;
    text-align: left;
}

.yt-bottom-text {
    margin: 0;
    color: var(--yt-text-dim);
    font-size: .9rem;
    line-height: 1.4;
    text-align: left;
}

.yt-play {
    appearance: none;
    border: none;
    background: transparent;
    cursor: pointer;
    position: relative;
    width: 84px;
    height: 84px;
    border-radius: 50%;
    outline-offset: 4px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.yt-play svg {
    width: 100%;
    height: 100%;
    display: block;
}

.yt-play svg circle {
    fill: white;
    fill-opacity: .9;
}

.yt-play svg polygon {
    fill: #ff2d55;
}

/* Empêcher les styles par défaut des boutons (type=button) */
button.yt-play[type="button"],
.yt-play[type="button"] {
    background: none;
    background-color: transparent;
}

.yt-play::before {
    content: "";
    position: absolute;
    inset: -12px;
    border-radius: inherit;
    background: radial-gradient(circle, var(--yt-ring), transparent 60%);
    opacity: 0;
    transition: opacity .25s ease;
}

/* Sélecteurs plus spécifiques pour écraser les styles Elementor */
.elementor-widget-yt-consent-embed .yt-card:hover .yt-play::before,
.yt-card:hover .yt-play::before {
    opacity: 1;
}

.elementor-widget-yt-consent-embed .yt-card:hover .yt-poster,
.yt-card:hover .yt-poster {
    transform: scale(1.02);
    transition: transform .5s cubic-bezier(.2, .8, .2, 1);
}

/* Hover et focus spécifiques pour le bouton play - écraser les styles par défaut Elementor */
.elementor-widget-yt-consent-embed .yt-card .yt-play:hover,
.elementor-widget-yt-consent-embed .yt-card .yt-play:focus,
.yt-card .yt-play:hover,
.yt-card .yt-play:focus,
button.yt-play:hover,
button.yt-play:focus {
    background: none;
    background-color: transparent;
    color: inherit;
    text-decoration: none;
    border: none;
}

/* Augmenter la spécificité pour surcharger [type=button]:hover d'Elementor (0,1,1) */
.elementor-widget-yt-consent-embed button.yt-play:hover,
.elementor-widget-yt-consent-embed button.yt-play:focus,
button.yt-play[type="button"]:hover,
button.yt-play[type="button"]:focus {
    background: none !important;
    background-color: transparent !important;
}

@media (prefers-reduced-motion: reduce) {
    .yt-card:hover .yt-poster,
    .yt-play::before {
        transition: none;
        transform: none;
    }
}

.yt-consent-container:focus-visible,
.yt-play:focus-visible {
    outline: 2px solid #0a84ff;
    outline-offset: 4px;
    border-radius: 16px;
}

.yt-consent-container:focus-visible .yt-play {
    outline: none;
}

@media (max-width: 640px) {
    .yt-card {
        border-radius: 12px;
        min-height: 300px;
    }

    .yt-consent-container {
        padding: 16px;
    }

    .yt-flex-wrapper {
        flex-direction: column;
        gap: 16px;
    }

    .yt-consent-messages {
        align-items: center;
        text-align: center;
        max-width: 100%;
    }

    .yt-consent-messages .yt-note,
    .yt-consent-messages .yt-bottom-text {
        text-align: center;
    }

    .yt-play {
        width: 68px;
        height: 68px;
    }

    .yt-chip {
        font-size: 13px;
    }

    .yt-note {
        font-size: .875rem;
    }

    .yt-bottom-text {
        font-size: .825rem;
    }
}

.yt-card.loading .yt-consent-container {
    pointer-events: none;
}

.yt-card.loading .yt-play svg polygon {
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: .5;
    }
}

/* Elementor specific styles */
.elementor .yt-card img {
    /* Remove height auto that Elementor adds */
    height: 100% !important;
}

.yt-card iframe {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

/* Solution moderne : cible le conteneur parent qui contient directement le widget */
.elementor .e-con:has(> .elementor-widget-yt-consent-embed) {
    min-height: 400px;
}

/* Solution de secours pour navigateurs sans :has() - force la hauteur sur le widget */
.elementor-widget-yt-consent-embed {
    min-height: 400px;
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Le conteneur interne prend toute la hauteur disponible */
.elementor-widget-yt-consent-embed .elementor-widget-container {
    flex-grow: 1;
}

/* =========================================
   STYLE: VIMEO - Épuré et haut de gamme
   ========================================= */
.yt-style-vimeo {
    border-radius: 8px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.yt-style-vimeo .yt-poster {
    filter: brightness(0.95);
    transition: filter 0.4s ease, transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.yt-style-vimeo:hover .yt-poster {
    filter: brightness(0.9);
    transform: scale(1.02);
}

.yt-style-vimeo::after {
    background: linear-gradient(to top, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0.1) 30%, transparent 50%);
}

.yt-style-vimeo .yt-consent-container {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: transparent;
    padding: 20px 24px;
}

.yt-style-vimeo .yt-flex-wrapper {
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
}

.yt-style-vimeo .yt-chip {
    display: none;
}

.yt-style-vimeo .yt-note {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.8rem;
    max-width: 50ch;
    line-height: 1.4;
    text-align: center;
    order: 1;
}

.yt-style-vimeo .yt-bottom-text {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.7rem;
    text-align: center;
    order: 2;
}

.yt-style-vimeo .yt-play {
    border-radius: 6px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.yt-style-vimeo .yt-play svg {
    width: 100%;
    height: 100%;
}

.yt-style-vimeo .yt-play .yt-play-bg {
    fill: rgba(255, 255, 255, 0);
    transition: fill 0.3s ease;
}

.yt-style-vimeo .yt-play .yt-play-icon {
    fill: #fff;
    transition: fill 0.3s ease;
}

.yt-style-vimeo:hover .yt-play {
    transform: scale(1.15);
}

.yt-style-vimeo:hover .yt-play .yt-play-bg {
    fill: #00adef;
}

.yt-style-vimeo:hover .yt-play .yt-play-icon {
    fill: #fff;
}

.yt-style-vimeo .yt-play::before {
    display: none;
}


/* =========================================
   STYLE: MINIMAL - Ultra sobre
   ========================================= */
.yt-style-minimal {
    border-radius: 4px;
    box-shadow: none;
}

.yt-style-minimal .yt-poster {
    filter: none;
    transition: transform 0.5s ease;
}

.yt-style-minimal:hover .yt-poster {
    transform: scale(1.02);
}

.yt-style-minimal::after {
    background: rgba(0, 0, 0, 0.25);
    transition: background 0.3s ease;
}

.yt-style-minimal:hover::after {
    background: rgba(0, 0, 0, 0.35);
}

.yt-style-minimal .yt-consent-container {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: transparent;
}

.yt-style-minimal .yt-flex-wrapper {
    flex-direction: column;
    justify-content: center;
    gap: 12px;
}

.yt-style-minimal .yt-chip {
    display: none;
}

.yt-style-minimal .yt-note {
    color: rgba(255, 255, 255, 0.95);
    font-size: 0.85rem;
    max-width: 38ch;
    line-height: 1.5;
    order: 2;
}

.yt-style-minimal .yt-bottom-text {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.75rem;
    order: 3;
}

.yt-style-minimal .yt-play {
    width: 64px;
    height: 64px;
    transition: transform 0.3s ease;
    order: 1;
}

.yt-style-minimal .yt-play svg {
    width: 64px;
    height: 64px;
}

.yt-style-minimal .yt-play .yt-play-ring {
    stroke: rgba(255, 255, 255, 0.9);
    transition: stroke 0.3s ease;
}

.yt-style-minimal .yt-play .yt-play-icon {
    fill: rgba(255, 255, 255, 0.95);
    transition: fill 0.3s ease;
}

.yt-style-minimal:hover .yt-play {
    transform: scale(1.1);
}

.yt-style-minimal:hover .yt-play .yt-play-ring {
    stroke: #fff;
}

.yt-style-minimal:hover .yt-play .yt-play-icon {
    fill: #fff;
}

.yt-style-minimal .yt-play::before {
    display: none;
}

/* =========================================
   STYLE: CINEMATIC - Dramatique
   ========================================= */
.yt-style-cinematic {
    border-radius: 0;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.yt-style-cinematic::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 12%;
    background: linear-gradient(to bottom, #000, transparent);
    z-index: 1;
    pointer-events: none;
}

.yt-style-cinematic::after {
    background: linear-gradient(to top, #000 0%, transparent 40%);
    height: 100%;
}

.yt-style-cinematic .yt-poster {
    filter: saturate(1.1) contrast(1.05);
    transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.yt-style-cinematic:hover .yt-poster {
    transform: scale(1.05);
}

.yt-style-cinematic .yt-consent-container {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: transparent;
    padding-bottom: 15%;
}

.yt-style-cinematic .yt-flex-wrapper {
    flex-direction: column;
}

.yt-style-cinematic .yt-chip {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    font-weight: 500;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-size: 11px;
    box-shadow: none;
}

.yt-style-cinematic .yt-note {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
    max-width: 40ch;
}

.yt-style-cinematic .yt-play {
    width: 80px;
    height: 80px;
    margin: 16px 0;
}

.yt-style-cinematic .yt-play svg {
    width: 80px;
    height: 80px;
}

.yt-style-cinematic .yt-play .yt-play-glow {
    fill: rgba(255, 255, 255, 0.05);
    transition: fill 0.4s ease;
}

.yt-style-cinematic .yt-play .yt-play-bg {
    fill: rgba(255, 255, 255, 0.15);
    transition: fill 0.4s ease;
}

.yt-style-cinematic .yt-play .yt-play-icon {
    fill: #fff;
}

.yt-style-cinematic:hover .yt-play .yt-play-glow {
    fill: rgba(229, 9, 20, 0.3);
}

.yt-style-cinematic:hover .yt-play .yt-play-bg {
    fill: #e50914;
}

.yt-style-cinematic .yt-play::before {
    display: none;
}

/* =========================================
   STYLE: NETFLIX - Premium streaming experience
   Inspired by Netflix player interface
   ========================================= */
.yt-style-netflix {
    border-radius: 0;
    box-shadow: none;
    font-family: 'Inter', 'Roboto', 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.yt-style-netflix .yt-poster {
    filter: brightness(0.95) saturate(1.05);
    transition: filter 0.4s ease, transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.yt-style-netflix:hover .yt-poster {
    filter: brightness(0.9) saturate(1.1);
    transform: scale(1.02);
}

.yt-style-netflix.loading .yt-poster {
    filter: none;
}

/* Dégradé sombre du bas vers le haut pour lisibilité */
.yt-style-netflix::after {
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.8) 0%,
        rgba(0, 0, 0, 0.4) 25%,
        rgba(0, 0, 0, 0) 50%
    );
    transition: opacity 0.4s ease;
}

.yt-style-netflix.loading::after {
    opacity: 0;
}

/* Overlay principal - Layout flexible */
.yt-style-netflix .yt-consent-container {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: transparent;
    padding: 5%;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.yt-style-netflix .yt-flex-wrapper {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0;
}


/* Masquer le chip/titre */
.yt-style-netflix .yt-chip {
    display: none;
}

/* Message de consentement - masqué par défaut, repositionné */
.yt-style-netflix .yt-note {
    display: none;
}

/* Texte de consentement */
.yt-style-netflix .yt-bottom-text {
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    font-weight: 400;
    text-align: center;
    max-width: 80%;
    line-height: 1.4;
    margin: 0;
    transition: opacity 0.3s ease;
}

/* Bouton Play - Cercle blanc semi-transparent */
.yt-style-netflix .yt-play {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    transition: all 0.3s ease;
    background: transparent;
}

.yt-style-netflix .yt-play svg {
    width: 72px;
    height: 72px;
}

/* Cercle blanc opaque */
.yt-style-netflix .yt-play .yt-play-bg {
    fill: rgba(255, 255, 255, 0.95);
    transition: all 0.3s ease;
}

/* Triangle play gris */
.yt-style-netflix .yt-play .yt-play-icon {
    fill: #555;
    transition: all 0.3s ease;
}

/* Hover sur le bouton play */
.yt-style-netflix:hover .yt-play {
    transform: scale(1.05);
}

.yt-style-netflix:hover .yt-play .yt-play-bg {
    fill: #fff;
}

.yt-style-netflix:hover .yt-play .yt-play-icon {
    fill: #333;
}

.yt-style-netflix .yt-play::before {
    display: none;
}

/* =========================================
   NETFLIX - Style du texte d'impact
   ========================================= */
.yt-style-netflix .yt-impact-text {
    text-align: center;
    font-size: 48px;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.5px;
    line-height: 1.1;
    text-transform: none;
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.5);
}

.yt-style-netflix.yt-has-impact .yt-consent-container {
    padding: 5%;
}

/* =========================================
   RESPONSIVE ADJUSTMENTS
   ========================================= */
@media (max-width: 640px) {
    /* Vimeo mobile */
    .yt-style-vimeo .yt-consent-container {
        padding: 16px 20px;
    }

    .yt-style-vimeo .yt-flex-wrapper {
        flex-direction: column;
    }

    .yt-style-vimeo .yt-play svg {
        width: 100%;
        height: 100%;
    }

    .yt-style-vimeo .yt-note {
        font-size: 0.7rem;
        max-width: 40ch;
    }

    .yt-style-vimeo .yt-bottom-text {
        font-size: 0.65rem;
    }

    /* Minimal mobile */
    .yt-style-minimal .yt-play,
    .yt-style-minimal .yt-play svg {
        width: 52px;
        height: 52px;
    }

    .yt-style-minimal .yt-note {
        font-size: 0.8rem;
        max-width: 30ch;
    }

    /* Cinematic mobile */
    .yt-style-cinematic .yt-play,
    .yt-style-cinematic .yt-play svg {
        width: 64px;
        height: 64px;
    }

    .yt-style-cinematic .yt-chip {
        font-size: 10px;
        letter-spacing: 1.5px;
    }

    .yt-style-cinematic .yt-note {
        font-size: 0.8rem;
    }

    /* Netflix mobile - Layout vertical centré */
    .yt-style-netflix .yt-consent-container {
        padding: 4%;
    }

    .yt-style-netflix .yt-flex-wrapper {
        flex-direction: column;
    }

    /* Bouton Play plus petit sur mobile */
    .yt-style-netflix .yt-play {
        width: 52px !important;
        height: 52px !important;
    }

    .yt-style-netflix .yt-play svg {
        width: 52px !important;
        height: 52px !important;
    }

    /* Texte de consentement plus petit sur mobile */
    .yt-style-netflix .yt-bottom-text {
        font-size: 12px;
        max-width: 90%;
    }

    /* Texte d'impact responsive Netflix */
    .yt-style-netflix .yt-impact-text {
        font-size: 22px;
    }

    /* Retirer min-height sur mobile */
    .elementor .e-con:has(> .elementor-widget-yt-consent-embed) {
        min-height: auto;
    }

    .elementor-widget-yt-consent-embed {
        min-height: auto;
    }
}

/* =========================================
   NETFLIX - Tablet adjustments
   ========================================= */
@media (min-width: 641px) and (max-width: 1024px) {
    .yt-style-netflix .yt-impact-text {
        font-size: 36px;
    }

    .yt-style-netflix .yt-play,
    .yt-style-netflix .yt-play svg {
        width: 60px;
        height: 60px;
    }

    .yt-style-netflix .yt-bottom-text {
        font-size: 11px;
    }
}

/* =========================================
   IMPACT TEXT - Texte d'accroche
   ========================================= */
.elementor-widget-yt-consent-embed .yt-card .yt-impact-text,
.yt-impact-text {
    position: relative !important;
    z-index: 2;
    color: #fff;
    font-size: 32px;
    font-weight: 800;
    line-height: 1.15;
    text-transform: uppercase;
    letter-spacing: -0.5px;
    text-align: center;
    max-width: 90%;
    width: auto !important;
    padding: 16px 24px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
    pointer-events: none;
    margin: 0 auto;
}

/* La position est gérée par le conteneur principal via justify-content */

/* Style spécifique pour Cinematic avec texte d'impact */
.yt-style-cinematic.yt-has-impact .yt-impact-text {
    letter-spacing: 3px;
    font-weight: 700;
}

/* Responsive Impact Text */
@media (max-width: 768px) {
    .yt-impact-text {
        padding: 12px 16px;
        max-width: 95%;
    }
}

@media (max-width: 480px) {
    .yt-impact-text {
        padding: 8px 12px;
    }
}