/* =========================================================
   STYLES DE BASE ET POPUP (Inchangés)
   ========================================================= */

/* --- POPUP CONTAINER --- */

#vgp-popup-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.85);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
}
#vgp-popup-container {
    background: #fff;
    width: 90%;
    max-width: 900px;
    padding: 30px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 5px;
}
#vgp-close {
    position: absolute;
    top: 10px;
    right: 15px;
    cursor: pointer;
    font-weight: bold;
    font-size: 20px;
    color: #333;
    z-index: 10001; /* Doit être au-dessus des boutons de navigation */
}

/* --- POPUP NAVIGATION --- */

.vgp-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    padding: 10px;
    font-size: 2em;
    cursor: pointer;
    z-index: 10000;
    opacity: 0.8;
    transition: opacity 0.2s;
    line-height: 1; 
    border-radius: 50%;
    height: 50px;
    width: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.vgp-nav-btn:hover {
    opacity: 1;
}

.vgp-prev-btn {
    left: 10px;
}

.vgp-next-btn {
    right: 10px;
}

/* =========================================================
   STYLES DYNAMIQUES DE GRILLE (Nouveaux)
   ========================================================= */

/* Base Grid Container (Applique la correction de largeur) */
.vgp-grid {
    display: grid;
    width: 100%;
    max-width: none;
    gap: 15px;
}

/* Base Item Style (S'applique à tous les styles) */
.vgp-item {
    cursor: pointer;
    border: 1px solid #eee;
    background: #fff;
    padding: 0;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

.vgp-item:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

/* Styles communs au contenu */
.vgp-post-thumbnail, .vgp-preview-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
h4 {
    font-size: 0.9em;
    margin: 0 0 5px 0;
    line-height: 1.2;
}
.vgp-excerpt {
    font-size: 0.8em;
    margin: 0 0 5px 0;
    line-height: 1.3;
}
.vgp-read-btn {
    display: block;
    width: 100%;
    padding: 4px 0;
    font-size: 0.8em;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
    background-color: #0073aa; 
    color: white;
}
.vgp-read-btn:hover {
    background-color: #005177;
}

/* --- STYLE 1: CARRÉ COMPACT (vgp-style-square) --- */

.vgp-style-square {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}
.vgp-style-square .vgp-item {
    aspect-ratio: 1 / 1; 
}
.vgp-style-square .vgp-media-area {
    flex-grow: 1;
    position: relative;
}
.vgp-style-square .vgp-text-area {
    padding: 8px;
    background: #f9f9f9;
}
.vgp-style-square .vgp-social-share {
    position: absolute;
    bottom: 5px; right: 5px;
    font-size: 1em;
}

/* --- STYLE 2: OVERLAY (vgp-style-overlay) --- */

.vgp-style-overlay {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}
.vgp-style-overlay .vgp-item {
    aspect-ratio: 1 / 1.1; 
    position: relative;
    padding: 0;
}
.vgp-style-overlay .vgp-media-area {
    width: 100%;
    height: 100%;
    position: absolute;
}
/* Zone de texte positionnée en bas */
.vgp-style-overlay .vgp-text-area {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 15px 10px 8px 10px;
    background: linear-gradient(to top, rgba(0,0,0,0.8), rgba(0,0,0,0.0));
    color: white;
    z-index: 5;
}
.vgp-style-overlay .vgp-text-area h4, 
.vgp-style-overlay .vgp-text-area .vgp-excerpt {
    color: white;
}
.vgp-style-overlay .vgp-read-btn {
    background-color: #f7a623; 
    border-radius: 3px;
    width: auto;
    padding: 5px 10px;
    margin-top: 5px;
}
.vgp-style-overlay .vgp-social-share {
    position: static; /* Annule l'absolu du style 'square' */
    text-align: right;
    margin-top: 5px;
}

/* --- STYLE 3: MASONRY / ÉDITORIAL (vgp-style-masonry) --- */

.vgp-style-masonry {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); 
    align-items: start; /* Permet aux items d'avoir des hauteurs variables */
}
.vgp-style-masonry .vgp-item {
    aspect-ratio: auto; 
    display: block; /* Annule flex pour un flux simple */
}
.vgp-style-masonry .vgp-media-area {
    height: auto; 
    max-height: 250px; /* Limite la hauteur du visuel */
    overflow: hidden;
    position: relative;
}
.vgp-style-masonry .vgp-text-area {
    padding: 15px;
    background: #fff;
    color: #333;
    flex-grow: 1;
}
.vgp-style-masonry .vgp-read-btn {
    margin-top: 10px;
}

/* DATE SUBTILE (Commun à tous les styles) */
.vgp-date {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 2px 5px;
    font-size: 0.75em;
    border-radius: 2px;
    z-index: 10;
}