/**
 * Installation Videos Gallery - Design Mobile Exact
 * Basé sur le mockup fourni
 */

/* ========================================
   MODAL GALERIE - FOND GRIS CLAIR
   ======================================== */

.ew-videos-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #F2F4F6;
    /* Gris très clair comme mockup */
    z-index: 99999;
    opacity: 0;
    transition: opacity 0.3s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.ew-videos-modal.active {
    opacity: 1;
}

.ew-videos-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px 20px 40px 20px;
    position: relative;
}

/* Bouton fermer - Discret */
.ew-videos-close {
    position: fixed;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    background: white;
    border: none;
    border-radius: 50%;
    color: #1A1A1A;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 100000;
}

.ew-videos-close:hover {
    background: #f5f5f5;
    transform: scale(1.05);
}

/* En-tête - Style ElectWatch */
.ew-videos-title {
    color: #1A1A1A;
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 4px 0;
    text-align: center;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
}

.ew-videos-subtitle {
    color: #8E8E93;
    font-size: 14px;
    margin: 0 0 24px 0;
    text-align: center;
    font-weight: 400;
}

/* ========================================
   GRILLE VIDEOS - 2 COLONNES
   ======================================== */

.ew-videos-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* ========================================
   HERO CARD - Grande carte en haut
   ======================================== */

.ew-video-card.featured {
    grid-column: 1 / -1;
    /* Pleine largeur */
}

.ew-video-card {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.ew-video-card:hover {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

/* ========================================
   THUMBNAIL - Zone image
   ======================================== */

.ew-video-thumbnail {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    /* 16:9 ratio */
    overflow: hidden;
    background: #E5E7EB;
}

.ew-video-card.featured .ew-video-thumbnail {
    padding-bottom: 52%;
    /* Plus court pour hero */
}

.ew-video-thumbnail video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* NOUVEAU: Même style pour images (URLs YouTube/Vimeo) */
.ew-video-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Overlay léger sur hover */
.ew-video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.ew-video-card:hover .ew-video-overlay {
    background: rgba(0, 0, 0, 0.1);
}

/* Icône Play centrale (optionnel, transparent) */
.ew-play-btn-center {
    width: 56px;
    height: 56px;
    background: rgba(0, 194, 255, 0.2);
    border: 3px solid #00C2FF;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.ew-video-card:hover .ew-play-btn-center {
    opacity: 1;
}

.ew-play-btn-center svg {
    width: 24px;
    height: 24px;
    color: #00C2FF;
    margin-left: 3px;
}

/* ========================================
   INFO VIDÉO - Zone texte
   ======================================== */

.ew-video-info {
    padding: 16px;
    position: relative;
}

.ew-video-card.featured .ew-video-info {
    padding: 20px;
}

.ew-video-title-item {
    color: #1A1A1A;
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 4px 0;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.ew-video-card.featured .ew-video-title-item {
    font-size: 17px;
    font-weight: 700;
}

.ew-video-desc {
    color: #8E8E93;
    font-size: 13px;
    margin: 0 0 8px 0;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ew-video-card.featured .ew-video-desc {
    font-size: 14px;
}

/* Pied de carte - Durée + Bouton */
.ew-video-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}

.ew-video-duration {
    color: #8E8E93;
    font-size: 13px;
    font-weight: 500;
}

/* Bouton Play Cyan - Bas droite */
.ew-play-btn-action {
    width: 36px;
    height: 36px;
    background: #00C2FF;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 194, 255, 0.3);
    transition: all 0.2s ease;
}

.ew-video-card.featured .ew-play-btn-action {
    width: 40px;
    height: 40px;
}

.ew-play-btn-action:hover {
    background: #00B8F0;
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(0, 194, 255, 0.4);
}

.ew-play-btn-action svg {
    width: 16px;
    height: 16px;
    color: white;
    margin-left: 2px;
}

.ew-video-card.featured .ew-play-btn-action svg {
    width: 18px;
    height: 18px;
}

/* ========================================
   LECTEUR PLEIN ÉCRAN
   ======================================== */

.ew-fullscreen-video {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: black;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.ew-fullscreen-video.active {
    opacity: 1;
}

.ew-fullscreen-video video {
    max-width: 100%;
    max-height: 100%;
    width: 100%;
}

.ew-fullscreen-close {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    z-index: 1000000;
}

.ew-fullscreen-close:hover {
    background: rgba(0, 0, 0, 0.8);
    border-color: white;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .ew-videos-container {
        padding: 16px;
    }

    .ew-videos-grid {
        gap: 12px;
    }

    .ew-videos-title {
        font-size: 20px;
    }

    .ew-video-info {
        padding: 12px;
    }

    .ew-video-card.featured .ew-video-info {
        padding: 16px;
    }
}

@media (max-width: 480px) {
    .ew-videos-grid {
        grid-template-columns: 1fr 1fr;
        /* Garde 2 colonnes même mobile */
        gap: 10px;
    }

    .ew-video-title-item {
        font-size: 13px;
    }

    .ew-video-desc {
        font-size: 11px;
    }

    .ew-play-btn-action {
        width: 32px;
        height: 32px;
    }
}

/* ========================================
   ANIMATIONS
   ======================================== */

@keyframes fadeInCard {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ew-video-card {
    animation: fadeInCard 0.4s ease;
}

.ew-video-card:nth-child(1) {
    animation-delay: 0.05s;
}

.ew-video-card:nth-child(2) {
    animation-delay: 0.1s;
}

.ew-video-card:nth-child(3) {
    animation-delay: 0.15s;
}

.ew-video-card:nth-child(4) {
    animation-delay: 0.2s;
}

.ew-video-card:nth-child(5) {
    animation-delay: 0.25s;
}

.ew-video-card:nth-child(6) {
    animation-delay: 0.3s;
}