/* ========================================================
   Apple Team Widget - Styles
   Design inspiré iOS pour Elementor
   ======================================================== */

/* Container principal */
.apple-team-widget {
    position: relative;
    width: 100%;
}

/* Grille de base */
.apple-team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, max-content));
    gap: 30px;
    padding: 10px;
    justify-content: center;
}

/* Colonnes responsive - grille auto-ajustable */
.apple-team-grid[data-columns="1"] { grid-template-columns: repeat(1, minmax(0, max-content)); }
.apple-team-grid[data-columns="2"] { grid-template-columns: repeat(2, minmax(0, max-content)); }
.apple-team-grid[data-columns="3"] { grid-template-columns: repeat(3, minmax(0, max-content)); }
.apple-team-grid[data-columns="4"] { grid-template-columns: repeat(4, minmax(0, max-content)); }
.apple-team-grid[data-columns="5"] { grid-template-columns: repeat(5, minmax(0, max-content)); }
.apple-team-grid[data-columns="6"] { grid-template-columns: repeat(6, minmax(0, max-content)); }
.apple-team-grid[data-columns="auto"] { grid-template-columns: repeat(auto-fit, minmax(150px, max-content)); }

/* Carte individuelle */
.apple-team-card {
    position: relative;
    cursor: pointer;
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    --rotation: 1.5deg;
    padding-bottom: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: max-content;
    margin: 0 auto;
}

.apple-team-card a {
    text-decoration: none;
    color: inherit;
    display: block;
}

/* Container de l'image */
.apple-image-wrapper {
    position: relative;
    overflow: hidden;
    border-radius: 24px;
    background: #ffffff;
    transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform;
    margin: 0 auto;
}

.apple-image-wrapper img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    aspect-ratio: 4/5;
    transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ========================================================
   Effets de survol
   ======================================================== */

.apple-team-card:hover .apple-image-wrapper {
    transform: scale(1.05) rotate(var(--rotation)) translateY(-8px);
    box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.12),
        0 30px 60px rgba(0, 0, 0, 0.08);
    margin-bottom: 8px;
}

.apple-team-card:hover .apple-image-wrapper img {
    transform: scale(1.1);
}

/* ========================================================
   Informations texte - Version sous l'image
   ======================================================== */

.apple-member-info {
    padding: 24px 8px 8px;
    text-align: center;
    opacity: 0;
    transform: translateY(-12px) scale(0.96);
    transition: background .3s, border .3s, border-radius .3s, box-shadow .3s, transform .4s, opacity .4s;
    transition-delay: 0.1s;
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: var(--image-width, 100%);
    pointer-events: none;
}

.apple-team-card:hover .apple-member-info {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.apple-member-name {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue', sans-serif;
    font-size: 19px;
    font-weight: 600;
    color: #1d1d1f;
    margin: 0 0 6px 0;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.apple-member-position {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', sans-serif;
    font-size: 15px;
    font-weight: 400;
    color: #86868b;
    margin: 0;
    letter-spacing: -0.01em;
    line-height: 1.3;
}

/* ========================================================
   Version Overlay
   ======================================================== */

.apple-overlay .apple-overlay-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 28px 24px 24px;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.85) 0%,
        rgba(0, 0, 0, 0.5) 50%,
        transparent 100%
    );
    border-radius: 0 0 24px 24px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.apple-overlay:hover .apple-overlay-info {
    opacity: 1;
    transform: translateY(0);
}

.apple-overlay-info .apple-member-name {
    color: #ffffff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.apple-overlay-info .apple-member-position {
    color: rgba(255, 255, 255, 0.9);
}

/* ========================================================
   Effet de brillance
   ======================================================== */

.apple-shine .apple-image-wrapper::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(255, 255, 255, 0.1) 50%,
        transparent 70%
    );
    transform: rotate(45deg) translateX(-100%);
    transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
    z-index: 1;
}

.apple-shine:hover .apple-image-wrapper::before {
    transform: rotate(45deg) translateX(100%);
}

/* ========================================================
   Effet Focus
   ======================================================== */

.apple-focus-container:has(.apple-team-card:hover) .apple-team-card:not(:hover) {
    opacity: 0.6;
    filter: blur(2px);
    transform: scale(0.95);
}

