/* ═══════════════════════════════════════════════════════════
   SWIPER LIGHTBOX
═══════════════════════════════════════════════════════════ */

/* ── Overlay ── */
.image-swiper-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(10, 20, 40, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: swiperFadeIn 0.3s ease;
}

.image-swiper-lightbox.active {
    display: flex;
}

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

/* ── Modal ── */
.swiper-container {
    position: relative;
    width: min(1060px, 98vw);
    height: min(90vh, 840px);
    background: var(--color-background, #fff);
    border-radius: 18px;
    border: 3px solid var(--color-border, #e5e7eb);
    overflow: hidden;
    display: grid;
    grid-template-rows: 62px 1fr 68px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2), 0 4px 16px rgba(0,0,0,0.08);
    animation: swiperSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    max-width: unset;
    padding: 0;
}

.swiper-container::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--color-primary, hsl(207,65%,45%)), var(--color-primary-light, hsl(207,65%,55%)));
    z-index: 20;
    border-radius: 18px 18px 0 0;
}

@keyframes swiperSlideUp {
    from { transform: translateY(20px) scale(0.97); opacity: 0; }
    to   { transform: translateY(0)    scale(1);    opacity: 1; }
}

/* ── Header */
.swiper-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 22px;
    height: 58px;
    background: var(--color-background-alt, hsl(207,65%,96%));
    border-bottom: 1px solid var(--color-border, #e5e7eb);
    flex-shrink: 0;
    margin-top: 4px;
    gap: 14px;
}

.swiper-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

/* Barre verticale */
.swiper-header-bar {
    width: 4px;
    height: 24px;
    background: var(--color-primary, hsl(207,65%,45%));
    border-radius: 2px;
    flex-shrink: 0;
}

/* Nœud timeline */
.swiper-header-node {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--color-background-alt, hsl(207,65%,96%));
    border: 3px solid var(--color-primary, hsl(207,65%,45%));
    flex-shrink: 0;
}

.swiper-header-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--color-text, #333);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: var(--font-family-base, "Poppins", sans-serif);
}

.swiper-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

/* Badge compteur*/
.swiper-counter {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--color-background-alt, hsl(207,65%,96%));
    color: var(--color-primary, hsl(207,65%,45%));
    border-radius: 20px;
    padding: 4px 14px;
    font-size: 0.72rem;
    font-weight: 600;
    font-family: var(--font-family-base, "Poppins", sans-serif);
    white-space: nowrap;

    position: static;
    transform: none;
    bottom: auto;
    left: auto;
    backdrop-filter: none;
    box-sizing: border-box;
}

