/* ============================================================
   gallery-styles.css — Pages galeries photo (index + galeries MSP1/N3PP/FFP3)
   Réutilise les styles supervision pour links-grid / link-card
   ============================================================ */

/* Wrapper galerie — #main est dans #wrapper ; les templates ajoutent wrapper_class */
#wrapper.gallery-landing-wrapper #main,
#wrapper.gallery-page-wrapper #main,
#wrapper.gallery-timelapse-wrapper #main {
    background-color: var(--bg-main) !important;
}

#wrapper.gallery-landing-wrapper .section-header,
#wrapper.gallery-page-wrapper .section-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin: 40px 0 20px 0;
    padding-bottom: 10px;
    border-bottom: 3px solid #008B74;
}
#wrapper.gallery-landing-wrapper .section-header h2,
#wrapper.gallery-page-wrapper .section-header h2 {
    margin: 0;
    color: #008B74;
    font-size: 2em;
}
#wrapper.gallery-landing-wrapper .section-header i,
#wrapper.gallery-page-wrapper .section-header i {
    font-size: 2em;
    color: #008B74;
}

#wrapper.gallery-landing-wrapper .links-grid,
#wrapper.gallery-page-wrapper .links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    margin: 20px 0;
}

#wrapper.gallery-landing-wrapper .link-card,
#wrapper.gallery-page-wrapper .link-card {
    display: block;
    padding: 18px 20px;
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,139,116,0.15);
    border-left: 4px solid #008B74;
    text-decoration: none;
    color: #2c3e50;
    transition: transform 0.2s, box-shadow 0.2s;
}
#wrapper.gallery-landing-wrapper .link-card:hover,
#wrapper.gallery-page-wrapper .link-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,139,116,0.25);
    color: #008B74;
}
#wrapper.gallery-landing-wrapper .link-card .label,
#wrapper.gallery-page-wrapper .link-card .label {
    font-weight: 600;
    font-size: 1.1em;
    display: block;
    margin-bottom: 4px;
}
#wrapper.gallery-landing-wrapper .link-card .hint,
#wrapper.gallery-page-wrapper .link-card .hint {
    font-size: 0.9em;
    color: #6c757d;
}

/* Grille photos */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin: 24px 0;
}
.gallery-item-link {
    display: block;
    border-radius: 8px;
    overflow: hidden;
}
.gallery-item img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
    cursor: zoom-in;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.gallery-item-link:hover img {
    transform: scale(1.02);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.16);
}

/* Pagination */
.gallery-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px 8px;
    margin: 1.5rem 0 0.75rem;
    padding: 12px 14px;
    background: #f0f4f3;
    border-radius: 12px;
    border: 1px solid rgba(0, 139, 116, 0.12);
}
.gallery-pagination a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.25rem;
    height: 2.25rem;
    padding: 0 10px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    color: #008B74;
    text-decoration: none;
    background: var(--bg-card);
    border: 1px solid rgba(0, 139, 116, 0.2);
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.gallery-pagination a:hover {
    background: #008B74;
    color: #fff;
    border-color: #008B74;
}
.gallery-pagination .current {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.25rem;
    height: 2.25rem;
    padding: 0 10px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.9rem;
    color: #fff;
    background: #008B74;
    border: 1px solid #008B74;
}
.gallery-pagination-ellipsis {
    color: #94a3b8;
    font-weight: 600;
    letter-spacing: 0.05em;
    user-select: none;
    padding: 0 2px;
}
.gallery-pagination .gallery-nav-prevnext {
    min-width: auto;
    padding: 0 14px;
    font-size: 0.85rem;
}
.gallery-empty {
    text-align: center;
    padding: 48px 24px;
    color: #6c757d;
}
.gallery-empty i {
    font-size: 3em;
    margin-bottom: 16px;
    color: #008B74;
}
.gallery-back {
    display: inline-block;
    margin: 8px 8px 8px 0;
    padding: 8px 16px;
    background: #008B74;
    color: white !important;
    text-decoration: none;
    border-radius: 8px;
}
.gallery-back:hover {
    background: #00B794;
}

/* Hero page galerie (mode clair) */
.gallery-hero {
    margin: 0 0 1.25rem 0;
}

.gallery-hero h1 {
    margin: 0 0 0.5rem 0;
    color: #2c3e50;
    font-size: 2em;
}

.gallery-hero h1 i {
    color: #008B74;
    margin-right: 10px;
}

.gallery-hero p {
    margin: 0;
    color: #6c757d;
    font-size: 1.05em;
}

/* Encart liens admin */
.gallery-others {
    margin-bottom: 20px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
}

.gallery-others a {
    margin: 0 8px;
}

.gallery-pagination-summary {
    text-align: center;
    margin: 0 0 1rem;
    font-size: 0.85rem;
    color: #64748b;
}