/* ========================================================
   Tablette (768px - 1024px)
   ======================================================== */

@media (max-width: 1024px) and (min-width: 769px) {
    /* Transformation en carrousel horizontal sur tablette */
    .apple-team-grid {
        display: flex !important;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: visible;
        -webkit-overflow-scrolling: touch;
        scroll-behavior: auto;
        gap: 2px;
        padding: 40px 20px;
        margin: 0;
        /* Masquer la scrollbar */
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .apple-team-grid::-webkit-scrollbar {
        display: none;
    }

    /* Cartes en mode carrousel */
    .apple-team-grid .apple-team-card {
        flex: 0 0 auto;
        width: 280px;
        transition: filter 0.3s ease, opacity 0.3s ease;
    }

    /* Marges pour le début et fin */
    .apple-team-grid .apple-team-card:first-child {
        margin-left: 40px;
    }

    .apple-team-grid .apple-team-card:last-child {
        margin-right: 40px;
    }

    /* Infos toujours visibles sur tablette */
    .apple-member-info {
        opacity: 1;
        transform: translateY(0) scale(1);
        pointer-events: auto;
    }

    .apple-member-name {
        font-size: 18px;
    }

    .apple-member-position {
        font-size: 14px;
    }

    /* Effet de flou progressif basé sur la visibilité */
    .apple-team-card {
        transition: filter 0.2s ease, opacity 0.2s ease;
    }
}

/* ========================================================
   Mobile - Carrousel horizontal
   ======================================================== */

@media (max-width: 768px) {
    /* Transformation en carrousel fluide */
    .apple-team-grid {
        display: flex !important;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: visible;
        -webkit-overflow-scrolling: touch;
        scroll-behavior: auto;
        gap: 2px;
        padding: 30px 0;
        margin: 0;
        justify-content: flex-start !important; /* Forcer alignement à gauche */
        align-items: center;
        /* Masquer la scrollbar */
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .apple-team-grid::-webkit-scrollbar {
        display: none;
    }

    /* Cartes en mode carrousel */
    .apple-team-grid .apple-team-card {
        flex: 0 0 auto;
        width: 16em;
        margin: 0 !important; /* Enlever le centrage auto */
        transition: filter 0.3s ease, opacity 0.3s ease;
    }

    /* Centrage de la première carte sur mobile */
    .apple-team-grid .apple-team-card:first-child {
        margin-left: calc(1850px - 128px); /* Centrage de la première carte */
    }

    .apple-team-grid .apple-team-card:last-child {
        margin-right: calc(1850px - 128px);
    }
    
    /* Effet de flou progressif basé sur la visibilité sur mobile */
    .apple-team-card {
        transition: filter 0.2s ease, opacity 0.2s ease;
    }
    
    /* Ajustements visuels */
    .apple-image-wrapper {
        border-radius: 20px;
    }
    
    .apple-image-wrapper img {
        border-radius: 20px;
        aspect-ratio: 3/4;
    }
    
    /* Infos toujours visibles sur mobile */
    .apple-member-info {
        opacity: 1;
        transform: translateY(0) scale(1);
        pointer-events: auto;
    }
    
    /* Effet hover réduit sur mobile */
    .apple-team-card:hover .apple-image-wrapper {
        transform: scale(1.02) rotate(0.5deg);
    }
    
    .apple-team-card:hover .apple-image-wrapper img {
        transform: scale(1.05);
    }
    
    /* Focus effect désactivé */
    .apple-focus-container:hover .apple-team-card:not(:hover) {
        opacity: 1;
        filter: none;
        transform: none;
    }
    
    .apple-member-name {
        font-size: 17px;
    }
    
    .apple-member-position {
        font-size: 14px;
    }
}

/* Très petits écrans */
@media (max-width: 480px) {
    .apple-team-grid .apple-team-card {
        width: 14em;
    }

    .apple-team-grid .apple-team-card:first-child {
        margin-left: calc(1850px - 112px); /* Centrage adapté aux petits écrans */
    }

    .apple-team-grid .apple-team-card:last-child {
        margin-right: calc(1850px - 112px);
    }
}


/* ========================================================
   Animations d'entrée
   ======================================================== */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.apple-team-card {
    animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.apple-team-card:nth-child(1) { animation-delay: 0.1s; }
.apple-team-card:nth-child(2) { animation-delay: 0.2s; }
.apple-team-card:nth-child(3) { animation-delay: 0.3s; }
.apple-team-card:nth-child(4) { animation-delay: 0.4s; }
.apple-team-card:nth-child(5) { animation-delay: 0.5s; }
.apple-team-card:nth-child(6) { animation-delay: 0.6s; }
.apple-team-card:nth-child(7) { animation-delay: 0.7s; }
.apple-team-card:nth-child(8) { animation-delay: 0.8s; }

/* ========================================================
   Effet cartes photo empilées
   ======================================================== */

.apple-team-stacked-layout {
    --card-r: 18px;
    --bg: #F4E5D6;
    --shadow: 0 14px 34px rgba(0,0,0,.18);
    --hover-scale: 1.06;
}

.apple-team-faces {
    --card-w: 220px;
    --overlap: -24px;
    --rotation-intensity: 3;
    display: flex;
    align-items: flex-end;
    perspective: 1200px;
    padding: 50px;
    justify-content: center;
    flex-wrap: nowrap;
    overflow-x: auto;
}

.apple-stacked-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-left: var(--overlap, -24px);
    position: relative;
}

.apple-stacked-container:first-child {
    margin-left: 0;
}

.apple-stacked-card {
    position: relative;
    width: var(--card-w, 220px);
    aspect-ratio: 3/4;
    border-radius: var(--card-r);
    background: var(--bg);
    box-shadow: var(--shadow);
    overflow: hidden;
    transform-origin: var(--transform-origin-x, 50%) var(--transform-origin-y, 85%);
    transition: transform .35s ease, box-shadow .35s ease, z-index .35s;
    cursor: pointer;
    flex-shrink: 0;
}

.apple-stacked-card img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
}

.apple-stacked-card::after {
    content: "";
    position: absolute;
    left: 10%;
    right: 10%;
    bottom: -8%;
    height: 14%;
    border-radius: 50%;
    background: radial-gradient(ellipse at center,
                rgba(0, 0, 0, 0.22) 0%,
                rgba(0, 0, 0, 0) 70%);
    filter: blur(8px);
    transform: scaleY(.35);
    pointer-events: none;
}

.apple-stacked-container:nth-child(1) .apple-stacked-card {
    transform: rotate(calc(-1deg * var(--rotation-intensity))) translateY(6px) rotateY(calc(-0.66deg * var(--rotation-intensity)));
}
.apple-stacked-container:nth-child(1) {
    z-index: 1;
}
.apple-stacked-container:nth-child(2) .apple-stacked-card {
    transform: rotate(calc(-0.33deg * var(--rotation-intensity))) translateY(2px) rotateY(calc(-0.33deg * var(--rotation-intensity)));
}
.apple-stacked-container:nth-child(2) {
    z-index: 2;
}
.apple-stacked-container:nth-child(3) .apple-stacked-card {
    transform: rotate(calc(0.33deg * var(--rotation-intensity))) translateY(0) rotateY(calc(0.33deg * var(--rotation-intensity)));
}
.apple-stacked-container:nth-child(3) {
    z-index: 3;
}
.apple-stacked-container:nth-child(4) .apple-stacked-card {
    transform: rotate(calc(0.17deg * var(--rotation-intensity))) translateY(4px) rotateY(calc(0.66deg * var(--rotation-intensity)));
}
.apple-stacked-container:nth-child(4) {
    z-index: 4;
}
.apple-stacked-container:nth-child(5) .apple-stacked-card {
    transform: rotate(calc(-0.5deg * var(--rotation-intensity))) translateY(2px) rotateY(calc(-0.33deg * var(--rotation-intensity)));
}
.apple-stacked-container:nth-child(5) {
    z-index: 5;
}
.apple-stacked-container:nth-child(6) .apple-stacked-card {
    transform: rotate(calc(0.5deg * var(--rotation-intensity))) translateY(5px) rotateY(calc(0.33deg * var(--rotation-intensity)));
}
.apple-stacked-container:nth-child(6) {
    z-index: 6;
}
.apple-stacked-container:nth-child(n+7) .apple-stacked-card {
    transform: rotate(calc(0.66deg * var(--rotation-intensity))) translateY(3px) rotateY(calc(0.5deg * var(--rotation-intensity)));
}
.apple-stacked-container:nth-child(n+7) {
    z-index: 7;
}

.apple-stacked-container:hover .apple-stacked-card {
    transform: translateY(-6px) rotate(0deg) rotateY(0deg) scale(var(--hover-scale));
    box-shadow: 0 18px 42px rgba(0,0,0,.24);
}

.apple-stacked-container:hover {
    z-index: 10;
}

.apple-stacked-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0;
    background: transparent;
    opacity: 0;
    transition: all .3s ease;
    pointer-events: none;
}

