.cai-carousel-container {
    max-width: 100%;
    margin: 0 auto;
    /* background: #fac993; */
    padding: 0px 0 0px 0; /* เพิ่ม padding-bottom สำหรับ dots */
    overflow: visible; /* ให้ dots แสดงออกมาได้ */
}

.cai-container-fluid {
    padding-left: 0;
    padding-right: 0;
    overflow: hidden;
}

.cai-carousel {
    position: relative;
    margin-bottom: 0px; /* เพิ่ม margin เพื่อให้มีพื้นที่สำหรับ dots */
}

.cai-carousel-control-prev,
.cai-carousel-control-next {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 75px;
    background: rgba(0, 0, 0, 0.02);
    border: none;
    border-radius: 0;
    height: 100%;
    z-index: 199;
    opacity: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.15s ease-in-out;
}

.cai-carousel-control-prev:hover,
.cai-carousel-control-next:hover {
    background: #f0f0f038;
}

.cai-carousel-control-prev {
    left: 0;
}

.cai-carousel-control-next {
    right: 0;
}

.cai-carousel-control-prev-icon,
.cai-carousel-control-next-icon {
    width: 24px;
    height: 24px;
    background-size: 100%;
    background-repeat: no-repeat;
    background-position: center;
}

.cai-carousel-control-prev-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23000'%3e%3cpath d='m3.86 8.753 5.482 4.796c.646.566 1.658.106 1.658-.753V3.204a1 1 0 0 0-1.659-.753l-5.48 4.796a1 1 0 0 0 0 1.506z'/%3e%3c/svg%3e");
}

.cai-carousel-control-next-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23000'%3e%3cpath d='m12.14 8.753-5.482 4.796c-.646.566-1.658.106-1.658-.753V3.204a1 1 0 0 1 1.659-.753l5.48 4.796a1 1 0 0 1 0 1.506z'/%3e%3c/svg%3e");
}

.cai-carousel-indicators {
    position: absolute;
    bottom: 10px; /* ปรับให้ใกล้ carousel มากขึ้น */
    left: 50%;
    transform: translateX(-50%);
    display: flex !important;
    justify-content: center;
    align-items: center;
    /* z-index: 2000; */
    margin: 0;
    padding: 8px 16px;
    list-style: none;
    border-radius: 20px;
    min-height: 32px;
    white-space: nowrap; /* ป้องกันการขึ้นบรรทัดใหม่ */
}

.cai-carousel-indicators button {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    margin: 0 6px;
    background-color: rgba(202, 202, 202, 0.75);
    opacity: 0.7;
    border: 2px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
}

.cai-carousel-indicators button.active {
    opacity: 1 !important;
    background-color: #869791 !important;
    border-color: #869791 !important;
    /* transform: scale(1.1); */
    box-shadow: 0 0 10px rgba(232, 161, 85, 0.5);
}

.cai-carousel-indicators button:hover {
    opacity: 0.9;
    transform: scale(1.1);
}

.cai-carousel-inner {
    position: relative;
    width: 100%;
    overflow: hidden;
    cursor: grab;
    user-select: none;
    will-change: transform;
}

.cai-carousel-inner:active {
    cursor: grabbing;
}

.cai-carousel-item {
    position: relative;
    display: none;
    width: 100%;
    backface-visibility: hidden;
    perspective: 1000px;
}

.cai-carousel-item.active {
    display: block;
}

.cai-carousel-item-next,
.cai-carousel-item-prev,
.cai-carousel-item.active {
    display: block;
}

/* Image container with position relative */
.cai-image-wrapper {
    position: relative;
    width: 100%;
    height: 640px;;
    background: #e9ecef;
    border-radius: 1px;
    overflow: hidden;
}

.cai-image-wrapper.cai-shimmer-bg {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: cai-shimmer 1.5s infinite;
}

/* Ripple effect สำหรับการคลิก */
.cai-ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: scale(0);
    animation: cai-ripple-animation 1.2s ease-out;
    pointer-events: none;
    z-index: 1000;
}

@keyframes cai-ripple-animation {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    50% {
        opacity: 0.4;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

/* Ripple สำหรับ dark theme */
.cai-ripple-dark {
    background: rgba(0, 0, 0, 0.15);
}

/* Ripple สำหรับ light theme */
.cai-ripple-light {
    background: rgba(255, 255, 255, 0.35);
}

@media (max-width: 768px) {
    .cai-image-wrapper {
        height: 250px;
    }
}

@media (max-width: 480px) {
    .cai-image-wrapper {
        height: 200px;
    }
}

/* Loading spinner - ตรงกลางเสมอ */
.cai-spinner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex !important;
    align-items: center;
    justify-content: center;
    z-index: 9999 !important;
    border-radius: 8px;
}

.cai-spinner-overlay.cai-fade-out {
    opacity: 0;
    transition: opacity 0.5s ease;
}

/* Bootstrap-style spinner ที่ใหญ่และเด่นชัด */
.cai-loading-spinner {
    width: 2.4rem;
    height: 2.4rem;
    border: 3px solid #f0f0f0;
    border-top: 3px solid #e8a155;
    border-radius: 50%;
    animation: cai-spinner-rotate 0.75s linear infinite;
    box-shadow: 0 4px 15px rgba(232, 161, 85, 0.3);
}

@keyframes cai-spinner-rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Image styling */
.cai-carousel-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cai-carousel-image.cai-loaded {
    opacity: 1;
}

/* Background shimmer effect */
.cai-shimmer-bg {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: cai-shimmer 1.5s infinite;
}

@keyframes cai-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Error state */
.cai-error-placeholder {
    width: 100%;
    height: 100%;
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #6c757d;
}

.cai-error-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.cai-error-text {
    font-size: 1rem;
    opacity: 0.7;
}

/* Slide transitions */
.cai-carousel-item {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transform: translateX(100%);
    transition: transform 0.6s cubic-bezier(0.25, 0.1, 0.25, 1), opacity 0.6s ease-in-out;
}

.cai-carousel-item.active {
    opacity: 1;
    transform: translateX(0);
    position: relative;
}

.cai-carousel-item.cai-slide-next {
    transform: translateX(100%);
    opacity: 0;
}

.cai-carousel-item.cai-slide-prev {
    transform: translateX(-100%);
    opacity: 0;
}

.cai-carousel-item.cai-sliding {
    opacity: 1;
}

.cai-carousel-inner {
    position: relative;
    height: 640px;;
    overflow: hidden;
}

@media (max-width: 768px) {
    .cai-carousel-inner {
        height: 250px;
    }
}

@media (max-width: 480px) {
    .cai-carousel-inner {
        height: 200px;
    }
}
