/* Styles généraux */
.wpsg-galleries-wrapper {
    max-width: 100%;
    margin: 0 auto;
    padding: 20px;
    box-sizing: border-box;
}

/* Grille des galeries */
.WPSG_galerie-grid1 {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

/* Style des vignettes */
.WPSG_galerie-item {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
}

.WPSG_galerie-item:hover {
    transform: translateY(-5px);
}

.WPSG_galerie-thumb {
    position: relative;
    padding-top: 75%; /* Ratio 4:3 */
    overflow: hidden;
}

.WPSG_galerie-thumb img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Informations de la galerie */
.WPSG_galerie-item h4 {
    margin: 10px;
    font-size: 1.2em;
    color: #333;
}

.WPSG_galerie-date,
.WPSG_galerie-lieu {
    display: block;
    margin: 5px 10px;
    color: #666;
    font-size: 0.9em;
}

/* Grille des images dans une galerie */
.WPSG_galerie-grid {
    position: relative;
    width: 100%;
    margin: 20px 0;
}

.galerie-masonry {
    column-count: 3;
    column-gap: 10px;
    opacity: 0;
    transition: opacity 0.5s ease;
}

@media (max-width: 768px) {
    .galerie-masonry {
        column-count: 2;
    }
}

@media (max-width: 480px) {
    .galerie-masonry {
        column-count: 1;
    }
}

.galerie-masonry .WPSG_galerie-item {
    break-inside: avoid;
    margin-bottom: 10px;
    cursor: pointer;
}

/* Lightbox */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.lightbox.hidden {
    display: none;
}

.lightbox img {
    max-width: 90%;
    max-height: 90vh;
    object-fit: contain;
    transition: opacity 0.3s ease;
}

.nav-btn,
.close-btn {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 10px;
    position: absolute;
    z-index: 10000;
}

.nav-btn:hover,
.close-btn:hover {
    opacity: 0.8;
}

.nav-btn:focus,
.close-btn:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.5);
}

#prev {
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
}

#next {
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

#close {
    top: 20px;
    right: 20px;
}

/* Loader */
.wpsg-loader {
    display:flex;
    flex-direction: row;
    align-items: center;
    text-align: center;
    padding: 2rem;
    position: absolute;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    z-index: 1;
}

.wpsg-loader .dashicons {
    animation: spin 2s linear infinite;
    margin-right: 5px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Bouton retour */
.wpsg-back-link {
    display: inline-flex;
    align-items: center;
    margin-bottom: 20px;
    color: #333;
    text-decoration: none;
    font-weight: 500;
}

.wpsg-back-link:hover {
    color: #E40A1A;
}

.wpsg-back-link .dashicons {
    margin-right: 5px;
}

/* En-tête de galerie */
.wpsg-gallery-header {
    margin-bottom: 30px;
}

.wpsg-gallery-header h1 {
    margin-bottom: 10px;
}

.wpsg-gallery-date {
    color: #666;
    font-size: 0.9em;
    font-weight: normal;
}

.wpsg-gallery-location {
    color: #666;
    font-size: 0.9em;
    margin-top: 5px;
}

/* Pagination */
.WPSG_galerie-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px 0;
    gap: 5px;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 30px;
    padding: 0 5px;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #333;
    text-decoration: none;
    transition: all 0.2s ease;
}

.page-link:hover {
    background: #f5f5f5;
    border-color: #999;
}

.page-link.current {
    background: #0073aa;
    border-color: #0073aa;
    color: #fff;
}

/* Messages */
.wpsg-notice {
    background: #f8f8f8;
    border-left: 4px solid #666;
    padding: 12px;
    margin: 20px 0;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 100000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.4);
}

.modal-content {
    position: relative;
    background-color: #fefefe;
    margin: 5% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 600px;
    border-radius: 4px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h2 {
    margin: 0;
    padding: 0;
}

#closeModal {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
}

#closeModal:hover {
    color: #000;
}

.modal-footer {
    margin-top: 20px;
    text-align: right;
}

.modal-status {
    float: left;
    padding: 5px 0;
}