/**
 * NewsJVG Elementor Widgets - Styles
 * Styles optimisés pour les widgets d'articles
 */

/* ===================================
   VARIABLES CSS - Dark Mode Support
   =================================== */

:root {
    --newsjvg-bg-primary: #FFFFFF;
    --newsjvg-bg-secondary: #F5F5F5;
    --newsjvg-bg-card: #FFFFFF;
    --newsjvg-text-primary: #000000;
    --newsjvg-text-secondary: #555555;
    --newsjvg-text-muted: #888888;
    --newsjvg-border-color: #E5E5E5;
    --newsjvg-accent-color: #0066FF;
    --newsjvg-overlay: rgba(0, 0, 0, 0.7);
    
    /* Transitions pour dark mode fluide */
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --newsjvg-bg-primary: #1a1a1a;
        --newsjvg-bg-secondary: #2a2a2a;
        --newsjvg-bg-card: #2a2a2a;
        --newsjvg-text-primary: #FFFFFF;
        --newsjvg-text-secondary: #CCCCCC;
        --newsjvg-text-muted: #999999;
        --newsjvg-border-color: #404040;
        --newsjvg-accent-color: #0066FF;
        --newsjvg-overlay: rgba(0, 0, 0, 0.8);
        
        color-scheme: dark;
    }
}

/* Dark mode class support */
.dark-mode,
[data-theme="dark"] {
    --newsjvg-bg-primary: #1a1a1a;
    --newsjvg-bg-secondary: #2a2a2a;
    --newsjvg-bg-card: #2a2a2a;
    --newsjvg-text-primary: #FFFFFF;
    --newsjvg-text-secondary: #CCCCCC;
    --newsjvg-text-muted: #999999;
    --newsjvg-border-color: #404040;
    --newsjvg-accent-color: #0066FF;
    --newsjvg-overlay: rgba(0, 0, 0, 0.8);
    
    color-scheme: dark;
}

/* Transitions fluides pour le dark mode */
.newsjvg-hero-posts-wrapper,
.newsjvg-posts-grid-wrapper,
.newsjvg-posts-list-wrapper,
.newsjvg-grid-card,
.newsjvg-list-item,
.newsjvg-section-title,
.newsjvg-grid-title,
.newsjvg-list-section-title,
.newsjvg-list-title,
.newsjvg-card-title,
.newsjvg-list-excerpt,
.newsjvg-list-badge,
.newsjvg-tag {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* ===================================
   HERO POSTS WIDGET - Les + Hypés
   =================================== */

.newsjvg-hero-posts-wrapper {
    margin: 40px 0;
    background: var(--newsjvg-bg-primary);
    padding: 0;
    overflow: hidden;
    max-width: 100%;
}

.newsjvg-section-title {
    font-size: 32px !important;
    font-weight: 700 !important;
    margin-bottom: 30px !important;
    padding-bottom: 0 !important;
    border-bottom: none !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    color: var(--newsjvg-text-primary) !important;
    position: relative;
    display: inline-block;
    max-width: 100%;
    word-wrap: break-word;
}

.newsjvg-section-title::after {
    content: '' !important;
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--newsjvg-accent-color) !important;
}

.newsjvg-section-title .highlight {
    color: var(--newsjvg-accent-color) !important;
    position: relative;
    font-weight: 700 !important;
}

.newsjvg-hero-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    width: 100%;
    max-width: 100%;
}

.newsjvg-hero-card {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    height: 350px;
    transition: transform 0.2s ease-out;
    will-change: transform;
    max-width: 100%;
}

.newsjvg-hero-card.main-card {
    grid-column: span 2;
    grid-row: span 2;
    height: 720px;
}

.newsjvg-hero-card:hover {
    transform: translateY(-5px) translateZ(0);
}

.newsjvg-hero-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100%;
    background: linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.7) 100%);
    opacity: 0.7;
    transition: opacity 0.2s ease-out;
    pointer-events: none;
}

.newsjvg-hero-card:hover::after {
    opacity: 0.85;
}

.newsjvg-card-link {
    display: block;
    position: relative;
    width: 100%;
    height: 100%;
    text-decoration: none;
    color: inherit;
}