/* Bouton fermer — dans le header */
.swiper-close {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 2px solid var(--color-border, #e5e7eb);
    background: var(--color-background, #fff);
    color: var(--color-text-light, #666);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
    font-family: var(--font-family-base, "Poppins", sans-serif);
    transition: all 0.2s ease;
    flex-shrink: 0;

    position: static;
    top: auto;
    right: auto;
    box-shadow: none;
    backdrop-filter: none;
    width: 34px;
    height: 34px;
}

.swiper-close:hover {
    border-color: var(--color-primary, hsl(207,65%,45%));
    color: var(--color-primary, hsl(207,65%,45%));
    background: var(--color-background-alt, hsl(207,65%,96%));
    transform: rotate(90deg);
    box-shadow: none;
}

.swiper-close svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
    filter: none;
}

/* ── Zone image principale ── */
.swiper-image-zone {
    position: relative;
    overflow: hidden;
    background: var(--color-secondary, #333);
    cursor: grab;
    min-height: 0;
}

.swiper-image-zone:active { cursor: grabbing; }

.swiper-main-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    animation: swiperImageIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    max-width: 100%;
    max-height: 100%;
}

@keyframes swiperImageIn {
    from { opacity: 0; transform: scale(0.97); }
    to   { opacity: 1; transform: scale(1); }
}

/* ── Flèches navigation ── */
.swiper-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 2px solid rgba(255,255,255,0.25);
    background: rgba(255,255,255,0.12);
    color: white;
    font-size: 1.4rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.22s ease;
    backdrop-filter: blur(8px);
    z-index: 10;
    box-shadow: none;
    line-height: 1;
    padding-bottom: 1px;
    font-family: var(--font-family-base, "Poppins", sans-serif);
}

.swiper-nav svg {
    width: 20px;
    height: 20px;
    fill: white;
    filter: none;
}

.swiper-nav:hover {
    background: var(--color-primary, hsl(207,65%,45%));
    border-color: var(--color-primary, hsl(207,65%,45%));
    box-shadow: 0 4px 16px rgba(30,100,180,0.4);
    transform: translateY(-50%) scale(1.06);
}

.swiper-nav.prev { left: 14px; }
.swiper-nav.next { right: 14px; }

.swiper-nav:disabled {
    opacity: 0.25;
    cursor: not-allowed;
    pointer-events: none;
}

/* ── Footer ── */
.swiper-footer {
    height: 68px;
    min-height: 68px;
    max-height: 68px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    background: var(--color-background, #fff);
    border-top: 1px solid var(--color-border, #e5e7eb);
    flex-shrink: 0;
    gap: 0;
    overflow: hidden;
    box-sizing: border-box;
}

/* Miniatures photos */
.swiper-thumbnails {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    width: 100%;
    max-width: 100%;
    padding: 4px 2px;
    scrollbar-width: none;

    position: static;
    bottom: auto;
    left: auto;
    transform: none;
    background: transparent;
    border-radius: 0;
    backdrop-filter: none;
    height: 52px;
    min-height: 52px;
    max-height: 52px;
    box-sizing: border-box;
    flex-shrink: 0;
}

.swiper-thumbnails::-webkit-scrollbar { display: none; }

/* Chaque miniature */
.swiper-thumbnail {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    max-height: 44px;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid transparent;
    flex-shrink: 0;
    display: block;
    overflow: hidden;
    opacity: 0.45;
    transition: all 0.22s ease;
    object-fit: cover;
    background: var(--color-background-alt, hsl(207,65%,96%));
}

.swiper-thumbnail img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

.swiper-thumbnail:hover:not(.active) {
    opacity: 0.75;
    transform: translateY(-2px);
}

.swiper-thumbnail.active {
    border-color: var(--color-primary, hsl(207,65%,45%));
    opacity: 1;
    box-shadow: 0 0 0 2px var(--color-background-alt, hsl(207,65%,96%)), 0 2px 8px rgba(30,100,180,0.25);
    transform: translateY(-2px);
}

/* ── Badge multi-images sur les cartes  */
.multi-images-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--color-primary, hsl(207,65%,45%));
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
    z-index: 5;
}

.multi-images-badge::before { content: '🖼️'; }

/* ── Responsive ── */
@media (max-width: 768px) {
    .image-swiper-lightbox { padding: 0; }

    .swiper-container {
        width: 100vw;
        height: 100dvh;
        border-radius: 0;
        border: none;
        border-top: 4px solid var(--color-primary, hsl(207,65%,45%));
        grid-template-rows: 56px 1fr 60px;
    }

    .swiper-container::before { display: none; }

    .swiper-nav {
        width: 38px;
        height: 38px;
        font-size: 1.2rem;
    }

    .swiper-nav svg { width: 18px; height: 18px; }
    .swiper-nav.prev { left: 10px; }
    .swiper-nav.next { right: 10px; }

    .swiper-header { padding: 0 14px; height: 52px; }

    .swiper-footer {
        height: 60px;
        min-height: 60px;
        max-height: 60px;
        padding: 0 10px;
        overflow: hidden;
    }

    .swiper-thumbnail {
        width: 38px;
        height: 38px;
        min-width: 38px;
        min-height: 38px;
        max-height: 38px;
        border-radius: 6px;
        flex-shrink: 0;
    }
}

/* ── Modes accessibilité ── */
.dark .swiper-container {
    border-color: var(--color-border);
}

.high-contrast .swiper-container {
    border: 3px solid var(--color-text);
}

/* ============================================
   STYLES ADMIN POUR IMAGES MULTIPLES
   ============================================ */

.selected-images-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin: 15px 0;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 10px;
    min-height: 100px;
}

.selected-images-container:empty::before {
    content: 'Aucune image sélectionnée. Cliquez sur "Ajouter des images" pour commencer.';
    color: #999;
    font-style: italic;
    text-align: center;
    display: block;
    padding: 30px;
}

.selected-image-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 10px;
    overflow: hidden;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.selected-image-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.selected-image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.selected-image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 8px;
    display: flex;
    justify-content: space-between;
    opacity: 0;
    transition: opacity 0.3s ease;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.5), transparent);
}

.selected-image-item:hover .selected-image-overlay {
    opacity: 1;
}

.btn-remove-image,
.btn-set-featured {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.6rem;
}

.btn-remove-image {
    color: #e74c3c;
}

.btn-remove-image:hover {
    background: #e74c3c;
    color: white;
}

.btn-set-featured {
    color: #f39c12;
}

.btn-set-featured:hover,
.btn-set-featured.active {
    background: #f39c12;
    color: white;
}

.image-order-badge {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
}

.featured-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}