/**
 * GBP Posts Carousel Widget Styles
 * Center-focused carousel with featured image backgrounds and title overlays
 */

.gbp-posts-carousel {
    position: relative;
    width: 100%;
    overflow: visible;
}

/* Track container - allows for overflow on sides */
.gbp-posts-carousel__track {
    overflow: hidden;
    width: 100%;
    display: flex;
    align-items: center;
}

/* Slides container */
.gbp-posts-carousel__slides {
    display: flex;
    align-items: center;
    width: 100%;
    transition: transform 0.6s cubic-bezier(0.25, 0.1, 0.25, 1);
    will-change: transform;
}

/* Individual slide */
.gbp-posts-carousel__slide {
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    height: 380px;
    transition: width 0.5s cubic-bezier(0.25, 0.1, 0.25, 1),
                height 0.5s cubic-bezier(0.25, 0.1, 0.25, 1),
                min-width 0.5s cubic-bezier(0.25, 0.1, 0.25, 1),
                margin 0.5s cubic-bezier(0.25, 0.1, 0.25, 1),
                opacity 0.4s ease,
                box-shadow 0.3s ease;
}

/* Center mode - non-active slides */
.gbp-posts-carousel.center-mode .gbp-posts-carousel__slide {
    opacity: 0.75;
}

/* Center mode - active/center slide */
.gbp-posts-carousel.center-mode .gbp-posts-carousel__slide.is-center {
    opacity: 1;
    z-index: 10;
}

/* Link wrapper */
.gbp-posts-carousel__link {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
    color: inherit;
    position: relative;
    overflow: hidden;
    border-radius: inherit;
}

/* Background image */
.gbp-posts-carousel__image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: transform 0.5s ease;
}

/* Subtle zoom on hover */
.gbp-posts-carousel__slide:hover .gbp-posts-carousel__image,
.gbp-posts-carousel__slide:focus-within .gbp-posts-carousel__image {
    transform: scale(1.05);
}

/* Gradient overlay */
.gbp-posts-carousel__overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60%;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.7));
    pointer-events: none;
    z-index: 2;
}

/* Content container */
.gbp-posts-carousel__content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0 20px 24px 20px;
    z-index: 3;
}

/* Title styling */
.gbp-posts-carousel__title {
    margin: 0;
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
    text-align: left;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Navigation arrows container */
.gbp-posts-carousel__arrows {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 24px;
}

/* Arrow buttons */
.gbp-posts-carousel__arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 1px solid #d0d5dd;
    border-radius: 50%;
    background-color: #ffffff;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
    outline: none;
}

.gbp-posts-carousel__arrow:hover,
.gbp-posts-carousel__arrow:focus-visible {
    background-color: #f5f5f5;
    border-color: #1a4480;
}

.gbp-posts-carousel__arrow:focus,
.gbp-posts-carousel__arrow:active {
    outline: none;
    box-shadow: none;
}

.gbp-posts-carousel__arrow:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.gbp-posts-carousel__arrow:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.gbp-posts-carousel__arrow:disabled:hover {
    background-color: #ffffff;
    border-color: #d0d5dd;
}

/* Arrow SVG icon */
.gbp-posts-carousel__arrow svg {
    width: 16px;
    height: 16px;
    stroke: #1a4480;
    fill: none;
    transition: stroke 0.3s ease;
}

.gbp-posts-carousel__arrow:hover svg,
.gbp-posts-carousel__arrow:focus-visible svg {
    stroke: #0d2d5c;
}

/* Arrow custom image */
.gbp-posts-carousel__arrow-img {
    width: 16px;
    height: 16px;
    object-fit: contain;
    transition: opacity 0.3s ease;
}

.gbp-posts-carousel__arrow:hover .gbp-posts-carousel__arrow-img,
.gbp-posts-carousel__arrow:focus-visible .gbp-posts-carousel__arrow-img {
    opacity: 0.8;
}

/* Dots navigation */
.gbp-posts-carousel__dots {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
}

.gbp-posts-carousel__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #d0d5dd;
    cursor: pointer;
    transition: all 0.3s ease;
}

.gbp-posts-carousel__dot:hover,
.gbp-posts-carousel__dot:focus-visible {
    background-color: #98a2b3;
}

.gbp-posts-carousel__dot.active {
    background-color: #1a4480;
    transform: scale(1.2);
}

/* Empty state */
.gbp-posts-carousel__empty {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-style: italic;
}

/* ===========================
   RESPONSIVE STYLES
   =========================== */

/* Tablet */
@media (max-width: 1024px) {
    .gbp-posts-carousel__slide {
        height: 340px;
    }

    .gbp-posts-carousel__title {
        font-size: 15px;
        -webkit-line-clamp: 2;
    }

    .gbp-posts-carousel__content {
        padding: 0 16px 20px 16px;
    }

    .gbp-posts-carousel__arrow {
        width: 40px;
        height: 40px;
    }

    .gbp-posts-carousel__arrow svg {
        width: 14px;
        height: 14px;
    }

    .gbp-posts-carousel__arrows {
        margin-top: 20px;
    }
}

/* Mobile */
@media (max-width: 767px) {
    .gbp-posts-carousel__track {
        padding: 10px 0;
        margin: -10px 0;
    }

    .gbp-posts-carousel__slide {
        height: 300px;
    }

    .gbp-posts-carousel__title {
        font-size: 14px;
        -webkit-line-clamp: 2;
    }

    .gbp-posts-carousel__content {
        padding: 0 16px 16px 16px;
    }

    .gbp-posts-carousel__arrow {
        width: 36px;
        height: 36px;
    }

    .gbp-posts-carousel__arrow svg {
        width: 12px;
        height: 12px;
    }

    .gbp-posts-carousel__arrows {
        gap: 8px;
        margin-top: 16px;
    }

    .gbp-posts-carousel__dots {
        margin-top: 12px;
    }

    .gbp-posts-carousel__dot {
        width: 6px;
        height: 6px;
    }

    /* Disable center scale effect on mobile for cleaner look */
    .gbp-posts-carousel.center-mode .gbp-posts-carousel__slide {
        opacity: 1;
    }
}

/* ===========================
   EDITOR PREVIEW STYLES
   =========================== */
.gbp-posts-carousel--editor .gbp-posts-carousel__slides {
    justify-content: center;
    align-items: center;
}

.gbp-posts-carousel--editor .gbp-posts-carousel__slide {
    flex: 0 0 auto;
    width: 250px;
    height: 350px;
    position: relative;
    overflow: hidden;
    border-radius: 12px;
}

.gbp-posts-carousel--editor .gbp-posts-carousel__link {
    display: block;
    width: 100%;
    height: 100%;
    position: relative;
}

.gbp-posts-carousel--editor .gbp-posts-carousel__image {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.gbp-posts-carousel--editor .gbp-posts-carousel__overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60%;
}

.gbp-posts-carousel--editor .gbp-posts-carousel__content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    z-index: 3;
}

.gbp-posts-carousel--editor .gbp-posts-carousel__title {
    margin: 0;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
}

/* Accessibility - Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .gbp-posts-carousel__slides,
    .gbp-posts-carousel__slide,
    .gbp-posts-carousel__image,
    .gbp-posts-carousel__arrow,
    .gbp-posts-carousel__dot {
        transition: none;
    }
}