.newsjvg-card-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.newsjvg-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.25s ease-out;
    will-change: transform;
}

.newsjvg-hero-card:hover .newsjvg-card-image img {
    transform: scale(1.05) translateZ(0);
}

.newsjvg-card-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 24px;
    z-index: 1;
    color: #fff;
}

.newsjvg-hero-card.main-card .newsjvg-card-content {
    padding: 32px;
}

.newsjvg-card-category {
    display: inline-block;
    background: var(--newsjvg-accent-color);
    color: #fff;
    padding: 6px 16px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.newsjvg-card-title {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.4;
    margin: 0;
    color: #fff;
}

.newsjvg-hero-card.main-card .newsjvg-card-title {
    font-size: 32px;
    line-height: 1.3;
}

/* Responsive */
@media (max-width: 1024px) {
    .newsjvg-hero-card.main-card {
        grid-column: span 1;
        grid-row: span 1;
        height: 400px;
    }
    
    .newsjvg-hero-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 16px;
    }
    
    .newsjvg-posts-grid.columns-4,
    .newsjvg-posts-grid.columns-3 {
        grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr));
    }
    
    .newsjvg-section-title {
        font-size: 26px !important;
    }
    
    .newsjvg-grid-header {
        padding: 0 0 12px 0 !important;
    }
}

@media (max-width: 768px) {
    .newsjvg-hero-grid,
    .newsjvg-posts-grid.columns-2,
    .newsjvg-posts-grid.columns-3,
    .newsjvg-posts-grid.columns-4 {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .newsjvg-hero-card {
        height: 300px;
    }
    
    .newsjvg-grid-card {
        height: 320px;
    }
    
    .newsjvg-section-title {
        font-size: 22px !important;
        margin-bottom: 20px !important;
    }
    
    .newsjvg-grid-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 0 0 16px 0 !important;
    }
    
    .newsjvg-grid-title,
    .newsjvg-list-section-title {
        font-size: 18px !important;
        letter-spacing: 1px;
    }
    
    .newsjvg-hero-posts-wrapper,
    .newsjvg-posts-grid-wrapper,
    .newsjvg-posts-list-wrapper {
        margin: 20px 0;
    }
}

/* ===================================
   POSTS GRID WIDGET - Grille d'actualités
   =================================== */

.newsjvg-posts-grid-wrapper {
    margin: 40px 0;
    background: var(--newsjvg-bg-primary);
    overflow: hidden;
    max-width: 100%;
}

.newsjvg-grid-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: transparent !important;
    padding: 0 0 16px 0 !important;
    margin-bottom: 24px;
    border-radius: 0;
    box-shadow: none !important;
    border-bottom: none !important;
    flex-wrap: wrap;
    gap: 12px;
    max-width: 100%;
}

.newsjvg-grid-header:empty {
    border-bottom: none !important;
    margin-bottom: 0 !important;
    padding: 0 !important;
}

.newsjvg-grid-title {
    font-size: 20px !important;
    font-weight: 700 !important;
    color: var(--newsjvg-text-primary) !important;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    max-width: 100%;
    word-wrap: break-word;
}

.newsjvg-view-more {
    color: var(--newsjvg-text-primary) !important;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: opacity 0.2s ease, color 0.2s ease;
}

.newsjvg-view-more:hover {
    opacity: 0.7;
    color: var(--newsjvg-accent-color) !important;
}

.newsjvg-view-more .arrow {
    font-size: 18px;
    transition: transform 0.2s ease-out;
    will-change: transform;
}

.newsjvg-view-more:hover .arrow {
    transform: translateX(4px) translateZ(0);
}

.newsjvg-posts-grid {
    display: grid;
    gap: 24px;
    width: 100%;
    max-width: 100%;
}

.newsjvg-posts-grid.columns-2 {
    grid-template-columns: repeat(2, 1fr);
}

.newsjvg-posts-grid.columns-3 {
    grid-template-columns: repeat(3, 1fr);
}

.newsjvg-posts-grid.columns-4 {
    grid-template-columns: repeat(4, 1fr);
}

.newsjvg-grid-card {
    background: var(--newsjvg-bg-card);
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s ease-out;
    border: 1px solid var(--newsjvg-border-color);
    position: relative;
    height: 350px;
    will-change: transform;
}

