.cohort-media {
    margin: 1em 0;
}

.cohort-media__status {
    padding: 0.5em 1em;
    border-radius: 4px;
    background: #eef7ee;
}

.cohort-media__status--fout {
    background: #fbeaea;
}

.cohort-media__toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75em 1.5em;
    margin-top: 2em;
    padding-top: 1.25em;
    border-top: 1px solid #eee;
}

.cohort-media__form {
    display: flex;
    align-items: center;
    gap: 0.5em;
    margin: 0;
}

.cohort-media__form button {
    background: #582234;
    color: #fff;
    border: 1px solid #582234;
    border-radius: 4px;
    padding: 0.5em 1em;
    font: inherit;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.cohort-media__form button:hover,
.cohort-media__form button:focus {
    background: #6d2a41;
    border-color: #6d2a41;
    color: #fff;
    transform: none;
    box-shadow: none;
}

.cohort-media__delete {
    margin: 0;
}

/* Filemanager-boom: mappen met een uitklap-driehoekje (native <details>),
   bestanden met icoon links en naam rechts, zoals een simpele Verkenner. */
.cohort-media__tree,
.cohort-media__tree-files {
    list-style: none;
    margin: 0;
    padding: 0;
}

.cohort-media__tree-files {
    margin-left: 1.6em;
}

.cohort-media__tree > li {
    border-bottom: 1px solid #eee;
}

.cohort-media__tree-files > li {
    border-top: 1px solid #eee;
}

.cohort-media__tree-file,
.cohort-media__tree-empty {
    display: flex;
    align-items: center;
    gap: 0.5em;
    padding: 0.5em 0.25em;
}

.cohort-media__tree-empty {
    color: #888;
    font-style: italic;
}

.cohort-media__tree-folder > summary {
    display: flex;
    align-items: center;
    gap: 0.5em;
    padding: 0.5em 0.25em;
    cursor: pointer;
    list-style: none;
}

.cohort-media__tree-folder > summary::-webkit-details-marker {
    display: none;
}

.cohort-media__tree-folder > summary::before {
    content: "";
    flex: 0 0 auto;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 4px 0 4px 6px;
    border-color: transparent transparent transparent #582234;
    transition: transform 0.15s ease;
}

.cohort-media__tree-folder[open] > summary::before {
    transform: rotate(90deg);
}

.cohort-media__tree-folder > summary:hover,
.cohort-media__tree-file:hover {
    background: #f7f2f4;
}

.cohort-media__icon {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    fill: #582234;
}

.cohort-media__icon--file {
    fill: #888;
}

.cohort-media__tree-name {
    flex: 1 1 auto;
    text-decoration: none;
    color: inherit;
    word-break: break-word;
}

a.cohort-media__tree-name:hover {
    text-decoration: underline;
}

.cohort-media__tree-file .cohort-media__delete {
    flex: 0 0 auto;
}

.cohort-media__delete button {
    background: none;
    border: none;
    color: #a33;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
}

.cohort-media__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1em;
}

.cohort-media__grid-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: inherit;
}

.cohort-media__grid-item img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 4px;
}

.cohort-media__grid-file-icon {
    width: 100%;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f2f2f2;
    border-radius: 4px;
}

.cohort-media__grid-file-icon .cohort-media__icon {
    width: 45%;
    height: 45%;
}

.cohort-media__grid-caption {
    margin-top: 0.35em;
    font-size: 0.85em;
    text-align: center;
    word-break: break-word;
}

.cohort-media__grid-item--image {
    cursor: zoom-in;
}

/* Lightbox (klik op een foto in [cohort-media-overzicht]) — vorige/volgende
   navigatie binnen dezelfde galerij, zie assets/js/cohort-media-lightbox.js. */
.cohort-media-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2em;
    z-index: 100000;
}

.cohort-media-lightbox.is-open {
    display: flex;
}

body.cohort-media-lightbox-open {
    overflow: hidden;
}

