.waip-gallery-list {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.waip-gallery-item {
    padding: 8px;
    box-sizing: border-box;
}

/* Columns */
.waip-columns-1 .waip-gallery-item { width: 100%; }
.waip-columns-2 .waip-gallery-item { width: calc(50% - 16px); }
.waip-columns-3 .waip-gallery-item { width: calc(33.333% - 16px); }
.waip-columns-4 .waip-gallery-item { width: calc(25% - 16px); }
.waip-columns-5 .waip-gallery-item { width: calc(20% - 16px); }

.waip-gallery-thumb-wrap {
    position: relative;
    overflow: hidden;
}

.waip-gallery-thumb-wrap img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Overlay container */
.waip-gallery-meta-overlay {
    position: absolute;
    padding: 4px 8px;
    line-height: 1.3;
    border-radius: 3px;
    /* background comes from inline style now */
}

/* Positions */
.waip-meta-top-left {
    top: 8px;
    left: 8px;
}

.waip-meta-top-right {
    top: 8px;
    right: 8px;
}

.waip-meta-bottom-left {
    bottom: 8px;
    left: 8px;
}

.waip-meta-bottom-right {
    bottom: 8px;
    right: 8px;
}

.waip-meta-author,
.waip-meta-license {
    display: block;
}

.waip-gallery-meta {
    margin-top: 4px;
}

.waip-gallery-title {
    margin: 0;
    font-size: 1rem;
    font-weight: bold;
    align-content: center;  
}

/* Pagination */
.waip-gallery-pagination {
    margin-top: 16px;
    text-align: center;
}

.waip-gallery-pagination .waip-page-link {
    display: inline-block;
    margin: 0 4px;
    padding: 4px 8px;
    text-decoration: none;
    border: 1px solid #ddd;
}

.waip-gallery-pagination .waip-page-link-current {
    background: #0073aa;
    color: #fff;
    border-color: #0073aa;
}
/* WAIP blocks – front-end layout */
.wp-block-waip-image,
.wp-block-waip-gallery {
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
}

/* Gør billederne responsive */
.wp-block-waip-image img,
.wp-block-waip-gallery img {
    display: block;
    max-width: 100%;
    height: auto;
}
.wp-block-waip-image .waip-image-caption,
.wp-block-waip-gallery .waip-gallery-caption {  
    text-align: center;
    font-size: 90%;
    color: #666;
    margin-top: 6px;
}   
.wp-block-waip-gallery .waip-gallery-images {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}   
.wp-block-waip-gallery .waip-gallery-images img {
    border: 1px solid #ddd;
    padding: 4px;
    background: #fff;
    max-width: calc(33% - 10px);
    box-sizing: border-box;
}   
@media (max-width: 600px) {
    .wp-block-waip-gallery .waip-gallery-images img {
        max-width: calc(50% - 10px);
    }
}   
@media (max-width: 400px) {
    .wp-block-waip-gallery .waip-gallery-images img {
        max-width: 100%;
    }
}   
/* WAIP lightbox / modal */
.waip-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}

.waip-lightbox[aria-hidden="false"] {
    display: flex;
}

.waip-lightbox__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
}

.waip-lightbox__content {
    position: relative;
    z-index: 1;
    max-width: 90vw;
    max-height: 90vh;
    background: #fff;
    padding: 8px;
    box-sizing: border-box;
    border-radius: 4px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.6);
}


.waip-lightbox__image {
    display: block;
    height: 80vh;         /* Fast højde */
    width: auto;          /* Bevar proportioner */
    max-width: 100%;      
    object-fit: contain;  /* Sørger for korrekt skalering */
    margin: 0 auto;
}

.waip-lightbox__caption {
    margin-top: 8px;
    font-size: 14px;
    color: #000;
    text-align: center;
}

