/* ========================================
   DANFER GALLERY - CSS PRINCIPAL
   ======================================== */

/* Variables CSS pour la personnalisation */
:root {
    --danfer-primary-color: #0073aa;
    --danfer-secondary-color: #e0245e;
    --danfer-background: #fff;
    --danfer-text-color: #333;
    --danfer-border-color: #ddd;
    --danfer-border-radius: 5px;
    --danfer-spacing: 15px;
    --danfer-transition: 0.3s ease;
}

/* Empêcher le scroll quand la lightbox est ouverte */
body.danfer-gallery-lightbox-open {
    overflow: hidden;
}

/* ========================================
   LAYOUT GRILLE
   ======================================== */
.danfer-gallery.danfer-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--danfer-spacing);
    margin-top: 20px;
}

/* ========================================
   LAYOUT MASONRY
   ======================================== */
.danfer-gallery.danfer-gallery-masonry {
    column-count: 3;
    column-gap: var(--danfer-spacing);
    margin-top: 20px;
}

.danfer-gallery-masonry .danfer-gallery-item {
    break-inside: avoid;
    margin-bottom: var(--danfer-spacing);
}

/* ========================================
   LAYOUT CAROUSEL
   ======================================== */
.danfer-gallery.danfer-gallery-carousel {
    margin-top: 20px;
}

.danfer-gallery-carousel .swiper-slide {
    height: auto;
}

/* Boutons de navigation Swiper personnalisés */
.danfer-gallery-swiper .swiper-button-prev,
.danfer-gallery-swiper .swiper-button-next {
    color: var(--danfer-primary-color);
    background: rgba(255, 255, 255, 0.9);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.danfer-gallery-swiper .swiper-button-prev:after,
.danfer-gallery-swiper .swiper-button-next:after {
    font-size: 20px;
}

.danfer-gallery-swiper .swiper-pagination-bullet {
    background: var(--danfer-primary-color);
}

/* ========================================
   ITEMS DE LA GALERIE
   ======================================== */
.danfer-gallery-item {
    position: relative;
    cursor: pointer;
    overflow: hidden;
    border: 1px solid var(--danfer-border-color);
    border-radius: var(--danfer-border-radius);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: transform var(--danfer-transition), box-shadow var(--danfer-transition);
    aspect-ratio: 1 / 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #f0f0f0;
}

.danfer-gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.danfer-gallery-item img,
.danfer-gallery-item video {
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
    width: 100%;
    height: 100%;
    transition: transform var(--danfer-transition);
}

.danfer-gallery-item:hover img,
.danfer-gallery-item:hover video {
    transform: scale(1.05);
}

/* Badge type de média */
.media-type-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 5px 10px;
    border-radius: 3px;
    font-size: 0.75em;
    font-weight: bold;
    z-index: 5;
}

/* Compteur de commentaires */
.comment-count {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px 8px;
    border-radius: 3px;
    font-size: 0.8em;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 3px;
}

.comment-count:before {
    content: '\f101';
    font-family: dashicons;
    font-size: 1.2em;
}

/* Bouton de like sur la vignette */
.likes-button {
    position: absolute;
    bottom: 5px;
    left: 5px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    padding: 5px 8px;
    border-radius: 3px;
    font-size: 0.8em;
    z-index: 10;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background-color var(--danfer-transition), transform var(--danfer-transition);
}

.likes-button:hover {
    background-color: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

.likes-button .dashicons-heart {
    font-size: 1.2em;
    width: 1.2em;
    height: 1.2em;
    color: #fff;
    transition: color var(--danfer-transition);
}

.likes-button.liked {
    background-color: var(--danfer-secondary-color);
}

.likes-button.liked .dashicons-heart {
    color: white;
    animation: heartBeat 0.3s ease;
}

@keyframes heartBeat {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.3); }
}

/* ========================================
   LIGHTBOX
   ======================================== */
.danfer-gallery-lightbox {
    display: none;
    position: fixed;
    z-index: 999999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    align-items: center;
    justify-content: center;
}

