/* ============================================================
   PhotoGallery — Front CSS — Tous les thèmes
   ============================================================ */

.pg-gallery {
    --pg-cols: 3;
    --pg-thumb-h: 220px;
    --pg-gap: 12px;
    --pg-radius: 8px;
    margin: 24px 0;
}

.pg-gallery-title {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0 0 8px;
}

.pg-gallery-desc {
    color: #666;
    margin: 0 0 18px;
    line-height: 1.6;
}

/* ===========================
   GRILLE CLASSIQUE
   =========================== */
.pg-theme-grid .pg-grid-wrap,
.pg-theme-masonry .pg-grid-wrap {
    display: grid;
    grid-template-columns: repeat(var(--pg-cols), 1fr);
    gap: var(--pg-gap);
}

.pg-theme-masonry .pg-grid-wrap {
    grid-auto-rows: auto;
    align-items: start;
}

.pg-theme-masonry .pg-item:nth-child(3n+1) .pg-item-inner { padding-bottom: 75%; }
.pg-theme-masonry .pg-item:nth-child(3n+2) .pg-item-inner { padding-bottom: 125%; }
.pg-theme-masonry .pg-item:nth-child(3n+3) .pg-item-inner { padding-bottom: 90%; }

.pg-item-inner {
    position: relative;
    overflow: hidden;
    border-radius: var(--pg-radius);
    background: #f0f0f0;
    padding-bottom: var(--pg-thumb-h);
}

.pg-theme-grid .pg-item-inner {
    padding-bottom: 0;
    height: var(--pg-thumb-h);
}

.pg-item-inner img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.pg-item:hover .pg-item-inner img { transform: scale(1.06); }

.pg-item-caption {
    position: absolute;
    bottom: 0;
    left: 0; right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.65));
    color: #fff;
    padding: 24px 12px 10px;
    font-size: 0.85rem;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.25s, transform 0.25s;
}

.pg-item:hover .pg-item-caption {
    opacity: 1;
    transform: translateY(0);
}

/* ===========================
   JUSTIFIED
   =========================== */
.pg-theme-justified .pg-grid-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: var(--pg-gap);
}

.pg-theme-justified .pg-item {
    flex: 1 1 200px;
    max-width: 400px;
}

.pg-theme-justified .pg-item-inner {
    padding-bottom: 0;
    height: var(--pg-thumb-h);
}

/* ===========================
   CARROUSEL
   =========================== */
.pg-carousel-wrapper {
    position: relative;
    overflow: hidden;
    border-radius: var(--pg-radius);
    background: #111;
}

.pg-carousel-track {
    display: flex;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.pg-carousel-slide {
    flex: 0 0 100%;
    position: relative;
}

.pg-carousel-slide img {
    width: 100%;
    max-height: 500px;
    object-fit: contain;
    display: block;
}

.pg-slide-caption {
    position: absolute;
    bottom: 0;
    left: 0; right: 0;
    background: rgba(0,0,0,0.6);
    color: #fff;
    padding: 10px 16px;
    margin: 0;
    font-size: 0.9rem;
    text-align: center;
}

.pg-carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    font-size: 2.5rem;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    transition: background 0.2s;
    z-index: 10;
    line-height: 1;
    padding: 0;
}

.pg-carousel-btn:hover { background: rgba(255,255,255,0.3); }
.pg-prev { left: 12px; }
.pg-next { right: 12px; }

.pg-carousel-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 12px 0 8px;
}

.pg-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(0,0,0,0.2);
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

.pg-dot.active {
    background: #333;
    transform: scale(1.3);
}

/* ===========================
   CINÉMATIQUE
   =========================== */
.pg-cinematic {
    position: relative;
    background: #000;
    border-radius: var(--pg-radius);
    overflow: hidden;
}

.pg-cine-item {
    display: none;
    position: relative;
    cursor: pointer;
}

.pg-cine-item.active { display: block; }

.pg-cine-item img {
    width: 100%;
    max-height: 520px;
    object-fit: contain;
    display: block;
}

.pg-cine-caption {
    position: absolute;
    bottom: 60px;
    left: 0; right: 0;
    text-align: center;
    color: #fff;
    font-size: 1.1rem;
    text-shadow: 0 2px 8px rgba(0,0,0,0.6);
    padding: 0 20px;
}

.pg-cine-thumbs {
    display: flex;
    gap: 6px;
    padding: 10px;
    background: rgba(0,0,0,0.8);
    overflow-x: auto;
    scrollbar-width: thin;
}

.pg-cine-thumb {
    width: 60px;
    height: 45px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s, transform 0.2s;
    flex-shrink: 0;
    border: 2px solid transparent;
}

.pg-cine-thumb.active {
    opacity: 1;
    border-color: #fff;
    transform: scale(1.08);
}

/* ===========================
   LIGHTBOX
   =========================== */
.pg-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.92);
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    animation: pgLbFadeIn 0.25s ease;
}

@keyframes pgLbFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.pg-lb-content {
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#pg-lb-img {
    max-width: 90vw;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 6px;
    animation: pgLbSlide 0.3s ease;
}

@keyframes pgLbSlide {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
}

#pg-lb-caption {
    color: rgba(255,255,255,0.75);
    font-size: 0.9rem;
    margin: 10px 0 0;
    text-align: center;
}

.pg-lb-close, .pg-lb-prev, .pg-lb-next {
    position: fixed;
    background: rgba(255,255,255,0.1);
    border: none;
    color: #fff;
    cursor: pointer;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    transition: background 0.2s, transform 0.2s;
    z-index: 10;
    padding: 0;
    line-height: 1;
}

