/**
 * Eollys Video Grid CSS
 * Design inspiré des grilles modernes avec tuiles en mode portrait
 */

/* ===== RESET ET BASE ===== */
.eollys-video-grid-container {
    /* Couleurs DreamsLMS */
    --primary-color: var(--dreamslms_primary_color, #ff6575);
    --primary-hover: var(--dreamslms_btn_primary_hover, #e72f41);
    --secondary-color: var(--dreamslms_secondary_color, #002058);
    --secondary-light: var(--dreamslms_breadcrumb_tcolor, #685f78);
    
    /* Couleurs système */
    --white: #FFFFFF;
    --text-dark: var(--dreamslms_breadcrumbtitle_tcolor, #002058);
    --text-light: var(--dreamslms_breadcrumb_tcolor, #685f78);
    --text-muted: #a0a0a0;
    
    /* Ombres et effets */
    --shadow-light: rgba(0, 32, 88, 0.08);
    --shadow-medium: rgba(0, 32, 88, 0.12);
    --shadow-dark: rgba(0, 32, 88, 0.16);
    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Typographie DreamsLMS */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    
    width: 100%;
    margin: 0 auto;
    position: relative;
}

.eollys-video-grid-container * {
    box-sizing: border-box;
}

/* ===== GRILLE PRINCIPALE ===== */
.eollys-video-grid {
    display: grid;
    gap: 24px;
    width: 100%;
    position: relative;
}

/* Layout Featured (1 grande + 2 petites) */
.eollys-video-grid.layout-featured {
    display: grid;
    grid-template-columns: 2fr 1fr;
    grid-template-rows: repeat(2, 1fr);
    gap: 24px;
    height: 600px; /* Hauteur fixe pour ce layout */
}

.eollys-video-grid.layout-featured .video-card:first-child {
    grid-column: 1;
    grid-row: 1 / -1; /* Prend toute la hauteur */
}

.eollys-video-grid.layout-featured .video-card:nth-child(2) {
    grid-column: 2;
    grid-row: 1;
}

.eollys-video-grid.layout-featured .video-card:nth-child(3) {
    grid-column: 2;
    grid-row: 2;
}

/* Version droite */
.eollys-video-grid.layout-featured.featured-right {
    grid-template-columns: 1fr 2fr;
}

.eollys-video-grid.layout-featured.featured-right .video-card:first-child {
    grid-column: 2;
    grid-row: 1 / -1;
}

.eollys-video-grid.layout-featured.featured-right .video-card:nth-child(2) {
    grid-column: 1;
    grid-row: 1;
}

.eollys-video-grid.layout-featured.featured-right .video-card:nth-child(3) {
    grid-column: 1;
    grid-row: 2;
}

/* Styles spécifiques pour les cartes du layout featured */
.eollys-video-grid.layout-featured .video-card.featured-main {
    position: relative;
}

.eollys-video-grid.layout-featured .video-card.featured-main .video-title {
    font-size: 24px;
    font-weight: 800;
    line-height: 1.3;
    margin-bottom: 16px;
    color: var(--text-dark);
}

.eollys-video-grid.layout-featured .video-card.featured-main .video-description {
    font-size: 16px;
    color: var(--text-light);
    -webkit-line-clamp: 4;
    line-clamp: 4;
}

.eollys-video-grid.layout-featured .video-card.featured-main .play-button {
    width: 100px;
    height: 100px;
    box-shadow: 0 12px 40px rgba(0, 32, 88, 0.25);
}

.eollys-video-grid.layout-featured .video-card.featured-main .play-button i {
    width: 40px;
    height: 40px;
}

.eollys-video-grid.layout-featured .video-card.featured-secondary {
    position: relative;
}

.eollys-video-grid.layout-featured .video-card.featured-secondary .video-title {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 8px;
    color: var(--text-dark);
    -webkit-line-clamp: 2;
    line-clamp: 2;
}

.eollys-video-grid.layout-featured .video-card.featured-secondary .video-description {
    font-size: 13px;
    color: var(--text-light);
    -webkit-line-clamp: 2;
    line-clamp: 2;
    margin-bottom: 12px;
}

.eollys-video-grid.layout-featured .video-card.featured-secondary .card-content {
    padding: 16px;
}

.eollys-video-grid.layout-featured .video-card.featured-secondary .play-button {
    width: 60px;
    height: 60px;
    box-shadow: 0 8px 25px rgba(0, 32, 88, 0.2);
}

.eollys-video-grid.layout-featured .video-card.featured-secondary .play-button i {
    width: 24px;
    height: 24px;
}

.eollys-video-grid.layout-featured .video-card.featured-secondary .card-actions {
    padding: 0 16px 16px;
}

.eollys-video-grid.layout-featured .video-card.featured-secondary .watch-video-btn {
    padding: 8px 16px;
    font-size: 12px;
}

/* Message d'avertissement avec couleurs DreamsLMS */
.eollys-warning {
    background: #fff3cd;
    border: 1px solid var(--primary-color);
    border-radius: 8px;
    padding: 16px;
    margin: 20px 0;
    color: var(--text-dark);
    text-align: center;
}

.eollys-warning p {
    margin: 0;
    font-weight: 500;
    font-family: inherit;
}

/* Responsive pour layout featured */
@media (max-width: 768px) {
    .eollys-video-grid.layout-featured {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
        height: auto;
    }
    
    .eollys-video-grid.layout-featured .video-card:first-child,
    .eollys-video-grid.layout-featured.featured-right .video-card:first-child {
        grid-column: 1;
        grid-row: 1;
    }
    
    .eollys-video-grid.layout-featured .video-card:nth-child(2),
    .eollys-video-grid.layout-featured.featured-right .video-card:nth-child(2) {
        grid-column: 1;
        grid-row: 2;
    }
    
    .eollys-video-grid.layout-featured .video-card:nth-child(3),
    .eollys-video-grid.layout-featured.featured-right .video-card:nth-child(3) {
        grid-column: 1;
        grid-row: 3;
    }
}

/* Layout Masonry (par défaut) */
.eollys-video-grid.layout-masonry {
    grid-template-rows: masonry;
    align-items: start;
}

/* Layout Grid régulier */
.eollys-video-grid.layout-grid {
    grid-auto-rows: auto;
}

/* Layout Pinterest */
.eollys-video-grid.layout-pinterest {
    columns: var(--columns);
    column-gap: 24px;
    break-inside: avoid;
}

.eollys-video-grid.layout-pinterest .video-card {
    display: inline-block;
    width: 100%;
    margin-bottom: 24px;
    break-inside: avoid;
}

/* Layout Magazine */
.eollys-video-grid.layout-magazine .video-card:first-child {
    grid-column: span 2;
    grid-row: span 2;
}

/* ===== COLONNES RESPONSIVES ===== */
/* Desktop */
.eollys-video-grid.cols-desktop-2 { grid-template-columns: repeat(2, 1fr); --columns: 2; }
.eollys-video-grid.cols-desktop-3 { grid-template-columns: repeat(3, 1fr); --columns: 3; }
.eollys-video-grid.cols-desktop-4 { grid-template-columns: repeat(4, 1fr); --columns: 4; }
.eollys-video-grid.cols-desktop-5 { grid-template-columns: repeat(5, 1fr); --columns: 5; }
.eollys-video-grid.cols-desktop-6 { grid-template-columns: repeat(6, 1fr); --columns: 6; }

/* Tablette */
@media (max-width: 1024px) {
    .eollys-video-grid.cols-tablet-1 { grid-template-columns: repeat(1, 1fr); --columns: 1; }
    .eollys-video-grid.cols-tablet-2 { grid-template-columns: repeat(2, 1fr); --columns: 2; }
    .eollys-video-grid.cols-tablet-3 { grid-template-columns: repeat(3, 1fr); --columns: 3; }
    .eollys-video-grid.cols-tablet-4 { grid-template-columns: repeat(4, 1fr); --columns: 4; }
    
    .eollys-video-grid {
        gap: 20px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .eollys-video-grid.cols-mobile-1 { grid-template-columns: repeat(1, 1fr); --columns: 1; }
    .eollys-video-grid.cols-mobile-2 { grid-template-columns: repeat(2, 1fr); --columns: 2; }
    
    .eollys-video-grid {
        gap: 16px;
    }
}

/* ===== CARTES VIDÉO ===== */
.video-card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 20px var(--shadow-light);
    overflow: hidden;
    position: relative;
    transition: var(--transition);
    cursor: pointer;
    height: fit-content;
}

.video-card .card-inner {
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* ===== GESTION DES HAUTEURS ===== */
/* Hauteur automatique */
.eollys-video-grid.height-mode-auto .video-card {
    height: auto;
}

/* Hauteur fixe */
.eollys-video-grid.height-mode-fixed .video-card {
    height: var(--card-height, 350px);
}

/* Ratios d'aspect */
.eollys-video-grid.aspect-9-16 .video-thumbnail { aspect-ratio: 9/16; }
.eollys-video-grid.aspect-2-3 .video-thumbnail { aspect-ratio: 2/3; }
.eollys-video-grid.aspect-3-4 .video-thumbnail { aspect-ratio: 3/4; }
.eollys-video-grid.aspect-1-1 .video-thumbnail { aspect-ratio: 1/1; }
.eollys-video-grid.aspect-4-3 .video-thumbnail { aspect-ratio: 4/3; }
.eollys-video-grid.aspect-16-9 .video-thumbnail { aspect-ratio: 16/9; }

/* ===== MINIATURES VIDÉO ===== */
.video-thumbnail {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.thumbnail-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
}

.video-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: var(--transition);
    display: block;
}

/* ===== OVERLAY VIDÉO ===== */
.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        135deg,
        var(--primary-color) 0%,
        var(--secondary-color) 100%
    );
    opacity: 0.9;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
    backdrop-filter: blur(2px);
}

.video-card:hover .video-overlay {
    opacity: 1;
}

/* Bouton Play principal */
.play-button {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 32px rgba(0, 32, 88, 0.3);
    transform: scale(0.8);
    transition: var(--transition);
}

.video-card:hover .play-button {
    transform: scale(1);
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 12px 40px rgba(0, 32, 88, 0.4);
}

.play-button i {
    width: 32px;
    height: 32px;
    color: var(--primary-color);
    margin-left: 4px; /* Légère correction visuelle pour l'icône play */
}

/* Durée de la vidéo */
.video-duration {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
    backdrop-filter: blur(10px);
}

.video-duration i {
    width: 12px;
    height: 12px;
}

/* ===== CONTENU DES CARTES ===== */
.card-content {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.video-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0 0 12px 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-family: inherit;
}

.video-description {
    font-size: 14px;
    color: var(--text-light);
    line-height: 1.6;
    margin: 0 0 16px 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 1;
    font-family: inherit;
}

/* ===== MÉTADONNÉES ===== */
.video-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    font-size: 12px;
    color: var(--text-light);
}

.video-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.video-meta i {
    width: 14px;
    height: 14px;
}

/* ===== ACTIONS DES CARTES ===== */
.card-actions {
    padding: 0 20px 20px;
    margin-top: auto;
}

.watch-video-btn {
    width: 100%;
    padding: 12px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: inherit;
}

.watch-video-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 101, 117, 0.3);
}

.watch-video-btn i {
    width: 16px;
    height: 16px;
}

/* ===== EFFETS DE SURVOL ===== */
/* Zoom Image */
.eollys-video-grid.hover-zoom .video-card:hover .video-thumbnail img {
    transform: scale(1.1);
}

/* Zoom + Overlay */
.eollys-video-grid.hover-zoom_overlay .video-card:hover .video-thumbnail img {
    transform: scale(1.1);
}

/* Glissement vers le haut */
.eollys-video-grid.hover-slide_up .video-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 40px var(--shadow-medium);
}