/* Landing galeries (styles externalises depuis le template) */
.gallery-landing-page {
    padding: 2rem 0;
}

.gallery-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.gallery-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
}

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

.gallery-card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.gallery-card-icon {
    font-size: 2.5em;
    color: var(--accent-primary);
}

.gallery-card-title {
    font-size: 1.5em;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.gallery-card-description {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1.5rem;
    flex-grow: 1;
}

.gallery-card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 1rem;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.gallery-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.gallery-card-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--accent-primary);
    color: var(--text-inverse);
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s ease;
    margin-top: auto;
}

.gallery-card-link:hover {
    background: var(--accent-primary-hover);
    transform: translateX(4px);
}

.gallery-card-no-photo {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    font-size: 0.9em;
}

.gallery-card-no-photo i {
    font-size: 3em;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

/* Landing page galeries : 3 cartes avec dernière photo + texte */
.gallery-landing {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 16px;
}
.gallery-landing-header {
    margin-bottom: 36px;
    text-align: center;
}
.gallery-landing-header h1 {
    margin: 0 0 12px 0;
    color: #2c3e50;
    font-size: 2em;
}
.gallery-landing-header h1 i {
    margin-right: 10px;
    color: #008B74;
}
.gallery-landing-header p {
    margin: 0;
    color: #6c757d;
    font-size: 1.05em;
    line-height: 1.5;
}
.gallery-landing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}
.gallery-landing-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,139,116,0.12);
    border: 1px solid rgba(0,139,116,0.2);
    text-decoration: none;
    color: inherit;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}
.gallery-landing-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,139,116,0.2);
}
.gallery-landing-card-image {
    aspect-ratio: 4/3;
    background: #f0f4f3;
    overflow: hidden;
}
.gallery-landing-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.gallery-landing-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #9ca3a8;
}
.gallery-landing-placeholder i {
    font-size: 3em;
    margin-bottom: 8px;
}
.gallery-landing-card-body {
    padding: 20px;
}
.gallery-landing-card-body h2 {
    margin: 0 0 10px 0;
    font-size: 1.2em;
    color: #008B74;
}
.gallery-landing-card-body p {
    margin: 0 0 12px 0;
    font-size: 0.95em;
    line-height: 1.5;
    color: #4a5568;
}
.gallery-landing-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    color: #008B74;
    font-size: 0.9em;
}
.gallery-landing-card:hover .gallery-landing-cta {
    color: #00B794;
}

/* ============================================================
   Lightbox galeries — overlay plein écran au clic
   ============================================================ */
.gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}
.gallery-lightbox.gallery-lightbox-open {
    opacity: 1;
    visibility: visible;
}
.gallery-lightbox-img {
    max-width: 95vw;
    max-height: 90vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    cursor: zoom-out;
}
.gallery-lightbox-caption {
    position: absolute;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.95rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}
.gallery-lightbox-close,
.gallery-lightbox-prev,
.gallery-lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.25rem;
    transition: background 0.2s, color 0.2s;
    text-decoration: none;
}
.gallery-lightbox-close:hover,
.gallery-lightbox-prev:hover,
.gallery-lightbox-next:hover {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}
.gallery-lightbox-close {
    top: 1rem;
    right: 1rem;
    transform: none;
}
.gallery-lightbox-prev {
    left: 1rem;
}
.gallery-lightbox-next {
    right: 1rem;
}
@media (max-width: 640px) {
    .gallery-lightbox-prev,
    .gallery-lightbox-next {
        width: 40px;
        height: 40px;
        left: 0.5rem;
        right: 0.5rem;
    }
}

/* ============================================================
   Mode sombre — Pages galeries classiques
   ============================================================ */

[data-theme="dark"] #wrapper.gallery-landing-wrapper #main,
[data-theme="dark"] #wrapper.gallery-page-wrapper #main,
[data-theme="dark"] #wrapper.gallery-timelapse-wrapper #main {
    background-color: var(--bg-main) !important;
}

[data-theme="dark"] .gallery-landing-page {
    background: var(--bg-main);
}

[data-theme="dark"] .gallery-card {
    background: var(--bg-card);
    border-color: var(--border-color);
}

[data-theme="dark"] .gallery-card-image {
    background: var(--bg-secondary);
}

[data-theme="dark"] #wrapper.gallery-landing-wrapper .section-header,
[data-theme="dark"] #wrapper.gallery-page-wrapper .section-header {
    border-bottom-color: var(--accent-primary);
}

[data-theme="dark"] #wrapper.gallery-landing-wrapper .section-header h2,
[data-theme="dark"] #wrapper.gallery-page-wrapper .section-header h2 {
    color: var(--accent-primary);
}