.newsjvg-grid-card:hover {
    transform: translateY(-8px) translateZ(0);
}

.newsjvg-grid-card .newsjvg-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
    position: relative;
    height: 100%;
    width: 100%;
}

.newsjvg-grid-card .newsjvg-card-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #1a1a1a;
}

.newsjvg-grid-card .newsjvg-card-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.25s ease-out, opacity 0.2s ease;
    opacity: 0;
    will-change: transform;
}

.newsjvg-grid-card .newsjvg-card-image img.loaded,
.newsjvg-grid-card .newsjvg-card-image img[loading="lazy"],
.newsjvg-grid-card .newsjvg-card-image img[loading="eager"] {
    opacity: 1;
    transition: opacity 0.2s ease, transform 0.25s ease-out;
}

.newsjvg-grid-card:hover .newsjvg-card-image img {
    transform: scale(1.1) translateZ(0);
}

.newsjvg-image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.9) 100%);
    z-index: 1;
}

.newsjvg-grid-card .newsjvg-card-content {
    padding: 20px;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2;
}

.newsjvg-grid-card .newsjvg-card-category {
    display: inline-block;
    background: var(--newsjvg-accent-color);
    color: #fff;
    padding: 6px 14px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.newsjvg-card-date {
    display: none;
}

.newsjvg-grid-card .newsjvg-card-title {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.3;
    margin: 0;
    color: #FFFFFF;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.9);
}

.newsjvg-card-excerpt {
    display: none;
}

/* Responsive */
@media (min-width: 1025px) {
    .newsjvg-posts-grid.columns-2 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .newsjvg-posts-grid.columns-3 {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .newsjvg-posts-grid.columns-4 {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 1024px) {
    .newsjvg-posts-grid.columns-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .newsjvg-posts-grid.columns-3 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .newsjvg-posts-grid.columns-2 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .newsjvg-posts-grid.columns-2,
    .newsjvg-posts-grid.columns-3,
    .newsjvg-posts-grid.columns-4 {
        grid-template-columns: 1fr !important;
        gap: 16px;
    }
    
    .newsjvg-grid-header {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
    
    .newsjvg-view-more {
        align-self: flex-start;
    }
}

/* ===================================
   POSTS LIST WIDGET - Liste d'actualités
   =================================== */

.newsjvg-posts-list-wrapper {
    margin: 40px 0;
    background: var(--newsjvg-bg-primary);
    overflow: hidden;
    max-width: 100%;
}

.newsjvg-list-section-title {
    font-size: 20px !important;
    font-weight: 700 !important;
    margin-bottom: 24px !important;
    padding-bottom: 16px !important;
    border-bottom: 4px solid var(--newsjvg-accent-color) !important;
    color: var(--newsjvg-text-primary) !important;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    width: 100%;
    max-width: 100%;
    word-wrap: break-word;
}

.newsjvg-posts-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    max-width: 100%;
}

.newsjvg-list-item {
    background: var(--newsjvg-bg-card);
    border: 1px solid var(--newsjvg-border-color);
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s ease-out, border-color 0.2s ease;
    will-change: transform;
    max-width: 100%;
}

.newsjvg-list-item:hover {
    transform: translateX(4px) translateZ(0);
    border-color: var(--newsjvg-accent-color);
}

.newsjvg-list-link {
    display: flex !important;
    text-decoration: none;
    color: inherit;
    gap: 0;
    min-height: 180px;
}

.newsjvg-list-thumbnail {
    position: relative;
    flex-shrink: 0;
    width: 240px !important;
    height: auto !important;
    align-self: stretch !important;
    overflow: hidden;
}

.newsjvg-list-thumbnail img {
    width: 100% !important;
    height: 100% !important;
    min-height: 100% !important;
    object-fit: cover !important;
    transition: transform 0.25s ease-out;
    will-change: transform;
}

.newsjvg-list-item:hover .newsjvg-list-thumbnail img {
    transform: scale(1.05) translateZ(0);
}

.newsjvg-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    transition: transform 0.2s ease-out, background 0.2s ease;
    will-change: transform;
}

.newsjvg-list-item:hover .newsjvg-play-icon {
    background: rgba(0, 102, 255, 0.9);
    transform: translate(-50%, -50%) scale(1.1) translateZ(0);
}

.newsjvg-list-content {
    flex: 1;
    padding: 16px 20px 16px 20px !important;
    display: flex;
    flex-direction: column;
}

.newsjvg-list-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.newsjvg-list-badge {
    display: inline-block;
    background: var(--newsjvg-accent-color);
    color: #fff;
    padding: 4px 10px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.newsjvg-list-date {
    font-size: 12px;
    color: var(--newsjvg-text-muted);
}

.newsjvg-list-title {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.4;
    margin: 0 0 10px 0;
    color: var(--newsjvg-text-primary);
}

.newsjvg-list-excerpt {
    font-size: 14px;
    line-height: 1.6;
    color: var(--newsjvg-text-secondary);
    margin-bottom: 10px;
}

.newsjvg-list-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: auto;
}

.newsjvg-tag {
    display: inline-block;
    background: var(--newsjvg-bg-secondary);
    color: var(--newsjvg-text-secondary);
    padding: 4px 10px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
    border: 1px solid var(--newsjvg-border-color);
}

/* Responsive */
@media (max-width: 768px) {
    .newsjvg-list-link {
        flex-direction: column;
    }
    
    .newsjvg-list-thumbnail {
        width: 100% !important;
        height: 200px !important;
        align-self: auto !important;
    }
    
    .newsjvg-list-content {
        padding: 16px !important;
    }
    
    .newsjvg-list-section-title {
        font-size: 18px !important;
    }
    
    .newsjvg-list-title {
        font-size: 16px;
    }
    
    .newsjvg-ad-container {
        padding: 16px;
    }
}

@media (max-width: 480px) {
    .newsjvg-section-title {
        font-size: 20px !important;
    }
    
    .newsjvg-grid-title,
    .newsjvg-list-section-title {
        font-size: 16px !important;
        letter-spacing: 0.5px;
    }
    
    .newsjvg-hero-card,
    .newsjvg-grid-card {
        height: 280px;
    }
    
    .newsjvg-card-title {
        font-size: 16px;
    }
    
    .newsjvg-list-title {
        font-size: 15px;
    }
    
    .newsjvg-card-content,
    .newsjvg-hero-card.main-card .newsjvg-card-content {
        padding: 16px;
    }
    
    .newsjvg-hero-posts-wrapper,
    .newsjvg-posts-grid-wrapper,
    .newsjvg-posts-list-wrapper {
        margin: 16px 0;
    }
}

/* ===================================
   PUBLICITÉS
   =================================== */

.newsjvg-ad-container {
    background: var(--newsjvg-bg-secondary);
    border: 1px dashed var(--newsjvg-border-color);
    border-radius: 8px;
    padding: 20px;
    margin: 16px 0;
    text-align: center;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.newsjvg-ad-label {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--newsjvg-text-muted);
    margin-bottom: 12px;
    letter-spacing: 1px;
    font-weight: 600;
}

.newsjvg-ad-content {
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.newsjvg-ad-content > * {
    max-width: 100%;
}

/* Style pour les publicités responsive */
.newsjvg-ad-content ins {
    display: block !important;
}

.newsjvg-ad-content iframe {
    max-width: 100%;
}

/* ===================================
   OPTIMISATIONS GÉNÉRALES
   =================================== */

/* Performance - GPU Acceleration */
.newsjvg-hero-card,
.newsjvg-grid-card,
.newsjvg-list-item,
.newsjvg-card-image img,
.newsjvg-list-thumbnail img,
.newsjvg-play-icon,
.newsjvg-view-more .arrow {
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
    transform: translateZ(0);
}

/* Lazy Loading Support */
.newsjvg-card-image img,
.newsjvg-list-thumbnail img {
    opacity: 0;
    transition: opacity 0.2s ease;
}

.newsjvg-card-image img.loaded,
.newsjvg-list-thumbnail img.loaded {
    opacity: 1;
}

/* Accessibility */
.newsjvg-card-link:focus,
.newsjvg-list-link:focus {
    outline: 2px solid #0066FF;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .newsjvg-hero-card,
    .newsjvg-grid-card,
    .newsjvg-list-item {
        page-break-inside: avoid;
    }
}