.waip-lightbox__close {
    position: absolute;
    top: 4px;
    right: 6px;
    border: none;
    background: transparent;
    color: #000;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

/* Lås scroll når lightbox er åben */
body.waip-lightbox-open {
    overflow: hidden;
}
.waip-lightbox__arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    font-size: 32px;
    line-height: 1;
    width: 44px;
    height: 44px;
    border-radius: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.waip-lightbox__arrow:hover {
    background: rgba(0, 0, 0, 0.7);
}

.waip-lightbox__arrow--prev {
    left: 8px;
}

.waip-lightbox__arrow--next {
    right: 8px;
}
/* Front-end gallery editing */
.waip-front-toolbar {
    margin-bottom: 8px;
    display: flex;
    gap: 8px;
}

.waip-front-toolbar__edit,
.waip-front-toolbar__add {
    padding: 4px 10px;
    font-size: 13px;
    cursor: pointer;
    border: 1px solid #007cba;
    background: #f0f6fc;
    color: #007cba;
    border-radius: 3px;
}

.waip-front-toolbar__edit:hover,
.waip-front-toolbar__add:hover {
    background: #e2efff;
}

.waip-gallery-item {
    position: relative;
}

.waip-gallery-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    z-index: 3;
    border: none;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 2px;
    cursor: pointer;
    display: none; /* toggles via JS in edit mode */
}

.waip-gallery-edit-mode .waip-gallery-item {
    outline: 1px dashed #007cba;
    cursor: move;
}
/* Soft-UI front toolbar with icons */
.waip-front-toolbar {
    margin-bottom: 10px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.waip-front-toolbar__edit,
.waip-front-toolbar__add {
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    background: #f8f9fb;
    border: 1px solid #d0d7e2;
    color: #2c3e50;
    box-shadow:
        2px 2px 5px rgba(0,0,0,0.08),
        -2px -2px 5px rgba(255,255,255,0.8);
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px; /* ikon + tekst */
}

.waip-front-toolbar__edit:hover,
.waip-front-toolbar__add:hover {
    background: #ffffff;
    border-color: #b7c4d6;
    box-shadow:
        3px 3px 7px rgba(0,0,0,0.12),
        -3px -3px 7px rgba(255,255,255,1);
}

.waip-front-toolbar__edit:active,
.waip-front-toolbar__add:active {
    box-shadow:
        inset 2px 2px 4px rgba(0,0,0,0.15),
        inset -2px -2px 4px rgba(255,255,255,1);
}

/* Remove-knap (lille, diskret, glide ind) */
.waip-gallery-item {
    position: relative;
}

.waip-gallery-remove {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 3;
    border: none;
    background: rgba(220, 53, 69, 0.92);
    color: white;
    padding: 2px 6px;
    font-size: 11px;
    border-radius: 6px;
    cursor: pointer;
    opacity: 0;
    transform: translateY(-4px);
    transition: 0.18s ease;
    font-weight: 600;
    line-height: 1.2;
    display: none; /* toggles in JS */
}

.waip-gallery-item:hover .waip-gallery-remove {
    opacity: 1;
    transform: translateY(0);
}

/* Edit-mode highlight */
.waip-gallery-edit-mode .waip-gallery-item {
    outline: 2px dashed #007cba;
    border-radius: 8px;
    padding: 2px;
    cursor: grab;
}

/* Edit-mode badge */
.waip-gallery-edit-badge {
    font-size: 12px;
    color: #0b4f7a;
    background: #e5f3ff;
    border: 1px solid #b3d9ff;
    padding: 4px 8px;
    border-radius: 6px;
    margin-bottom: 6px;
    opacity: 0;
    transform: translateY(-4px);
    transition: 0.18s ease;
}

.waip-gallery-edit-badge.is-visible {
    opacity: 1;
    transform: translateY(0);
}
.waip-remove-popover {
    display: none; /* JS toggler den */
    font-size: 12px;
    color: #0b4f7a;
    background: #e5f3ff;
    border: 1px solid #b3d9ff;
    padding: 4px 8px;
    border-radius: 6px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.waip-remove-popover__actions {
    display: flex;
    gap: 4px;
}

.waip-remove-popover__yes,
.waip-remove-popover__no {
    border-radius: 4px;
    border: 1px solid #d0d7e2;
    background: #f8f9fb;
    font-size: 11px;
    padding: 2px 8px;
    cursor: pointer;
    color: #2c3e50;
}

.waip-remove-popover__btn.is-active {
    border-color: #007cba;
    background: #e2efff;
    color: #007cba;
}