[data-theme="dark"] #wrapper.gallery-landing-wrapper .section-header i,
[data-theme="dark"] #wrapper.gallery-page-wrapper .section-header i {
    color: var(--accent-primary);
}

[data-theme="dark"] #wrapper.gallery-landing-wrapper .link-card,
[data-theme="dark"] #wrapper.gallery-page-wrapper .link-card {
    background: var(--bg-card);
    border-left-color: var(--accent-primary);
    color: var(--text-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] #wrapper.gallery-landing-wrapper .link-card:hover,
[data-theme="dark"] #wrapper.gallery-page-wrapper .link-card:hover {
    box-shadow: 0 6px 16px rgba(45, 212, 191, 0.3);
    color: var(--accent-primary);
}

[data-theme="dark"] #wrapper.gallery-landing-wrapper .link-card .hint,
[data-theme="dark"] #wrapper.gallery-page-wrapper .link-card .hint {
    color: var(--text-secondary);
}

[data-theme="dark"] .gallery-pagination {
    background: var(--bg-secondary);
    border-color: var(--accent-border);
}

[data-theme="dark"] .gallery-pagination a {
    background: var(--bg-card);
    border-color: var(--accent-border);
    color: var(--accent-primary);
}

[data-theme="dark"] .gallery-pagination a:hover {
    background: var(--accent-primary);
    color: var(--text-inverse);
    border-color: var(--accent-primary);
}

[data-theme="dark"] .gallery-pagination .current {
    background: var(--accent-primary);
    color: var(--text-inverse);
    border-color: var(--accent-primary);
}

[data-theme="dark"] .gallery-pagination-ellipsis {
    color: var(--text-muted);
}

[data-theme="dark"] .gallery-pagination-summary {
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .gallery-empty {
    color: var(--text-secondary);
}

[data-theme="dark"] .gallery-empty i {
    color: var(--accent-primary);
}

[data-theme="dark"] .gallery-back {
    background: var(--accent-primary);
    color: var(--text-inverse) !important;
}

[data-theme="dark"] .gallery-back:hover {
    background: var(--accent-primary-hover);
}

[data-theme="dark"] .gallery-hero {
    color: var(--text-primary);
}

[data-theme="dark"] .gallery-hero h1 {
    color: var(--text-primary);
}

[data-theme="dark"] .gallery-hero h1 i {
    color: var(--accent-primary);
}

[data-theme="dark"] .gallery-hero p {
    color: var(--text-secondary);
}

[data-theme="dark"] .gallery-others {
    background: var(--bg-secondary) !important;
    border-color: var(--border-color);
}

[data-theme="dark"] .gallery-others strong {
    color: var(--text-primary);
}

[data-theme="dark"] .gallery-others a {
    color: var(--accent-primary);
}

[data-theme="dark"] .gallery-others a:hover {
    color: var(--accent-primary-hover);
}

[data-theme="dark"] .gallery-item img {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .gallery-photo-count {
    color: var(--text-secondary);
}

[data-theme="dark"] .gallery-landing-header h1 {
    color: var(--text-primary);
}

[data-theme="dark"] .gallery-landing-header h1 i {
    color: var(--accent-primary);
}

[data-theme="dark"] .gallery-landing-header p {
    color: var(--text-secondary);
}

[data-theme="dark"] .gallery-landing-card {
    background: var(--bg-card);
    border-color: var(--accent-border);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .gallery-landing-card:hover {
    box-shadow: 0 8px 24px rgba(45, 212, 191, 0.2);
}

[data-theme="dark"] .gallery-landing-card-image {
    background: var(--bg-secondary);
}

[data-theme="dark"] .gallery-landing-placeholder {
    color: var(--text-muted);
}

[data-theme="dark"] .gallery-landing-card-body h2 {
    color: var(--accent-primary);
}

[data-theme="dark"] .gallery-landing-card-body p {
    color: var(--text-secondary);
}

[data-theme="dark"] .gallery-landing-cta {
    color: var(--accent-primary);
}

[data-theme="dark"] .gallery-landing-card:hover .gallery-landing-cta {
    color: var(--accent-primary-hover);
}

[data-theme="dark"] .gallery-page {
    background: var(--bg-main);
    color: var(--text-primary);
}

[data-theme="dark"] .gallery-links {
    background: transparent;
}

[data-theme="dark"] .gallery-links .gallery-back {
    background: var(--accent-primary);
    color: var(--text-inverse) !important;
}

[data-theme="dark"] .gallery-links .gallery-back:hover {
    background: var(--accent-primary-hover);
}

.gallery-link-trash {
    color: #dc3545 !important;
}
[data-theme="dark"] .gallery-link-trash {
    color: #fca5a5 !important;
}

@media (max-width: 736px) {
    .gallery-cards {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .gallery-landing-header h1 {
        font-size: 2em;
    }
}
