/* 🎨 Styles de la galerie photo - Mandragora Formation */

/* ===== VARIABLES CSS ===== */
:root {
    --gallery-primary: #710000;
    --gallery-secondary: #710000;
    --gallery-accent: #f4a261;
    --gallery-text: #2c3e50;
    --gallery-light: #fff4e3;
    --gallery-dark: #34495e;
    --gallery-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --gallery-shadow-hover: 0 8px 15px rgba(0, 0, 0, 0.2);
    --gallery-border-radius: 12px;
    --gallery-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== HEADER DE LA GALERIE ===== */
.gallery-header {
    background: linear-gradient(135deg, var(--gallery-primary) 0%, var(--gallery-secondary) 100%);
    color: white;
    padding: 4rem 0 3rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.gallery-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.gallery-header .container {
    position: relative;
    z-index: 2;
}

.gallery-title {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    font-family: 'rostock_kaligraph', serif;
}

.gallery-subtitle {
    font-size: 1.3rem;
    margin-bottom: 2.5rem;
    opacity: 0.95;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

/* ===== CONTRÔLES DE LA GALERIE ===== */
.gallery-controls {
    background: var(--gallery-light);
    padding: 2rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.gallery-controls .container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.search-container {
    display: flex;
    justify-content: center;
}

.search-bar {
    display: flex;
    max-width: 500px;
    width: 100%;
    background: white;
    border-radius: 50px;
    overflow: hidden;
    box-shadow: var(--gallery-shadow);
    border: 2px solid transparent;
    transition: var(--gallery-transition);
}

.search-bar:focus-within {
    border-color: var(--gallery-primary);
    box-shadow: 0 0 0 3px rgba(74, 124, 89, 0.1);
}

#gallery-search {
    flex: 1;
    padding: 1rem 1.5rem;
    border: none;
    outline: none;
    font-size: 1rem;
    background: transparent;
}

#gallery-search::placeholder {
    color: #999;
}

#search-btn {
    padding: 1rem 1.5rem;
    background: var(--gallery-primary);
    color: white;
    border: none;
    cursor: pointer;
    transition: var(--gallery-transition);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 60px;
}

#search-btn:hover {
    background: var(--gallery-dark);
    transform: translateY(-1px);
}

.filter-container {
    display: flex;
    justify-content: center;
}

.filter-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.filter-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: white;
    border: 2px solid var(--gallery-light);
    border-radius: 50px;
    color: var(--gallery-text);
    cursor: pointer;
    transition: var(--gallery-transition);
    font-weight: 500;
    box-shadow: var(--gallery-shadow);
}

.filter-btn:hover {
    border-color: var(--gallery-secondary);
    transform: translateY(-2px);
    box-shadow: var(--gallery-shadow-hover);
}

.filter-btn.active {
    background: var(--gallery-primary);
    color: white;
    border-color: var(--gallery-primary);
}

.filter-btn i {
    font-size: 0.9rem;
}

/* ===== GRILLE DE LA GALERIE ===== */
.gallery-main {
    padding: 3rem 0;
    min-height: 60vh;
}

.gallery-main .container {
    max-width: 1900px; /* Remis à 1200px comme demandé */
    margin: 0 auto;
    padding: 0 2rem;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); /* Utilise auto-fill pour maintenir la taille des cartes */
    gap: 2rem;
    margin-bottom: 3rem;
}

.gallery-item {
    background: white;
    border-radius: var(--gallery-border-radius);
    overflow: hidden;
    box-shadow: var(--gallery-shadow);
    transition: var(--gallery-transition);
    cursor: pointer;
    position: relative;
}

.gallery-item:hover {
    transform: translateY(-8px);
    box-shadow: var(--gallery-shadow-hover);
}

.gallery-image-container {
    position: relative;
    aspect-ratio: 4/3;
    overflow: hidden;
}

.gallery-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--gallery-transition);
}

.gallery-item:hover .gallery-image {
    transform: scale(1.05);
}

.gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(0, 0, 0, 0.3) 50%,
        rgba(0, 0, 0, 0.8) 100%
    );
    opacity: 0;
    transition: var(--gallery-transition);
    display: flex;
    align-items: flex-end;
    padding: 2rem;
}

.gallery-item:hover .gallery-overlay {
    opacity: 1;
}

.overlay-content {
    color: white;
    width: 100%;
}

.overlay-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.overlay-description {
    font-size: 0.9rem;
    margin-bottom: 1rem;
    opacity: 0.9;
    line-height: 1.4;
}

.overlay-meta {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    font-size: 0.8rem;
    opacity: 0.8;
}

.overlay-meta span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.overlay-view-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--gallery-transition);
    backdrop-filter: blur(10px);
}

.overlay-view-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* ===== PAGINATION ===== */
.gallery-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
}