.lightbox-content {
    background-color: var(--danfer-background);
    padding: 30px;
    border-radius: var(--danfer-border-radius);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    position: relative;
    max-width: 95%;
    max-height: 95%;
    display: flex;
    gap: 30px;
    overflow: hidden;
    animation: lightboxFadeIn 0.3s ease;
}

@keyframes lightboxFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Bouton de fermeture */
.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    color: #aaa;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10;
    transition: color var(--danfer-transition), transform var(--danfer-transition);
}

.close-btn:hover {
    color: var(--danfer-text-color);
    transform: rotate(90deg);
}

/* Wrapper du média */
.lightbox-media-wrapper {
    flex: 2;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    min-width: 400px;
}

.media-container {
    max-width: 100%;
    max-height: 70vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.lightbox-media-wrapper img,
.lightbox-media-wrapper video {
    max-width: 100%;
    max-height: 70vh;
    display: block;
    object-fit: contain;
    border-radius: var(--danfer-border-radius);
}

/* Boutons de navigation */
.nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: transparent;
    color: white;
    border: none;
    cursor: pointer;
    z-index: 11;
    transition: color var(--danfer-transition), text-shadow var(--danfer-transition);
    display: flex;
    justify-content: center;
    align-items: center;
    width: 60px;
    padding: 0;
}

.nav-btn:hover {
    color: var(--danfer-primary-color);
    text-shadow: 0 0 20px rgba(0, 115, 170, 0.8);
}

.nav-btn .dashicons {
    font-size: 6em;
    height: auto;
    width: auto;
    line-height: 1;
}

.prev-btn {
    left: -10px;
}

.next-btn {
    right: -10px;
}

/* Actions de la lightbox (like) */
.lightbox-actions {
    margin-top: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

#like-button {
    background-color: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    font-size: 3em;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--danfer-transition);
}

#like-button:hover {
    transform: scale(1.1);
}

#like-button .dashicons-heart {
    font-size: 1em;
    height: 1em;
    width: 1em;
    color: #888;
    transition: color var(--danfer-transition);
}

#like-button.liked .dashicons-heart {
    color: var(--danfer-secondary-color);
    filter: drop-shadow(0 0 10px rgba(224, 36, 94, 0.5));
}

.likes-count-lightbox {
    font-size: 1.3em;
    font-weight: bold;
    color: var(--danfer-text-color);
}

/* Section des commentaires */
.lightbox-comments-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 350px;
    max-width: 450px;
    padding-left: 30px;
    border-left: 2px solid var(--danfer-border-color);
}

.lightbox-comments-section h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: var(--danfer-text-color);
    font-size: 1.5em;
}

/* Liste des commentaires */
#comments-list {
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 10px;
    margin-bottom: 20px;
    max-height: 400px;
}

#comments-list::-webkit-scrollbar {
    width: 8px;
}

#comments-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

#comments-list::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

#comments-list::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.comment-item {
    border-bottom: 1px solid var(--danfer-border-color);
    padding-bottom: 15px;
    margin-bottom: 15px;
    animation: commentSlideIn 0.3s ease;
}

@keyframes commentSlideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.comment-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.comment-author {
    margin: 0;
    font-size: 0.9em;
    color: #555;
}

.comment-author strong {
    color: var(--danfer-text-color);
    font-size: 1.05em;
}

.comment-date {
    font-size: 0.85em;
    color: #999;
    font-weight: normal;
    margin-left: 8px;
}

.comment-text {
    margin: 5px 0 0;
    font-size: 0.95em;
    line-height: 1.5;
    color: #444;
}

/* Bouton de signalement */
.report-comment-btn {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 2px;
    transition: color var(--danfer-transition);
}

.report-comment-btn:hover {
    color: #ff6b6b;
}

.report-comment-btn .dashicons {
    font-size: 1.2em;
    width: 1.2em;
    height: 1.2em;
}

.reported-badge {
    font-size: 0.75em;
    background: #ff6b6b;
    color: white;
    padding: 2px 8px;
    border-radius: 3px;
}

/* Messages */
.loading,
.error,
.no-comments {
    text-align: center;
    padding: 20px;
    color: #666;
    font-style: italic;
}

