/**
 * Bitstech Store — Swiper Products Carousel Styles
 */

/* ─── PRE-INIT FALLBACK ───
 * Before Swiper loads, .swiper renders as a plain block which makes every
 * .swiper-slide stack vertically at full container width — i.e. each
 * product image renders huge. We force a horizontal scroll layout BEFORE
 * Swiper initializes, then Swiper takes over once it loads. This way the
 * page never shows giant stacked images even if Swiper fails to load
 * (CDN block, slow network, etc.).
 */
.bt-carousel-section .swiper:not(.swiper-initialized) .swiper-wrapper {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 12px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding-bottom: 8px;
}
.bt-carousel-section .swiper:not(.swiper-initialized) .swiper-slide {
    flex: 0 0 auto;
    width: 180px;
    max-width: 180px;
    scroll-snap-align: start;
}
@media (min-width: 768px) {
    .bt-carousel-section .swiper:not(.swiper-initialized) .swiper-slide {
        width: 200px;
        max-width: 200px;
    }
}
@media (min-width: 1024px) {
    .bt-carousel-section .swiper:not(.swiper-initialized) .swiper-slide {
        width: 220px;
        max-width: 220px;
    }
}
/* Card image inside fallback — always contained */
.bt-carousel-section .swiper:not(.swiper-initialized) .bt-carousel-card__img img {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
}

/* Carousel Container */
.bt-carousel-section {
    position: relative;
    overflow: hidden;
}

.bt-carousel-section .swiper {
    overflow: visible;
    padding: 10px 0 40px;
}

.bt-carousel-section .swiper-slide {
    height: auto;
}

/* Navigation Arrows */
.bt-swiper-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.bt-swiper-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1.5px solid rgba(var(--bt-primary-rgb, 117, 59, 235), 0.3);
    background: rgba(var(--bt-primary-rgb, 117, 59, 235), 0.05);
    color: var(--bt-primary, #753beb);
    cursor: pointer;
    transition: all 0.2s;
}

.bt-swiper-btn:hover {
    background: var(--bt-primary, #753beb);
    color: #fff;
    border-color: var(--bt-primary, #753beb);
    transform: scale(1.05);
}

.bt-swiper-btn.swiper-button-disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none;
}

/* Pagination */
.bt-swiper-pagination {
    text-align: center;
    margin-top: 20px;
}

.bt-swiper-pagination .swiper-pagination-bullet {
    width: 8px;
    height: 8px;
    background: rgba(var(--bt-primary-rgb, 117, 59, 235), 0.3);
    opacity: 1;
    transition: all 0.3s;
    border-radius: 4px;
}

.bt-swiper-pagination .swiper-pagination-bullet-active {
    width: 24px;
    background: var(--bt-primary, #753beb);
}

/* Carousel Product Card */
.bt-carousel-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.bt-carousel-card:hover {
    transform: translateY(-4px);
    border-color: rgba(var(--bt-primary-rgb, 117, 59, 235), 0.3);
    box-shadow: 0 12px 40px rgba(var(--bt-primary-rgb, 117, 59, 235), 0.1);
}

.bt-carousel-card__img {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.02);
}

.bt-carousel-card__img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s;
}

.bt-carousel-card:hover .bt-carousel-card__img img {
    transform: scale(1.05);
}

.bt-carousel-card__badge {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.65rem;
    font-weight: 700;
    background: rgba(var(--bt-primary-rgb, 117, 59, 235), 0.9);
    color: #fff;
}

.bt-carousel-card__badge--sale {
    background: #ef4444;
}

.bt-carousel-card__badge--new {
    background: #10b981;
}

.bt-carousel-card__info {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.bt-carousel-card__title {
    font-size: 0.78rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    margin: 0;
}

.bt-carousel-card__price {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: auto;
}

.bt-carousel-card__price-now {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--bt-accent, #00e0f0);
}

.bt-carousel-card__price-old {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.35);
    text-decoration: line-through;
}

.bt-carousel-card__rating {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.5);
}

.bt-carousel-card__rating svg {
    color: #fbbf24;
}

/* Deals Carousel with Countdown */
.bt-deals-carousel .bt-carousel-card {
    border-color: rgba(239, 68, 68, 0.15);
}

.bt-deals-carousel .bt-carousel-card:hover {
    border-color: rgba(239, 68, 68, 0.4);
    box-shadow: 0 12px 40px rgba(239, 68, 68, 0.1);
}

/* Tab Carousel */
.bt-carousel-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.bt-carousel-tab {
    padding: 6px 16px;
    border-radius: 20px;
    border: 1.5px solid rgba(255, 255, 255, 0.1);
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.bt-carousel-tab:hover {
    border-color: rgba(var(--bt-primary-rgb, 117, 59, 235), 0.4);
    color: var(--bt-primary, #753beb);
}

.bt-carousel-tab.bt-active {
    background: var(--bt-primary, #753beb);
    border-color: var(--bt-primary, #753beb);
    color: #fff;
}

/* Light mode */
html[data-theme="light"] .bt-carousel-card {
    background: #fff;
    border-color: #e5e7eb;
}

html[data-theme="light"] .bt-carousel-card:hover {
    border-color: var(--bt-primary, #753beb);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
}

html[data-theme="light"] .bt-carousel-card__title {
    color: #1a1f35;
}

html[data-theme="light"] .bt-carousel-card__price-now {
    color: var(--bt-primary, #753beb);
}

html[data-theme="light"] .bt-carousel-card__price-old {
    color: #9ca3af;
}

html[data-theme="light"] .bt-carousel-tab {
    border-color: #e5e7eb;
    color: #6b7280;
}

html[data-theme="light"] .bt-swiper-pagination .swiper-pagination-bullet {
    background: #d1d5db;
}

/* Responsive */
@media (max-width: 768px) {
    .bt-swiper-btn {
        width: 32px;
        height: 32px;
    }
    .bt-carousel-card__info {
        padding: 10px;
    }
    .bt-carousel-card__title {
        font-size: 0.72rem;
    }
}
