/* KLYDO Auto Carousel (Production Ready) */

.klydo-carousel {
    /* Full-width breakout: escapes any parent content container */
    position: relative;
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    margin-right: 0;
    margin-top: 32px;
    margin-bottom: 32px;
    padding: 0;
    box-sizing: border-box;
    overflow: hidden;

    --klydo-card-mobile-width: 80vw;
    --klydo-card-desktop-width: 240px;
    --klydo-gap: 16px;
    --klydo-primary: #d9ff00;
}

.klydo-carousel * {
    box-sizing: border-box;
}

/* 1. FOCUS MODE (Inline 3D Pop - no full screen) */

.klydo-no-transition {
    transition: none !important;
}

.klydo-carousel.klydo-has-active {
    /* Stay in document flow - NO fixed/absolute */
    overflow: visible;
    z-index: 10;
}

.klydo-close-btn {
    position: fixed;
    top: 20px;
    right: 30px;
    font-size: 40px;
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100000;
    transition: background 0.3s ease;
}

.klydo-has-active .klydo-close-btn {
    display: flex;
}

.klydo-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.klydo-mask {
    width: 100%;
    overflow: visible;
    position: relative;
}

.klydo-rail {
    display: flex;
    flex-wrap: nowrap;
    gap: var(--klydo-gap);
    width: 100%;
    overflow-x: auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 48px 0;
    box-sizing: border-box;
    /* Allow 3D scaled cards to protrude */
    overflow-y: visible;
    will-change: transform;
    transition: transform 0.6s cubic-bezier(0.19, 1, 0.22, 1);
}

.klydo-rail::-webkit-scrollbar {
    display: none;
}

/* 2. CARD STYLING */
.klydo-card {
    flex: 0 0 var(--klydo-card-desktop-width);
    width: var(--klydo-card-desktop-width);
    aspect-ratio: 9/16;
    scroll-snap-align: center;
    position: relative;
    display: flex;
    flex-direction: column;
    background: #111;
    border-radius: 24px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1),
        opacity 0.4s ease,
        box-shadow 0.4s ease;
    will-change: transform, opacity;
    z-index: 10;
    cursor: pointer;
}

/* --- 3D FLOATING POP FOCUS STATES --- */

.klydo-has-active .klydo-video--active {
    transform: scale(1.18) !important;
    z-index: 100 !important;
    opacity: 1 !important;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
    pointer-events: auto;
}

.klydo-has-active .klydo-video--left,
.klydo-has-active .klydo-video--right {
    transform: scale(0.9) !important;
    opacity: 0.45 !important;
    filter: blur(2px) brightness(0.6);
    pointer-events: auto;
}

.klydo-has-active .klydo-card:not(.klydo-video--active):not(.klydo-video--left):not(.klydo-video--right) {
    opacity: 0.15 !important;
    filter: blur(4px) brightness(0.4);
    pointer-events: none;
    transform: scale(0.82) !important;
}

/* 3. MEDIA LAYER */
.klydo-media {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000;
}

/* 4. CONTENT OVERLAY (Glassmorphic) */
.klydo-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.3) 60%, transparent 100%);
    color: #fff;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.klydo-product-row {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 10px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.klydo-product-thumb-boxed {
    width: 60px;
    height: 60px;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
    background: #fff;
}

.klydo-product-thumb-boxed img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.klydo-product-info {
    flex: 1;
    overflow: hidden;
}

.klydo-product-title {
    font-size: 13px;
    font-weight: 700;
    margin: 0 0 2px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.klydo-product-title a {
    color: #fff !important;
    text-decoration: none;
}

.klydo-product-price {
    font-size: 13px;
    font-weight: 600;
}

.klydo-add-to-cart-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    background: var(--klydo-primary) !important;
    color: #000 !important;
    text-decoration: none;
    font-weight: 800;
    font-size: 12px;
    border-radius: 50px;
    transition: transform 0.2s ease, filter 0.3s ease;
    text-transform: uppercase;
}

.klydo-add-to-cart-button:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

.klydo-badge-floating {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #fff;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 50;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.klydo-badge-dot {
    width: 6px;
    height: 6px;
    background: var(--klydo-primary);
    border-radius: 50%;
    display: inline-block;
}

.klydo-video-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.klydo-poster {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    z-index: 1;
    transition: opacity 0.5s ease;
}

.klydo-video--playing .klydo-poster {
    opacity: 0;
}

.klydo-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 15;
    transition: transform 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.klydo-play-icon::after {
    content: "";
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 8px 0 8px 14px;
    border-color: transparent transparent transparent #fff;
    margin-left: 4px;
}

.klydo-media video,
.klydo-media iframe {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.klydo-video--playing video,
.klydo-video--playing iframe {
    opacity: 1;
}

.klydo-nav-prev,
.klydo-nav-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
    cursor: pointer;
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    border: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.klydo-nav-prev:hover,
.klydo-nav-next:hover {
    transform: translateY(-50%) scale(1.08);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.22);
}

.klydo-has-active .klydo-nav-prev { left: 16px; }
.klydo-has-active .klydo-nav-next { right: 16px; }
.klydo-nav-prev { left: 8px; }
.klydo-nav-next { right: 8px; }

.klydo-nav-prev::after, .klydo-nav-next::after {
    content: "";
    width: 10px;
    height: 10px;
    border-top: 2px solid #333;
    border-right: 2px solid #333;
}

.klydo-nav-prev::after { transform: rotate(-135deg); margin-left: 4px; }
.klydo-nav-next::after { transform: rotate(45deg); margin-right: -4px; }

@media (min-width: 769px) {
    .klydo-carousel:hover .klydo-nav-prev,
    .klydo-carousel:hover .klydo-nav-next {
        display: flex;
    }
}

.klydo-swipe-hint {
    display: none;
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    z-index: 10;
    animation: klydo-pulse 2s infinite;
}

@media (max-width: 768px) {
    .klydo-swipe-hint { display: block; }
}

@keyframes klydo-pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}