.pagination-btn {
    padding: 0.75rem 1.5rem;
    background: var(--gallery-primary);
    color: white;
    border: none;
    border-radius: var(--gallery-border-radius);
    cursor: pointer;
    transition: var(--gallery-transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    user-select: none; /* Empêche la sélection de texte */
}

.pagination-btn:hover:not(:disabled) {
    background: var(--gallery-dark);
    transform: translateY(-2px);
}

.pagination-btn:active:not(:disabled) {
    transform: translateY(0); /* Retour à la position normale au clic */
}

.pagination-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.page-numbers {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.page-btn {
    padding: 0.5rem 1rem;
    background: white;
    border: 2px solid var(--gallery-light);
    border-radius: 8px;
    color: var(--gallery-text);
    cursor: pointer;
    transition: var(--gallery-transition);
    min-width: 40px;
    text-align: center;
    font-weight: 500;
    user-select: none; /* Empêche la sélection de texte */
}

.page-btn:hover {
    border-color: var(--gallery-secondary);
    background: var(--gallery-light);
    transform: translateY(-2px);
    box-shadow: var(--gallery-shadow);
}

.page-btn.active {
    background: var(--gallery-primary);
    color: white;
    border-color: var(--gallery-primary);
    font-weight: 600;
}

.page-btn:active {
    transform: translateY(0); /* Retour à la position normale au clic */
}

.page-ellipsis {
    padding: 0.5rem;
    color: #666;
}

/* ===== MODAL ===== */
.image-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.modal-content {
    background: white;
    border-radius: var(--gallery-border-radius);
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    position: relative;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.close-modal {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 2rem;
    color: white;
    cursor: pointer;
    z-index: 1001;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--gallery-transition);
}

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

.modal-image-container {
    position: relative;
}

#modal-image {
    width: 100%;
    height: auto;
    max-height: 70vh;
    object-fit: contain;
}

.modal-info {
    padding: 2rem;
    background: white;
}

#modal-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--gallery-text);
}

#modal-description {
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    color: #666;
}

.modal-meta {
    display: flex;
    gap: 2rem;
    font-size: 0.9rem;
    color: var(--gallery-primary);
    font-weight: 500;
}

.modal-navigation {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 1rem;
    pointer-events: none;
}

.modal-nav-btn {
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--gallery-transition);
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-nav-btn:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

/* ===== ÉTAT VIDE ===== */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: #666;
}

.empty-state i {
    font-size: 4rem;
    color: #ddd;
    margin-bottom: 1rem;
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--gallery-text);
}

.empty-state p {
    font-size: 1rem;
    margin-bottom: 2rem;
    line-height: 1.6;
}

.btn-primary {
    background: var(--gallery-primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--gallery-border-radius);
    cursor: pointer;
    transition: var(--gallery-transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

.btn-primary:hover {
    background: var(--gallery-dark);
    transform: translateY(-2px);
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1024px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 1.5rem;
    }
    
    .gallery-title {
        font-size: 3rem;
    }
    
    .gallery-stats {
        gap: 2rem;
    }
}

@media (max-width: 768px) {
    .gallery-header {
        padding: 3rem 0 2rem;
    }
    
    .gallery-title {
        font-size: 2.5rem;
    }
    
    .gallery-subtitle {
        font-size: 1.1rem;
    }
    
    .gallery-stats {
        gap: 1.5rem;
    }
    
    .stat-item {
        min-width: 100px;
        padding: 1rem;
    }
    
    .filter-buttons {
        gap: 0.75rem;
    }
    
    .filter-btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1rem;
    }
    
    .modal-content {
        max-width: 95vw;
        margin: 1rem;
    }
    
    .modal-info {
        padding: 1.5rem;
    }
    
    .modal-navigation {
        padding: 0 0.5rem;
    }
    
    .modal-nav-btn {
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 480px) {
    .gallery-title {
        font-size: 2rem;
    }
    
    .gallery-subtitle {
        font-size: 1rem;
    }
    
    .gallery-stats {
        flex-direction: column;
        gap: 1rem;
    }
    
    .stat-item {
        min-width: auto;
        width: 100%;
        max-width: 200px;
    }
    
    .filter-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .filter-btn {
        width: 100%;
        max-width: 200px;
        justify-content: center;
    }
    
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .search-bar {
        max-width: 100%;
    }
    
    .pagination-btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }
    
    .page-btn {
        padding: 0.4rem 0.8rem;
        min-width: 35px;
    }
}

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

.gallery-item {
    animation: fadeInUp 0.6s ease-out;
}

.gallery-item:nth-child(2) { animation-delay: 0.1s; }
.gallery-item:nth-child(3) { animation-delay: 0.2s; }
.gallery-item:nth-child(4) { animation-delay: 0.3s; }
.gallery-item:nth-child(5) { animation-delay: 0.4s; }
.gallery-item:nth-child(6) { animation-delay: 0.5s; }

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

.gallery-item:focus-within {
    outline: 3px solid var(--gallery-accent);
    outline-offset: 2px;
}

.filter-btn:focus,
.pagination-btn:focus,
.page-btn:focus {
    outline: 3px solid var(--gallery-accent);
    outline-offset: 2px;
}

/* ===== LOADING STATES ===== */
.gallery-item.loading {
    opacity: 0.7;
    pointer-events: none;
}

.gallery-item.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--gallery-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