.apple-stacked-caption .apple-overlay-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 28px 24px 24px;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.85) 0%,
        rgba(0, 0, 0, 0.5) 50%,
        transparent 100%
    );
    border-radius: 0 0 var(--card-r) var(--card-r);
    transform: translateY(20px);
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.apple-stacked-caption .apple-overlay-info .apple-member-name {
    color: #ffffff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    font-size: 16px;
    margin: 0 0 4px 0;
}

.apple-stacked-caption .apple-overlay-info .apple-member-position {
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    margin: 0;
}

.apple-stacked-card:hover .apple-stacked-caption {
    opacity: 1;
}

.apple-stacked-card:hover .apple-stacked-caption .apple-overlay-info {
    transform: translateY(0);
}

/* Texte sous les cartes empilées individuelles */
.apple-stacked-container .apple-member-info {
    padding: 24px 8px 8px;
    text-align: center;
    opacity: 0;
    transform: translateY(-12px) scale(0.96);
    transition: background .3s, border .3s, border-radius .3s, box-shadow .3s, transform .4s, opacity .4s;
    transition-delay: 0.1s;
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: var(--card-w, 220px);
    pointer-events: none;
}

.apple-stacked-container:hover .apple-member-info {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Preset transform origins */
.apple-team-stacked-layout[data-transform-origin="0% 0%"] .apple-stacked-card {
    transform-origin: 0% 0%;
}
.apple-team-stacked-layout[data-transform-origin="50% 0%"] .apple-stacked-card {
    transform-origin: 50% 0%;
}
.apple-team-stacked-layout[data-transform-origin="100% 0%"] .apple-stacked-card {
    transform-origin: 100% 0%;
}
.apple-team-stacked-layout[data-transform-origin="0% 50%"] .apple-stacked-card {
    transform-origin: 0% 50%;
}
.apple-team-stacked-layout[data-transform-origin="50% 50%"] .apple-stacked-card {
    transform-origin: 50% 50%;
}
.apple-team-stacked-layout[data-transform-origin="100% 50%"] .apple-stacked-card {
    transform-origin: 100% 50%;
}
.apple-team-stacked-layout[data-transform-origin="0% 100%"] .apple-stacked-card {
    transform-origin: 0% 100%;
}
.apple-team-stacked-layout[data-transform-origin="50% 100%"] .apple-stacked-card {
    transform-origin: 50% 100%;
}
.apple-team-stacked-layout[data-transform-origin="100% 100%"] .apple-stacked-card {
    transform-origin: 100% 100%;
}
.apple-team-stacked-layout[data-transform-origin="50% 85%"] .apple-stacked-card {
    transform-origin: 50% 85%;
}

/* Focus automatique pour cartes empilées sur mobile/tablette */
@media (max-width: 1024px) {
    .apple-stacked-container {
        transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .apple-stacked-container .apple-stacked-card {
        transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s ease;
    }

    .apple-stacked-container .apple-member-info {
        transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    }

    /* Désactiver l'effet hover sur mobile pour éviter les conflits */
    .apple-stacked-container:hover .apple-stacked-card {
        transform: none;
        box-shadow: var(--shadow);
    }

    .apple-stacked-container:hover {
        z-index: initial;
    }

    .apple-stacked-container:hover .apple-member-info {
        opacity: 0;
        transform: translateY(-12px) scale(0.96);
    }
}

/* Responsive pour cartes empilées */
@media (max-width: 900px) {
    .apple-team-faces {
        --card-w: 180px;
        --overlap: -18px;
    }
}

@media (max-width: 640px) {
    .apple-team-faces {
        overflow-x: auto;
        gap: 16px;
        justify-content: flex-start;
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .apple-team-faces::-webkit-scrollbar {
        display: none;
    }

    .apple-stacked-container {
        margin-left: 0;
        flex: 0 0 auto;
    }

    .apple-stacked-container:not(:first-child) {
        margin-left: 16px;
    }

    .apple-stacked-container .apple-member-info {
        padding: 12px 8px 8px;
    }
}

/* ========================================================
   Support du mode sombre (optionnel)
   ======================================================== */

@media (prefers-color-scheme: dark) {
    .elementor-editor-active .apple-team-widget {
        /* Désactivé dans l'éditeur Elementor */
    }

    body:not(.elementor-editor-active) .apple-member-name {
        color: #f5f5f7;
    }

    body:not(.elementor-editor-active) .apple-member-position {
        color: #a1a1a6;
    }

    body:not(.elementor-editor-active) .apple-scroll-dot {
        background: #48484a;
    }

    body:not(.elementor-editor-active) .apple-scroll-dot.active {
        background: #f5f5f7;
    }

    body:not(.elementor-editor-active) .apple-stacked-caption {
        background: #1d1d1f;
        color: #f5f5f7;
    }
}

/* ========================================================
   Popup Apple Style
   ======================================================== */

.apple-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.apple-popup-overlay.active {
    opacity: 1;
    visibility: visible;
}

.apple-popup-container {
    position: relative;
    max-width: 950px;
    width: 90%;
    max-height: 90vh;
    margin: 20px;
    transform: scale(0.8) translateY(40px);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.apple-popup-overlay.active .apple-popup-container {
    transform: scale(1) translateY(0);
}

.apple-popup-content {
    background: #FAFBFA;
    border-radius: 24px;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.15),
        0 40px 120px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

.apple-popup-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    color: #1d1d1f;
}

.apple-popup-close svg,
.apple-popup-close path {
    pointer-events: none;
}

.apple-popup-close:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.apple-popup-body {
    display: flex;
    align-items: stretch;
    min-height: 400px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.apple-popup-left {
    flex: 0 0 300px;
    max-width: 300px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.apple-popup-image {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
}

.apple-popup-member-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.apple-popup-details {
    flex: 1;
    padding: 20px 40px 40px 40px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 20px;
    overflow-y: auto;
}

.apple-popup-name {
    font-size: 32px;
    font-weight: 700;
    color: #527068;
    margin: 0;
    line-height: 1.2;
}

.apple-popup-position {
    font-size: 18px;
    font-weight: 500;
    color: #86868b;
    margin: 0;
    line-height: 1.3;
}

.apple-popup-description {
    font-size: 16px;
    line-height: 1.6;
    color: #333333;
    margin: 0;
    text-align: justify;
}

.apple-popup-email {
    font-size: 14px;
    color: #86868b;
    text-align: center;
    padding: 8px 12px;
    background: rgba(134, 134, 139, 0.1);
    border-radius: 8px;
}

.apple-popup-youtube-container {
    height: 100%;
}

.apple-popup-youtube {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 300px;
    aspect-ratio: 16/9;
    border-radius: 25px;
    overflow: hidden;
    background: #f0f0f0;
}

/* Styles pour le widget YouTube RGPD dans la popup */
.apple-popup-youtube .yt-card {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 25px;
    overflow: hidden;
    background: #000;
}

.apple-popup-youtube .yt-poster {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 25px;
}

.apple-popup-youtube .yt-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 25px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.apple-popup-youtube .yt-overlay:hover {
    background: rgba(0, 0, 0, 0.8);
}

.apple-popup-youtube .yt-chip {
    background: #BD977E;
    color: white;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
}

.apple-popup-youtube .yt-note {
    color: white;
    font-size: 16px;
    margin: 10px 20px;
    text-align: center;
}

.apple-popup-youtube .yt-play {
    width: 68px;
    height: 68px;
    background: transparent;
    border: none;
    cursor: pointer;
    margin: 20px 0;
    transition: transform 0.3s ease;
}

.apple-popup-youtube .yt-play:hover {
    transform: scale(1.1);
}

.apple-popup-youtube .yt-play svg {
    width: 100%;
    height: 100%;
}

.apple-popup-youtube .yt-play circle {
    fill: rgba(255, 255, 255, 0.95);
}

.apple-popup-youtube .yt-play polygon {
    fill: #1a1a1a;
}

.apple-popup-youtube .yt-bottom-text {
    color: rgba(255, 255, 255, 0.8);
    font-size: 12px;
    margin: 10px 20px 0;
    text-align: center;
}

.apple-popup-youtube iframe {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 25px;
}

.apple-popup-button {
    background-color: #BD977E;
    color: #ffffff;
    border: none;
    font-family: "Raleway", Sans-serif;
    font-size: 18px;
    font-weight: 600;
    transition-duration: 1s;
    border-radius: 20px;
    padding: 20px 30px;
    cursor: pointer;
    align-self: flex-start;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.apple-popup-button:hover {
    background-color: #4A968D;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Responsive pour tablettes */
@media (max-width: 1024px) and (min-width: 769px) {
    .apple-popup-overlay {
        align-items: center;
        justify-content: center;
        padding: 20px;
    }

    .apple-popup-container {
        max-width: 750px;
        width: 90%;
        max-height: 90vh;
        overflow: hidden;
    }

    .apple-popup-content {
        border-radius: 20px;
        max-height: 90vh;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

    .apple-popup-body {
        flex-direction: column;
        max-height: none;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 20px;
    }

    .apple-popup-left {
        flex: 0 0 auto;
        display: flex;
        flex-direction: row;
        gap: 20px;
        padding: 0;
        max-width: 100%;
    }

    .apple-popup-image {
        width: 200px;
        height: 250px;
        border-radius: 14px;
        flex-shrink: 0;
    }

    .apple-popup-member-image {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .apple-popup-youtube-container {
        flex: 1;
        min-width: 0;
    }

    .apple-popup-youtube {
        width: 100%;
        min-height: 250px;
        aspect-ratio: 16/9;
        border-radius: 14px;
    }

    .apple-popup-details {
        flex: none;
        padding: 20px 0 0;
        display: flex;
        flex-direction: column;
        gap: 16px;
    }

    .apple-popup-name {
        font-size: 26px;
        font-weight: 600;
    }

    .apple-popup-position {
        font-size: 16px;
    }

    .apple-popup-description {
        font-size: 15px;
        line-height: 1.55;
    }

    .apple-popup-email {
        font-size: 13px;
        padding: 8px 12px;
        border-radius: 10px;
        background: rgba(134, 134, 139, 0.1);
        text-align: center;
        align-self: center;
        max-width: 100%;
    }

    .apple-popup-button {
        font-size: 16px;
        padding: 14px 24px;
        border-radius: 14px;
    }

    .apple-popup-close {
        top: 16px;
        right: 16px;
        width: 44px;
        height: 44px;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(20px);
    }

    .apple-popup-close:hover {
        transform: scale(1.08);
    }
}

/* Responsive pour mobile - Style iOS Sheet */
@media (max-width: 768px) {
    .apple-popup-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .apple-popup-container {
        width: 100%;
        max-width: 100%;
        max-height: 92vh;
        margin: 0;
        transform: translateY(100%);
    }

    .apple-popup-overlay.active .apple-popup-container {
        transform: translateY(0);
    }

    .apple-popup-content {
        border-radius: 20px 20px 0 0;
        background: #ffffff;
        max-height: 92vh;
        display: flex;
        flex-direction: column;
    }

    /* Barre de handle iOS */
    .apple-popup-content::before {
        content: '';
        position: absolute;
        top: 8px;
        left: 50%;
        transform: translateX(-50%);
        width: 36px;
        height: 5px;
        background: rgba(0, 0, 0, 0.3);
        border-radius: 100px;
        z-index: 1;
    }

    .apple-popup-body {
        flex-direction: column;
        min-height: auto;
        max-height: calc(92vh - 40px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding-top: 20px;
    }

    /* Conteneur principal pour photo et infos */
    .apple-popup-header-section {
        display: flex;
        gap: 16px;
        padding: 0 20px;
        margin-bottom: 16px;
    }

    /* Conteneur pour la photo seule */
    .apple-popup-photo-section {
        flex: 0 0 120px;
    }

    /* Image */
    .apple-popup-image {
        width: 120px;
        height: 150px;
        border-radius: 12px;
        overflow: hidden;
    }

    .apple-popup-member-image {
        width: 100%;
        height: 100%;
        object-fit: cover;
        aspect-ratio: auto;
    }

    /* Conteneur pour nom, fonction et email */
    .apple-popup-name-section {
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 8px;
    }

    /* Email dans la section nom */
    .apple-popup-name-section .apple-popup-email {
        font-size: 12px;
        padding: 6px 8px;
        border-radius: 8px;
        background: #f2f2f7;
        text-align: center;
        margin: 0;
        align-self: flex-start;
        max-width: 100%;
        word-break: break-all;
    }

    /* Styles pour nom et fonction dans la section header */
    .apple-popup-header-section .apple-popup-name {
        font-size: 20px;
        font-weight: 600;
        margin: 0;
        color: #527068;
    }

    .apple-popup-header-section .apple-popup-position {
        font-size: 14px;
        color: #6e6e73;
        margin: 0;
    }

    /* On cache l'ancienne structure */
    .apple-popup-left {
        display: none;
    }

    /* Vidéo YouTube en pleine largeur après le contenu */
    .apple-popup-youtube-container {
        width: calc(100% + 40px);
        margin: 20px -20px 0;
        padding: 0 20px;
        order: 10;
    }

    .apple-popup-youtube {
        width: 100%;
        min-height: 300px;
        aspect-ratio: 16/9;
        border-radius: 12px;
    }

    .apple-popup-youtube .yt-card {
        border-radius: 12px;
        aspect-ratio: 16/9;
    }

    .apple-popup-youtube .yt-poster {
        border-radius: 12px;
    }

    .apple-popup-youtube .yt-overlay {
        border-radius: 12px;
    }

    .apple-popup-youtube iframe {
        border-radius: 12px;
    }

    /* Ajustements pour les contrôles YouTube */
    .apple-popup-youtube .yt-chip {
        padding: 6px 14px;
        font-size: 12px;
    }

    .apple-popup-youtube .yt-note {
        font-size: 13px;
        margin: 8px 15px;
    }

    .apple-popup-youtube .yt-play {
        width: 56px;
        height: 56px;
        margin: 16px 0;
    }

    .apple-popup-youtube .yt-bottom-text {
        font-size: 11px;
        margin: 8px 15px 0;
    }

    .apple-popup-details {
        padding: 0 20px 20px;
        gap: 12px;
        flex: none;
    }

    /* On cache nom et fonction dans details car ils sont dans header-section */
    .apple-popup-details .apple-popup-name,
    .apple-popup-details .apple-popup-position {
        display: none;
    }

    .apple-popup-description {
        font-size: 15px;
        line-height: 1.5;
        color: #1d1d1f;
        text-align: justify;
        margin-bottom: 12px;
    }

    .apple-popup-email {
        font-size: 14px;
        padding: 10px;
        border-radius: 12px;
        background: #f2f2f7;
    }

    .apple-popup-button {
        font-size: 16px;
        padding: 14px 20px;
        border-radius: 12px;
        width: 100%;
        text-align: center;
        margin-top: 8px;
    }

    .apple-popup-close {
        position: fixed;
        top: auto;
        bottom: 20px;
        right: 20px;
        width: 56px;
        height: 56px;
        background: #007AFF;
        backdrop-filter: none;
        box-shadow: 0 4px 20px rgba(0, 122, 255, 0.3);
    }

    .apple-popup-close svg {
        color: white;
    }

    .apple-popup-close:hover {
        transform: scale(1.05);
        background: #0051D5;
    }
}

/* Mode sombre pour la popup */
@media (prefers-color-scheme: dark) {
    body:not(.elementor-editor-active) .apple-popup-content {
        background: #FAFBFA;
    }

    body:not(.elementor-editor-active) .apple-popup-name {
        color: #527068;
    }

    body:not(.elementor-editor-active) .apple-popup-position {
        color: #a1a1a6;
    }

    body:not(.elementor-editor-active) .apple-popup-description {
        color: #d2d2d7;
    }

    body:not(.elementor-editor-active) .apple-popup-email {
        color: #a1a1a6;
    }

    body:not(.elementor-editor-active) .apple-popup-close {
        background: rgba(58, 58, 60, 0.9);
        color: #f5f5f7;
    }

    body:not(.elementor-editor-active) .apple-popup-close:hover {
        background: rgba(58, 58, 60, 1);
    }
}