/* Feed Carousel — progressive enhancement of the core ShowFiles mosaic.
 *
 * Core styles the mosaic with high-specificity rules (including
 * `body.device-mobile #wallStream .post-files img`), so the overrides that
 * fight those need !important. Everything else stays plain.
 */

/* Core turns .post-files into a horizontal strip on mobile; the carousel does
 * its own scrolling, so neutralise the wrapper. */
.post-files.fc-has-carousel {
    display: block !important;
    overflow: visible !important;
}

.fc-carousel {
    position: relative;
    margin: 10px 0;
    --fc-ratio: 1 / 1;
}

.fc-carousel__viewport {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    aspect-ratio: var(--fc-ratio);
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    border-radius: 8px;
    background-color: #000;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    overscroll-behavior-x: contain;
}

.fc-carousel__viewport::-webkit-scrollbar {
    display: none;
}

@media (prefers-reduced-motion: reduce) {
    .fc-carousel__viewport {
        scroll-behavior: auto;
    }
}

.fc-carousel__slide {
    position: relative;
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    scroll-snap-align: center;
    overflow: hidden;
    padding: 0 !important;
}

.fc-carousel__backdrop {
    position: absolute;
    inset: 0;
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    filter: blur(24px) brightness(0.55);
    transform: scale(1.2);
}

.fc-carousel__slide > a,
.fc-carousel__slide > .fc-carousel__frame {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

/* Beats `.post-files img` and the device-mobile wallStream rules. */
.fc-carousel__slide img {
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    border-radius: 0 !important;
}

/* Navigation */
.fc-carousel__nav {
    position: absolute;
    top: calc(50% - 18px);
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: #262626;
    background-color: rgba(255, 255, 255, 0.85);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s ease-in-out;
}

.fc-carousel__nav--prev {
    left: 8px;
}

.fc-carousel__nav--next {
    right: 8px;
}

.fc-carousel__nav[disabled] {
    display: none;
}

/* Touch devices swipe instead; arrows only make sense for a mouse. */
@media (hover: hover) and (pointer: fine) {
    .fc-carousel:hover .fc-carousel__nav,
    .fc-carousel__nav:focus-visible {
        opacity: 1;
    }
}

.fc-carousel__counter {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    padding: 3px 9px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    color: #fff;
    background-color: rgba(0, 0, 0, 0.6);
    pointer-events: none;
}

.fc-carousel__dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 8px;
}

.fc-carousel__dot {
    width: 6px;
    height: 6px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background-color: var(--bs-secondary, #a8a8a8);
    opacity: 0.4;
    cursor: pointer;
    transition: opacity 0.15s ease-in-out, background-color 0.15s ease-in-out;
}

.fc-carousel__dot.is-active {
    background-color: var(--bs-accent, #0d6efd);
    opacity: 1;
}

/* Wall form Attach Files → “Carousel” label (multi-photo path). */
.contentForm_options .btn_container > .btn-group > .fileinput-button.fc-attach-labeled {
    display: inline-flex;
    align-items: center;
    gap: 0;
    white-space: nowrap;
}

.contentForm_options .btn_container > .btn-group > .fileinput-button.fc-attach-labeled .fc-attach-label {
    margin-left: 6px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
}

/* Composer: hide the native filename rows for photos (remove stays in the DOM). */
.fc-composer-host.fc-has-composer-preview > ul.files > li.file-preview-item.mime-image {
    display: none !important;
}

.fc-composer-host.fc-has-composer-preview > ul.files:not(:has(> li.file-preview-item:not(.mime-image))) {
    display: none;
}

/* Preview is moved above the publish row; collapse the leftover file well. */
.well.post-file-list.fc-composer-host.fc-composer-host--empty {
    display: none !important;
    margin: 0;
    padding: 0;
    border: 0;
}

.fc-composer-preview {
    margin: 0 0 12px;
}

.fc-composer-preview__stage {
    position: relative;
    max-width: 100%;
    margin: 0 auto 8px;
}

.fc-composer-preview__stage.fc-carousel {
    margin: 0 auto 8px;
}

.fc-composer-preview__stage .fc-carousel__viewport {
    height: 200px;
    width: auto;
    max-width: 100%;
    aspect-ratio: var(--fc-ratio);
    margin: 0 auto;
}

.fc-composer-preview__stage .fc-carousel__nav {
    opacity: 1;
}

.fc-composer-preview__remove {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    font-size: 16px;
    line-height: 1;
    color: #fff;
    background-color: rgba(0, 0, 0, 0.62);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
    cursor: pointer;
}

.fc-composer-preview__remove:hover,
.fc-composer-preview__remove:focus-visible {
    background-color: rgba(0, 0, 0, 0.82);
}

.fc-composer-preview__bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.fc-composer-preview__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 4px 12px;
    border: 1px solid #cfcfcf;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    color: #111111;
    background-color: #ffffff;
    -webkit-text-fill-color: #111111;
    cursor: pointer;
}

.fc-composer-preview__btn:hover,
.fc-composer-preview__btn:focus-visible {
    background-color: #f4f4f4;
}

/* Native Attach/Carousel is replaced by “Adicionar fotos” while preview is up. */
.btn-group.fc-attach-hidden,
.fileinput-button.fc-attach-hidden {
    display: none !important;
}