/* Fondu Overlay */
.eollys-video-grid.hover-fade_overlay .video-card:hover .video-overlay {
    opacity: 0.9;
}

/* Mise à l'échelle de la carte */
.eollys-video-grid.hover-scale_card .video-card:hover {
    transform: scale(1.03);
    box-shadow: 0 16px 50px var(--shadow-dark);
}

/* ===== LIGHTBOX ===== */
.eollys-video-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.eollys-video-lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-content {
    position: relative;
    width: 90%;
    max-width: 1200px;
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    transform: scale(0.8);
    transition: var(--transition);
}

.eollys-video-lightbox.active .lightbox-content {
    transform: scale(1);
}

.lightbox-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    transition: var(--transition);
    backdrop-filter: blur(10px);
}

.lightbox-close:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

.lightbox-close i {
    width: 20px;
    height: 20px;
}

.lightbox-video {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: black;
}

.lightbox-video iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.lightbox-info {
    padding: 24px;
    background: white;
}

.lightbox-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0 0 12px 0;
}

.lightbox-description {
    font-size: 16px;
    color: var(--text-light);
    line-height: 1.6;
    margin: 0;
}

/* ===== PAGINATION ===== */
.grid-pagination {
    text-align: center;
    margin-top: 40px;
}

.load-more-btn {
    padding: 16px 32px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
}

