/**
 * TWB Loop Carousel Widget — Frontend Styles
 */

/* ── Wrapper ─────────────────────────────────────────────────────────────── */

.twb-loop-carousel-wrap {
    position: relative;
    width: 100%;
}

/* ── Swiper container ────────────────────────────────────────────────────── */

.twb-loop-carousel {
    overflow: hidden;
    list-style: none;
    padding: 0;
    margin: 0;
}

/* ── Equal Height ────────────────────────────────────────────────────────── */

.twb-loop-carousel.twb-equal-height .swiper-wrapper {
    align-items: stretch;
}

.twb-loop-carousel.twb-equal-height .swiper-slide {
    height: auto;
    display: flex;
    flex-direction: column;
}

.twb-loop-carousel.twb-equal-height .twb-loop-item {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.twb-loop-carousel.twb-equal-height .twb-loop-item > *:last-child {
    flex: 1;
}

/* ── Arrows ──────────────────────────────────────────────────────────────── */

/* Reset <button> defaults — markup đổi từ <div> sang <button> cho a11y */
.twb-carousel-arrow {
    appearance: none;
    -webkit-appearance: none;
    border: none;
    padding: 0;
    font-size: 0;
    line-height: 1;
    outline: none;
    cursor: pointer;
    /* Layout */
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #fff;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    transition: background-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}

.twb-carousel-arrow:hover {
    background-color: #2271b1;
    color: #fff;
}

/* Focus ring cho keyboard nav */
.twb-carousel-arrow:focus-visible {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

.twb-carousel-arrow.swiper-button-disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.twb-carousel-prev {
    left: -20px;
}

.twb-carousel-next {
    right: -20px;
}

.twb-carousel-arrow svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
    display: block;
}

/* ── Pagination Dots ─────────────────────────────────────────────────────── */

.twb-carousel-pagination {
    position: absolute;
    bottom: -30px;
    left: 0;
    width: 100%;
    text-align: center;
    z-index: 10;
}

.twb-carousel-pagination .swiper-pagination-bullet {
    width: 8px;
    height: 8px;
    display: inline-block;
    border-radius: 50%;
    background-color: #ccc;
    margin: 0 4px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.3s ease;
}

.twb-carousel-pagination .swiper-pagination-bullet-active {
    background-color: #2271b1;
    transform: scale(1.3);
}

/* ── Responsive fallback ─────────────────────────────────────────────────── */

@media (max-width: 767px) {
    .twb-carousel-prev { left: 0; }
    .twb-carousel-next { right: 0; }
}