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