.load-more-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 101, 117, 0.3);
}

.load-more-btn i {
    width: 18px;
    height: 18px;
}

/* ===== ÉTAT VIDE ===== */
.eollys-no-videos {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-light);
}

.eollys-no-videos i {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.eollys-no-videos p {
    font-size: 18px;
    margin: 0;
}

/* ===== ANIMATIONS ===== */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.video-card {
    animation: slideInUp 0.6s ease-out;
}

/* Délai d'animation pour chaque carte */
.video-card:nth-child(1) { animation-delay: 0.1s; }
.video-card:nth-child(2) { animation-delay: 0.2s; }
.video-card:nth-child(3) { animation-delay: 0.3s; }
.video-card:nth-child(4) { animation-delay: 0.4s; }
.video-card:nth-child(5) { animation-delay: 0.5s; }
.video-card:nth-child(6) { animation-delay: 0.6s; }

/* ===== ÉTATS DE CHARGEMENT ===== */
.video-card.loading .video-thumbnail {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 2s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ===== ACCESSIBILITÉ ===== */
.video-card:focus,
.watch-video-btn:focus,
.lightbox-close:focus {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== DARK MODE (optionnel) ===== */
@media (prefers-color-scheme: dark) {
    .eollys-video-grid-container {
        --white: #1a1a1a;
        --text-dark: #e1e1e1;
        --text-light: #a1a1a1;
        --shadow-light: rgba(255, 255, 255, 0.1);
        --shadow-medium: rgba(255, 255, 255, 0.15);
        --shadow-dark: rgba(255, 255, 255, 0.25);
    }
    
    .lightbox-info {
        background: #1a1a1a;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .eollys-video-grid-container {
        break-inside: avoid;
    }
    
    .video-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .video-overlay,
    .card-actions,
    .eollys-video-lightbox {
        display: none !important;
    }
}