.error {
    color: #d63638;
}

/* Formulaire de commentaire */
#comment-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#comment-form input[type="text"],
#comment-form input[type="email"],
#comment-form textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--danfer-border-color);
    border-radius: var(--danfer-border-radius);
    box-sizing: border-box;
    font-size: 0.95em;
    transition: border-color var(--danfer-transition);
}

#comment-form input:focus,
#comment-form textarea:focus {
    outline: none;
    border-color: var(--danfer-primary-color);
}

#comment-form textarea {
    min-height: 100px;
    resize: vertical;
}

#comment-form button[type="submit"] {
    background-color: var(--danfer-primary-color);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: var(--danfer-border-radius);
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: background-color var(--danfer-transition), transform var(--danfer-transition);
}

#comment-form button[type="submit"]:hover:not(:disabled) {
    background-color: #005177;
    transform: translateY(-2px);
}

#comment-form button[type="submit"]:disabled {
    background-color: #a0a0a0;
    cursor: not-allowed;
}

/* Boutons de partage social */
.social-share-buttons {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.share-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background-color: #eee;
    color: #333;
    text-decoration: none;
    transition: transform var(--danfer-transition), box-shadow var(--danfer-transition);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.share-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.share-button .dashicons {
    font-size: 22px;
    width: 22px;
    height: 22px;
}

/* Couleurs spécifiques des réseaux */
.share-facebook { background-color: #3b5998; color: #fff; }
.share-twitter { background-color: #1DA1F2; color: #fff; }
.share-pinterest { background-color: #E60023; color: #fff; }
.share-linkedin { background-color: #0077b5; color: #fff; }
.share-email { background-color: #7d7d7d; color: #fff; }
.share-whatsapp { background-color: #25D366; color: #fff; }

/* Notifications */
.danfer-gallery-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    padding: 15px 20px;
    border-radius: var(--danfer-border-radius);
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    z-index: 1000000;
    max-width: 300px;
    opacity: 0;
    transform: translateX(400px);
    transition: all var(--danfer-transition);
}

.danfer-gallery-notification.show {
    opacity: 1;
    transform: translateX(0);
}

.danfer-gallery-notification-success {
    border-left: 4px solid #46b450;
}

.danfer-gallery-notification-error {
    border-left: 4px solid #d63638;
}

.danfer-gallery-notification-warning {
    border-left: 4px solid #f0b849;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 1024px) {
    .danfer-gallery-masonry {
        column-count: 2;
    }
}

@media (max-width: 768px) {
    .danfer-gallery-masonry {
        column-count: 1;
    }
    
    .lightbox-content {
        flex-direction: column;
        max-width: 98%;
        max-height: 98%;
        padding: 20px;
        overflow-y: auto;
    }
    
    .lightbox-media-wrapper {
        flex: none;
        width: 100%;
        padding-right: 0;
        margin-bottom: 20px;
        min-width: unset;
    }
    
    .lightbox-comments-section {
        flex: none;
        width: 100%;
        min-width: unset;
        max-width: unset;
        padding-left: 0;
        border-left: none;
        border-top: 2px solid var(--danfer-border-color);
        padding-top: 20px;
    }
    
    #comments-list {
        max-height: 250px;
    }
    
    .nav-btn {
        width: 40px;
    }
    
    .nav-btn .dashicons {
        font-size: 4em;
    }
    
    .prev-btn {
        left: 0;
    }
    
    .next-btn {
        right: 0;
    }
    
    #like-button {
        font-size: 2.5em;
    }
    
    .close-btn {
        font-size: 28px;
    }
}

@media (max-width: 480px) {
    .danfer-gallery.danfer-gallery-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 10px;
    }
    
    .lightbox-content {
        padding: 15px;
    }
    
    .lightbox-comments-section h3 {
        font-size: 1.2em;
    }
    
    .social-share-buttons {
        gap: 8px;
    }
    
    .share-button {
        width: 40px;
        height: 40px;
    }
}

/* Message vide */
.danfer-gallery-empty {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-style: italic;
    background: #f5f5f5;
    border-radius: var(--danfer-border-radius);
}