: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-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 24px;
    text-align: center;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    cursor: pointer;
    z-index: 1;
}

.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;
    max-width: 34ch;
    line-height: 1.5;
}

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

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

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

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

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

.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;
}

.yt-card:hover .yt-play::before {
    opacity: 1;
}

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

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

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

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

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

    .yt-overlay {
        padding: 16px;
        gap: 8px;
    }

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

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

    .yt-note {
        font-size: .875rem;
        max-width: 28ch;
    }

    .yt-bottom-text {
        font-size: .825rem;
        max-width: 30ch;
    }
}

.yt-card.loading .yt-overlay {
    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-overlay {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: transparent;
    justify-content: flex-end;
    align-items: center;
    padding: 20px 24px;
    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 {
    position: absolute;
    bottom: 20px;
    left: 24px;
    top: auto;
    transform: none;
    width: 48px;
    height: 48px;
    border-radius: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.yt-style-vimeo .yt-play svg {
    width: 48px;
    height: 48px;
}

.yt-style-vimeo .yt-play .yt-play-bg {
    fill: transparent;
}

.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: transparent;
}

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

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

/* Texte d'impact centré pour Vimeo */
.yt-style-vimeo.yt-has-impact .yt-impact-text {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    bottom: auto;
}

/* =========================================
   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-overlay {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: transparent;
    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-overlay {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: transparent;
    padding-bottom: 15%;
}

.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-overlay {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: transparent;
    padding: 5%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0;
    opacity: 1;
    transition: opacity 0.3s ease;
}


/* 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 en bas au centre */
.yt-style-netflix .yt-bottom-text {
    position: absolute;
    bottom: 5%;
    left: 50%;
    transform: translateX(-50%);
    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 - Bas à gauche, cercle blanc semi-transparent */
.yt-style-netflix .yt-play {
    position: absolute;
    bottom: 5%;
    left: 5%;
    top: auto;
    transform: none;
    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 - Texte d'impact centré
   ========================================= */
.yt-style-netflix .yt-impact-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    bottom: auto;
    right: auto;
    text-align: center;
    font-size: 48px;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.5px;
    line-height: 1.1;
    text-transform: none;
    width: 500px;
    max-width: 80%;
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.5);
}

/* Override les classes de position pour Netflix */
.yt-style-netflix.yt-has-impact.yt-impact-top .yt-impact-text,
.yt-style-netflix.yt-has-impact.yt-impact-center .yt-impact-text,
.yt-style-netflix.yt-has-impact.yt-impact-bottom .yt-impact-text {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    bottom: auto;
}

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

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

    .yt-style-vimeo .yt-play {
        width: 36px;
        height: 36px;
        bottom: 16px;
        left: 20px;
    }

    .yt-style-vimeo .yt-play svg {
        width: 36px;
        height: 36px;
    }

    .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-overlay {
        padding: 4%;
    }

    /* Bouton Play centré au milieu */
    .yt-style-netflix .yt-play {
        left: 50% !important;
        right: auto !important;
        top: 67% !important;
        bottom: auto !important;
        transform: translate(-50%, -50%) !important;
        margin: 0 !important;
        width: 52px !important;
        height: 52px !important;
    }

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

    /* Texte de consentement en bas centré */
    .yt-style-netflix .yt-bottom-text {
        font-size: 12px;
        max-width: 90%;
        bottom: 4%;
        left: 50%;
        transform: translateX(-50%);
    }

    /* Texte d'impact en haut centré */
    .yt-style-netflix .yt-impact-text,
    .yt-style-netflix.yt-has-impact.yt-impact-top .yt-impact-text,
    .yt-style-netflix.yt-has-impact.yt-impact-center .yt-impact-text,
    .yt-style-netflix.yt-has-impact.yt-impact-bottom .yt-impact-text {
        font-size: 22px;
        width: 300px;
        max-width: none;
        top: 15%;
        left: 50%;
        transform: translateX(-50%);
    }

    /* 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
   ========================================= */
.yt-impact-text {
    position: absolute;
    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%;
    padding: 16px 24px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
    pointer-events: none;
}

/* Position: Haut */
.yt-impact-top .yt-impact-text {
    top: 8%;
    left: 50%;
    transform: translateX(-50%);
}

/* Position: Centre */
.yt-impact-center .yt-impact-text {
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
}

/* Position: Bas */
.yt-impact-bottom .yt-impact-text {
    bottom: 25%;
    left: 50%;
    transform: translateX(-50%);
}

/* Ajustement overlay quand texte d'impact présent */
.yt-has-impact.yt-impact-top .yt-overlay {
    justify-content: flex-end;
    padding-bottom: 10%;
}

.yt-has-impact.yt-impact-center .yt-overlay {
    justify-content: flex-end;
    padding-bottom: 8%;
}

.yt-has-impact.yt-impact-bottom .yt-overlay {
    justify-content: flex-end;
    padding-bottom: 5%;
}

/* Style spécifique pour Vimeo avec texte d'impact */
.yt-style-vimeo.yt-has-impact .yt-overlay {
    justify-content: flex-end;
    align-items: flex-start;
}

/* 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 {
        font-size: 22px;
        padding: 12px 16px;
        max-width: 95%;
    }
}

@media (max-width: 480px) {
    .yt-impact-text {
        font-size: 16px;
        padding: 8px 12px;
        letter-spacing: 0;
    }

    .yt-style-cinematic.yt-has-impact .yt-impact-text {
        letter-spacing: 1px;
    }
}