.pg-lb-close  { top: 16px; right: 16px; font-size: 1rem; }
.pg-lb-prev   { left: 16px; top: 50%; transform: translateY(-50%); font-size: 2rem; }
.pg-lb-next   { right: 16px; top: 50%; transform: translateY(-50%); font-size: 2rem; }

.pg-lb-close:hover  { background: rgba(255,255,255,0.25); }
.pg-lb-prev:hover, .pg-lb-next:hover { background: rgba(255,255,255,0.2); }

.pg-lb-counter {
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255,255,255,0.5);
    font-size: 0.85rem;
}

/* ===========================
   RESPONSIVE
   =========================== */
@media (max-width: 768px) {
    .pg-theme-grid .pg-grid-wrap,
    .pg-theme-masonry .pg-grid-wrap {
        grid-template-columns: repeat(2, 1fr);
    }

    .pg-theme-justified .pg-item {
        flex: 1 1 140px;
    }
}

@media (max-width: 480px) {
    .pg-theme-grid .pg-grid-wrap,
    .pg-theme-masonry .pg-grid-wrap {
        grid-template-columns: 1fr 1fr;
    }

    .pg-carousel-btn { width: 36px; height: 36px; font-size: 1.8rem; }
}

/* ===========================
   ONGLETS MULTI-ALBUMS
   =========================== */
.pg-tabs-mobile {
    display: none;
    margin-bottom: 20px;
}

.pg-tabs-mobile select {
    width: 100%;
    padding: 10px 14px;
    font-size: 1rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    appearance: auto;
}

.pg-tabs-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    border-bottom: 2px solid #dee2e6;
    margin-bottom: 24px;
    padding: 0;
    list-style: none;
}

.pg-tabs-nav .nav-item {
    margin-bottom: -2px;
}

.pg-tabs-nav .nav-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border: 2px solid transparent;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    color: #555;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    transition: color 0.2s, background 0.2s;
    background: #f8f9fa;
}

.pg-tabs-nav .nav-link:hover {
    color: #333;
    background: #eef0f2;
}

.pg-tabs-nav .nav-link.active {
    color: #333;
    background: #fff;
    border-color: #dee2e6;
    border-bottom-color: #fff;
}

.pg-tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #e9ecef;
    border-radius: 10px;
    color: #666;
}

.pg-tabs-nav .nav-link.active .pg-tab-count {
    background: #dee2e6;
}

.pg-tabs-content {
    position: relative;
}

.pg-tab-pane {
    display: none;
}

.pg-tab-pane.active {
    display: block;
    animation: pgTabFadeIn 0.2s ease;
}

@keyframes pgTabFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.pg-no-photos {
    padding: 32px;
    text-align: center;
    color: #999;
}

/* Mobile : masquer les onglets, afficher le select */
@media (max-width: 600px) {
    .pg-tabs-nav  { display: none; }
    .pg-tabs-mobile { display: block; }
}

/* ===========================
   ONGLETS MULTI-ALBUMS
   =========================== */
.pg-tabs-mobile { display: none; margin-bottom: 20px; }
.pg-tabs-mobile select {
    width: 100%; padding: 10px 14px; font-size: 1rem;
    border: 1px solid #ddd; border-radius: 6px;
    background: #fff; cursor: pointer;
}

.pg-tabs-nav {
    display: flex; flex-wrap: wrap; gap: 2px;
    border-bottom: 2px solid #dee2e6;
    margin-bottom: 24px; padding: 0; list-style: none;
}
.pg-tabs-nav .nav-item { margin-bottom: -2px; }
.pg-tabs-nav .nav-link {
    display: inline-block; padding: 10px 18px;
    border: 2px solid transparent; border-bottom: none;
    border-radius: 6px 6px 0 0;
    color: #555; text-decoration: none;
    font-weight: 500; font-size: 0.95rem;
    cursor: pointer; background: #f8f9fa;
    transition: color 0.2s, background 0.2s;
}
.pg-tabs-nav .nav-link:hover { color: #333; background: #eef0f2; }
.pg-tabs-nav .nav-link.active {
    color: #333; background: #fff;
    border-color: #dee2e6; border-bottom-color: #fff;
}

.pg-tabs-content { position: relative; }
.pg-tab-pane { display: none; }
.pg-tab-pane.active { display: block; animation: pgTabFadeIn 0.2s ease; }

@keyframes pgTabFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Sous-onglets */
.pg-subtabs-nav {
    display: flex; flex-wrap: wrap; gap: 4px;
    list-style: none; padding: 16px 0 0; margin: 0 0 20px;
    border-bottom: 1px solid #e9ecef;
}
.pg-subtab-item { margin-bottom: -1px; }
.pg-subtab-link {
    display: inline-block; padding: 7px 16px;
    border: 1px solid transparent; border-bottom: none;
    border-radius: 4px 4px 0 0;
    color: #777; text-decoration: none;
    font-size: 0.88rem; font-weight: 500;
    cursor: pointer; background: transparent;
    transition: color 0.2s, background 0.2s;
}
.pg-subtab-link:hover { color: #444; background: #f4f5f6; }
.pg-subtab-link.active {
    color: #333; background: #fff;
    border-color: #e9ecef; border-bottom-color: #fff;
}

.pg-subtabs-content { position: relative; }
.pg-subtab-pane { display: none; }
.pg-subtab-pane.active { display: block; animation: pgTabFadeIn 0.2s ease; }

.pg-no-photos { padding: 32px; text-align: center; color: #999; }

@media (max-width: 600px) {
    .pg-tabs-nav { display: none; }
    .pg-tabs-mobile { display: block; }
}