.cohort-media-lightbox__figure {
    margin: 0;
    max-width: 90vw;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.cohort-media-lightbox__image {
    max-width: 90vw;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 4px;
}

.cohort-media-lightbox__caption {
    color: #fff;
    margin-top: 0.75em;
    font-size: 0.9em;
    text-align: center;
}

.cohort-media-lightbox__close,
.cohort-media-lightbox__prev,
.cohort-media-lightbox__next {
    position: fixed;
    background: rgba(255, 255, 255, 0.12);
    border: none;
    color: #fff;
    cursor: pointer;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    font-size: 1.5em;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease;
}

.cohort-media-lightbox__close:hover,
.cohort-media-lightbox__prev:hover,
.cohort-media-lightbox__next:hover {
    background: rgba(255, 255, 255, 0.28);
}

.cohort-media-lightbox__close {
    top: 1em;
    right: 1em;
}

.cohort-media-lightbox__prev {
    left: 1em;
    top: 50%;
    transform: translateY(-50%);
}

.cohort-media-lightbox__next {
    right: 1em;
    top: 50%;
    transform: translateY(-50%);
}

/* Bulkselectie (download als zip / verwijderen) */
.cohort-media__bulk {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5em 1em;
    margin: 0 0 1em;
    padding: 0.5em 0.25em;
    border-bottom: 1px solid #eee;
}

.cohort-media__bulk-all {
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    cursor: pointer;
}

.cohort-media__bulk-count {
    color: #666;
    min-width: 10em;
}

.cohort-media__bulk button {
    background: #582234;
    color: #fff;
    border: 1px solid #582234;
    border-radius: 4px;
    padding: 0.4em 0.9em;
    font: inherit;
    cursor: pointer;
}

.cohort-media__bulk button:hover:not(:disabled),
.cohort-media__bulk button:focus:not(:disabled) {
    background: #6d2a41;
    border-color: #6d2a41;
    color: #fff;
}

.cohort-media__bulk button.cohort-media__bulk-delete {
    background: #fff;
    color: #a33;
    border-color: #a33;
}

.cohort-media__bulk button.cohort-media__bulk-delete:hover:not(:disabled),
.cohort-media__bulk button.cohort-media__bulk-delete:focus:not(:disabled) {
    background: #fbeaea;
    color: #a33;
    border-color: #a33;
}

.cohort-media__bulk button:disabled,
.cohort-media__form button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.cohort-media__select,
.cohort-media__select-folder,
.cohort-media__select-all {
    flex: 0 0 auto;
    margin: 0;
    accent-color: #582234;
}

/* Upload-voortgang: knop vergrendeld + balk */
.cohort-media__form--upload {
    flex-wrap: wrap;
}

.cohort-media__form--upload.is-busy input[type="file"],
.cohort-media__form--upload.is-busy select {
    pointer-events: none;
    opacity: 0.6;
}

.cohort-media__progress {
    flex: 1 0 100%;
}

.cohort-media__progress[hidden] {
    display: none;
}

.cohort-media__progress-bar {
    height: 8px;
    border-radius: 4px;
    background: #eee;
    overflow: hidden;
}

.cohort-media__progress-bar span {
    display: block;
    height: 100%;
    width: 0;
    background: #582234;
    transition: width 0.2s ease;
}

/* Na 100% verzonden is het even wachten op de server: laat de balk "lopen". */
.cohort-media__progress.is-processing .cohort-media__progress-bar span {
    width: 100% !important;
    background: repeating-linear-gradient(45deg, #582234 0 10px, #7a3a4f 10px 20px);
    background-size: 28px 28px;
    animation: cohort-media-stripes 0.8s linear infinite;
}

@keyframes cohort-media-stripes {
    to { background-position: 28px 0; }
}

.cohort-media__progress-text {
    margin: 0.4em 0 0;
    font-size: 0.9em;
    color: #555;
}

@media (prefers-reduced-motion: reduce) {
    .cohort-media__progress.is-processing .cohort-media__progress-bar span {
        animation: none;
    }
}

/* Slideshow ([cohort-media-slideshow]). Zonder JS: dia's onder elkaar. */
.cohort-media--slideshow {
    position: relative;
}

.cohort-media-slideshow__slide {
    margin: 0 0 1em;
}

.cohort-media-slideshow__slide img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 4px;
}

.cohort-media-slideshow__slide figcaption {
    margin-top: 0.4em;
    font-size: 0.9em;
    color: #555;
    text-align: center;
}

.cohort-media--slideshow.is-enhanced {
    --cm-slide-width: 70%;
    --cm-slide-height: clamp(220px, 42vw, 520px);
    --cm-gap: 1rem;
}

/* Peek-carrousel: de actieve foto staat gecentreerd, links en rechts is een
   stuk van de vorige/volgende zichtbaar (positie berekend in
   cohort-media-slideshow.js via translateX op de track). */
.cohort-media--slideshow.is-enhanced .cohort-media-slideshow__viewport {
    overflow: hidden;
    border-radius: 4px;
}

.cohort-media-slideshow__track {
    display: flex;
    gap: var(--cm-gap);
}

.cohort-media-slideshow__track.is-animated {
    transition: transform 0.45s ease;
}

.cohort-media--slideshow.is-enhanced .cohort-media-slideshow__slide {
    flex: 0 0 var(--cm-slide-width);
    height: var(--cm-slide-height);
    margin: 0;
    position: relative;
    border-radius: 4px;
    background: #f7f2f4;
    opacity: 0.45;
    transform: scale(0.94);
    transition: opacity 0.45s ease, transform 0.45s ease;
    cursor: pointer;
}

.cohort-media--slideshow.is-enhanced .cohort-media-slideshow__slide.is-active {
    opacity: 1;
    transform: none;
    cursor: default;
}

.cohort-media--slideshow.is-enhanced .cohort-media-slideshow__slide img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

.cohort-media--slideshow.is-enhanced .cohort-media-slideshow__slide figcaption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    margin: 0;
    padding: 0.4em 0.75em;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    border-radius: 0 0 4px 4px;
}

@media (max-width: 600px) {
    .cohort-media--slideshow.is-enhanced {
        --cm-slide-width: 80%;
        --cm-slide-height: 60vw;
        --cm-gap: 0.5rem;
    }
}

.cohort-media-slideshow__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 2.5em;
    height: 2.5em;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(88, 34, 52, 0.75);
    color: #fff;
    font-size: 1.5em;
    line-height: 1;
    cursor: pointer;
}

.cohort-media-slideshow__nav:hover,
.cohort-media-slideshow__nav:focus {
    background: #582234;
    color: #fff;
}

.cohort-media-slideshow__nav--prev { left: 0.5em; }
.cohort-media-slideshow__nav--next { right: 0.5em; }

.cohort-media-slideshow__dots {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5em;
    margin-top: 0.75em;
}

.cohort-media-slideshow__dot {
    width: 10px;
    height: 10px;
    padding: 0;
    border: 1px solid #582234;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
}

.cohort-media-slideshow__dot.is-active {
    background: #582234;
}

/* Zonder JS zijn de knoppen zinloos. */
.cohort-media--slideshow:not(.is-enhanced) .cohort-media-slideshow__nav,
.cohort-media--slideshow:not(.is-enhanced) .cohort-media-slideshow__dots {
    display: none;
}

@media (prefers-reduced-motion: reduce) {
    .cohort-media-slideshow__track.is-animated,
    .cohort-media--slideshow.is-enhanced .cohort-media-slideshow__slide {
        transition: none;
    }
}
