/**
 * Logo Carousel block styles (frontend + editor).
 *
 * @package WPDashboard
 * @since 1.9.0
 */

.wp-dashboard-logo-carousel {
    --wpd-logo-gap-desktop: 32px;
    --wpd-logo-gap-mobile: 20px;
    --wpd-logo-max-height-desktop: 88px;
    --wpd-logo-max-height-mobile: 64px;
    --wpd-logo-item-min-width: 150px;
    position: relative;
    width: 100%;
}

.wp-dashboard-logo-carousel .wpd-logo-carousel__viewport {
    overflow: hidden;
}

.wp-dashboard-logo-carousel .wpd-logo-carousel__track {
    display: flex;
    align-items: center;
    gap: var(--wpd-logo-gap-desktop);
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    padding: 8px 2px 10px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.wp-dashboard-logo-carousel .wpd-logo-carousel__track::-webkit-scrollbar {
    display: none;
}

.wp-dashboard-logo-carousel .wpd-logo-carousel__item {
    flex: 0 0 auto;
    min-width: var(--wpd-logo-item-min-width);
    scroll-snap-align: start;
}

.wp-dashboard-logo-carousel .wpd-logo-carousel__media {
    width: 100%;
}

.wp-dashboard-logo-carousel .wpd-logo-carousel__link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: var(--wpd-logo-max-height-desktop);
    text-decoration: none;
}

.wp-dashboard-logo-carousel .wpd-logo-carousel__link.is-static {
    cursor: default;
}

.wp-dashboard-logo-carousel .wpd-logo-carousel__image {
    display: block;
    width: auto;
    max-width: min(220px, 100%);
    max-height: var(--wpd-logo-max-height-desktop);
    object-fit: contain;
    object-position: center;
    transition: filter 0.25s ease, opacity 0.25s ease, transform 0.25s ease;
}

.wp-dashboard-logo-carousel.has-grayscale .wpd-logo-carousel__image {
    filter: grayscale(1);
    opacity: 0.85;
}

.wp-dashboard-logo-carousel.has-grayscale .wpd-logo-carousel__link:hover .wpd-logo-carousel__image,
.wp-dashboard-logo-carousel.has-grayscale .wpd-logo-carousel__link:focus .wpd-logo-carousel__image,
.wp-dashboard-logo-carousel.has-grayscale .wpd-logo-carousel__link:focus-visible .wpd-logo-carousel__image {
    filter: grayscale(0);
    opacity: 1;
}

.wp-dashboard-logo-carousel .wpd-logo-carousel__link:hover .wpd-logo-carousel__image,
.wp-dashboard-logo-carousel .wpd-logo-carousel__link:focus .wpd-logo-carousel__image,
.wp-dashboard-logo-carousel .wpd-logo-carousel__link:focus-visible .wpd-logo-carousel__image {
    transform: scale(1.03);
}

.wp-dashboard-logo-carousel .wpd-logo-carousel__controls {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 12px;
}

.wp-dashboard-logo-carousel .wpd-logo-carousel__arrow {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    border: 1px solid #d8d8d8;
    background: #fff;
    color: #111;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.wp-dashboard-logo-carousel .wpd-logo-carousel__arrow:hover:not(:disabled) {
    border-color: #111;
    background-color: #f4f4f4;
}

.wp-dashboard-logo-carousel .wpd-logo-carousel__arrow:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.wp-dashboard-logo-carousel.is-preset-grid_desktop_mobile_carousel .wpd-logo-carousel__track {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: var(--wpd-logo-gap-desktop);
    overflow: visible;
    scroll-snap-type: none;
}

.wp-dashboard-logo-carousel.is-preset-grid_desktop_mobile_carousel .wpd-logo-carousel__item {
    min-width: 0;
}

.wp-dashboard-logo-carousel.is-preset-grid_desktop_mobile_carousel .wpd-logo-carousel__controls {
    display: none;
}

.wp-dashboard-logo-carousel.is-empty {
    border: 1px dashed #ccc;
    border-radius: 6px;
    padding: 18px;
}

.wp-dashboard-logo-carousel-editor .wpd-logo-carousel-preview {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 12px;
    background: #fff;
}

.wp-dashboard-logo-carousel-editor .wpd-logo-editor-card .components-card__header {
    border-bottom: 1px solid #efefef;
}

.wp-dashboard-logo-carousel-editor .wpd-logo-editor-item {
    position: relative;
}

.wp-dashboard-logo-carousel-editor .wpd-logo-editor-item.is-dragging {
    opacity: 0.5;
}

.wp-dashboard-logo-carousel-editor .wpd-logo-editor-item.is-drag-over::before {
    content: "";
    position: absolute;
    top: -4px;
    left: 0;
    right: 0;
    height: 3px;
    background: #2271b1;
    border-radius: 2px;
    z-index: 3;
}

@media (max-width: 782px) {
    .wp-dashboard-logo-carousel .wpd-logo-carousel__track {
        gap: var(--wpd-logo-gap-mobile);
    }

    .wp-dashboard-logo-carousel .wpd-logo-carousel__link {
        min-height: var(--wpd-logo-max-height-mobile);
    }

    .wp-dashboard-logo-carousel .wpd-logo-carousel__image {
        max-height: var(--wpd-logo-max-height-mobile);
        max-width: min(180px, 100%);
    }

    .wp-dashboard-logo-carousel.is-preset-grid_desktop_mobile_carousel .wpd-logo-carousel__track {
        display: flex;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        grid-template-columns: none;
    }

    .wp-dashboard-logo-carousel.is-preset-grid_desktop_mobile_carousel .wpd-logo-carousel__item {
        min-width: var(--wpd-logo-item-min-width);
    }
}

@media (prefers-reduced-motion: reduce) {
    .wp-dashboard-logo-carousel .wpd-logo-carousel__track {
        scroll-behavior: auto;
    }

    .wp-dashboard-logo-carousel .wpd-logo-carousel__image {
        transition: none;
    }
}
