/* Carousel Widget Styles */
.kb-videomate-carousel {
    position: relative;
    margin: 30px 0;
    padding: 0 40px;
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
}

.kb-videomate-carousel-container {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.kb-videomate-carousel-inner {
    display: flex;
    transition: transform 0.3s ease;
    gap: 20px;
    padding: 20px 0;
}

/* Portrait Mode Carousel */
.kb-videomate-carousel.portrait-mode .kb-videomate-carousel-inner {
    gap: 15px;
}

.kb-videomate-carousel.portrait-mode .kb-videomate-carousel-item {
    flex: 0 0 calc((95% - 30px) / 3); /* Show 3 portrait videos */
    max-width: calc((100% - 30px) / 3);
}

.kb-videomate-carousel.portrait-mode .kb-videomate-video-wrapper {
    padding-bottom: 177.78%; /* 9:16 aspect ratio */
}

/* Landscape Mode Carousel */
.kb-videomate-carousel.landscape-mode .kb-videomate-carousel-inner {
    gap: 15px;
}

.kb-videomate-carousel.landscape-mode .kb-videomate-carousel-item {
    flex: 0 0 100%;
    max-width: 100%;
}

.kb-videomate-carousel.landscape-mode .kb-videomate-video-wrapper {
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
}

.kb-videomate-carousel-item {
    flex: 0 0 calc((100% - (var(--visible-videos, 4) - 1) * 20px) / var(--visible-videos, 4));
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.kb-videomate-video-wrapper {
    position: relative;
    overflow: hidden;
    background: #000;
    border-radius: 12px;
    margin: 0;
}

.kb-videomate-video-wrapper video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.kb-videomate-video-title {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px;
    background: rgba(0,0,0,0.7);
    color: #fff;
    font-size: 14px;
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.kb-videomate-video-wrapper:hover .kb-videomate-video-title {
    opacity: 1;
}

/* Carousel Navigation */
.kb-videomate-carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.9);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transition: all 0.3s ease;
}

.kb-videomate-carousel-nav.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.kb-videomate-carousel-prev {
    left: 10px;
}

.kb-videomate-carousel-next {
    right: 10px;
}

.kb-videomate-carousel-nav:hover:not(.disabled) {
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.kb-videomate-carousel-nav svg {
    width: 24px;
    height: 24px;
    fill: #333;
}

/* Responsive Styles */
@media (max-width: 1024px) {
    .kb-videomate-carousel.portrait-mode .kb-videomate-carousel-item {
        flex: 0 0 calc((95% - 15px) / 2);
        max-width: calc((100% - 15px) / 2);
    }
}

@media (max-width: 768px) {
    .kb-videomate-carousel {
        padding: 0 30px;
        margin: 15px 0;
    }
    
    /* Force single video view in mobile for both portrait and landscape */
    .kb-videomate-carousel.portrait-mode .kb-videomate-carousel-item,
    .kb-videomate-carousel.landscape-mode .kb-videomate-carousel-item {
        flex: 0 0 100%;
        max-width: 100%;
        margin: 0;
    }

    /* Adjust video wrapper for better mobile view */
    .kb-videomate-video-wrapper {
        max-height: 70vh;
        margin: 0 auto;
    }

    .kb-videomate-carousel.portrait-mode .kb-videomate-video-wrapper {
        max-width: 70%;
        margin: 0 auto;
    }
    
    .kb-videomate-carousel-nav {
        width: 30px;
        height: 30px;
        background: rgba(255,255,255,0.95);
    }
    
    .kb-videomate-carousel-nav svg {
        width: 20px;
        height: 20px;
    }

}

/* Additional mobile adjustments for smaller screens */
@media (max-width: 480px) {
    .kb-videomate-carousel {
        padding: 0 25px;
    }

    .kb-videomate-carousel.portrait-mode .kb-videomate-video-wrapper {
        max-width: 85%;
    }

}


/* Fullscreen modal styles */
.kb-videomate-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
}

.kb-videomate-modal-content {
    position: relative;
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 16px rgba(0,0,0,0.3);
}

.kb-videomate-modal-close {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 2rem;
    color: #333;
    cursor: pointer;
    z-index: 2;
    background: none;
    border: none;
    padding: 5px;
}

.kb-videomate-modal video {
    max-width: 90vw;
    max-height: 90vh;
    display: block;
    margin: 0 auto;
}

/* Video Controls */
.kb-videomate-video-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    background: linear-gradient(transparent, rgba(0,0,0,0.5));
    display: flex;
    align-items: center;
    gap: 15px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.kb-videomate-floating-body:hover .kb-videomate-video-controls {
    opacity: 1;
}

/* Control Icons */
.kb-videomate-icon {
    width: 24px;
    height: 24px;
    fill: #fff;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2));
}

.kb-videomate-play-pause,
.kb-videomate-mute-unmute {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    cursor: pointer;
    width: 40px;
    height: 40px;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.kb-videomate-play-pause:hover,
.kb-videomate-mute-unmute:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.05);
}

/* Carousel Widget Styles */
.kb-videomate-carousel-widget {
    margin: 30px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.kb-videomate-carousel-heading {
    margin: 0 0 20px;
    font-size: 20px;
    color: #333;
    display: none;
}

/* Video Container Styles */
.kb-videomate-video-wrapper {
    position: relative;
    width: 100%;
    background: #000;
    border-radius: 16px;
    overflow: hidden;
}

.kb-videomate-video-wrapper video,
.kb-videomate-floating-body video {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
    margin: 0;
    padding: 0;
}

/* Debug Info */
.kb-videomate-debug {
    margin-top: 10px;
    padding: 10px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.kb-videomate-debug pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Error Message */
.kb-videomate-error {
    padding: 15px;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    color: #721c24;
    text-align: center;
    margin: 10px 0;
}

.kb-videomate-error a {
    color: #721c24;
    text-decoration: underline;
    font-weight: bold;
}

.kb-videomate-error a:hover {
    text-decoration: none;
}

/* Video Controls */
video::-webkit-media-controls {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

video::-webkit-media-controls-enclosure {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}


/* Loading State */
.kb-videomate-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #666;
}

/* Video Controls Customization */
.kb-videomate-carousel video::-webkit-media-controls,
.kb-videomate-float-content video::-webkit-media-controls {
    background-color: rgba(0,0,0,0.7);
}

.kb-videomate-carousel video::-webkit-media-controls-panel,
.kb-videomate-float-content video::-webkit-media-controls-panel {
    padding: 5px;
}


/* Loading State */
.kb-videomate-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: kb-videomate-spin 1s linear infinite;
}

@keyframes kb-videomate-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Video Widget Containers */
.kb-videomate-widget {
    margin: 20px 0;
    padding: 15px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.kb-videomate-widget-heading {
    font-size: 1.2em;
    font-weight: 600;
    margin-bottom: 15px;
    color: #333;
}

/* Carousel Widget */
.kb-videomate-carousel {
    position: relative;
    overflow: hidden;
}

.kb-videomate-carousel-inner {
    display: flex;
    transition: transform 0.3s ease;
}

.kb-videomate-carousel-item {
    flex: 0 0 auto;
    padding: 0 10px;
    width: calc(100% / var(--visible-videos, 4));
}

.kb-videomate-video-wrapper {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
    height: 0;
    overflow: hidden;
    border-radius: 16px;
    background: #f0f0f0;
}

.kb-videomate-video-wrapper video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Carousel Navigation */
.kb-videomate-carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.9);
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 2;
}

.kb-videomate-carousel-prev {
    left: 10px;
}

.kb-videomate-carousel-next {
    right: 10px;
}

.kb-videomate-carousel-nav:hover {
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.kb-videomate-carousel-nav svg {
    width: 20px;
    height: 20px;
    fill: #333;
}


/* Responsive Design */
@media screen and (max-width: 768px) {
    .kb-videomate-carousel {
        padding: 0 25px !important;
    }

    .kb-videomate-carousel-inner {
        gap: 0 !important;
    }

    .kb-videomate-carousel-item {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .kb-videomate-carousel-nav {
        width: 36px !important;
        height: 36px !important;
        background: rgba(255,255,255,0.95) !important;
        z-index: 10 !important;
    }

    .kb-videomate-carousel-prev {
        left: 5px !important;
    }

    .kb-videomate-carousel-next {
        right: 5px !important;
    }

}

@media screen and (max-width: 480px) {
    .kb-videomate-carousel-item {
        width: calc(100% / var(--visible-videos-mobile, 1));
    }
    
}

/* Ensure video controls are visible */
.kb-videomate-video-wrapper video,
.kb-videomate-floating-body video {
    width: 100%;
    height: auto;
    display: block;
}

.kb-videomate-video-wrapper video::-webkit-media-controls,
.kb-videomate-floating-body video::-webkit-media-controls {
    display: flex !important;
    visibility: visible !important;
}


/* Custom Video Controls */
.kb-videomate-video-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.kb-videomate-floating-body:hover .kb-videomate-video-controls {
    opacity: 1;
}

.kb-videomate-play-pause,
.kb-videomate-mute-unmute {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    width: 32px;
    height: 32px;
    padding: 6px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.kb-videomate-play-pause:hover,
.kb-videomate-mute-unmute:hover {
    background: rgba(255,255,255,0.2);
}

.kb-videomate-progress {
    flex-grow: 1;
    height: 4px;
    background: rgba(255,255,255,0.3);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
}

.kb-videomate-progress-bar {
    height: 100%;
    background: #fff;
    border-radius: 2px;
    width: 0%;
}

/* Control Icons */
.kb-videomate-icon {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Video Orientation Styles */
.kb-videomate-video-wrapper {
    position: relative;
    overflow: hidden;
    background: #000;
    border-radius: 12px;
}

.kb-videomate-video-wrapper.landscape {
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
}

.kb-videomate-video-wrapper.portrait {
    padding-bottom: 177.78%; /* 9:16 aspect ratio */
}

.kb-videomate-video-wrapper video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Video Controls */
.kb-videomate-video-wrapper video::-webkit-media-controls,
.kb-videomate-floating-body video::-webkit-media-controls {
    display: flex !important;
    opacity: 1 !important;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
}

/* Ensure videos maintain aspect ratio */
.kb-videomate-video-wrapper video,
.kb-videomate-floating-body video {
    background: #000;
}

/* Video Controls */
.kb-videomate-video-wrapper video::-webkit-media-controls {
    display: flex !important;
    opacity: 1 !important;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
}

/* Currently Playing State */
.kb-videomate-carousel-item.is-playing .kb-videomate-video-wrapper {
    box-shadow: 0 0 0 2px #fff, 0 4px 12px rgba(0,0,0,0.2);
}

/* ==========================================================================
 * Floating Widget
 * Widgets are grouped in a fixed "stack" per side, so several floating
 * videos on one page sit above each other instead of overlapping.
 * ========================================================================== */
.kb-videomate-floating-stack {
    /* Expanded card width per video shape, and the tallest the card may be */
    --kbvm-floating-width: 220px;
    --kbvm-floating-width-square: 260px;
    --kbvm-floating-width-landscape: 340px;
    --kbvm-floating-max-height: 60vh;
    --kbvm-bubble-size: 72px;
    --kbvm-ring: linear-gradient(45deg, #f9ce34, #ee2a7b, #6228d7);
    --kbvm-ring-pulse: rgba(238, 42, 123, 0.45);
    position: fixed;
    bottom: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column-reverse;
    gap: 12px;
    pointer-events: none;
}

.kb-videomate-floating-stack--right {
    right: 20px;
    align-items: flex-end;
}

.kb-videomate-floating-stack--left {
    left: 20px;
    align-items: flex-start;
}

/* Hidden until frontend.js has applied the visitor's saved state (no flash) */
.kb-videomate-floating-stack.is-loading {
    visibility: hidden;
}

/*
 * The card follows the video's shape: --kbvm-ratio (width / height, set inline from the stored
 * ratio, or by frontend.js once an MP4 is measured) and a kbvm-shape-* width class. The width is
 * reduced when the card would be taller than --kbvm-floating-max-height or wider than the screen.
 */
.kb-videomate-floating {
    --kbvm-card-width: var(--kbvm-floating-width);
    position: relative;
    width: var(--kbvm-card-width);
    width: min(var(--kbvm-card-width), calc(var(--kbvm-floating-max-height) * var(--kbvm-ratio, 0.5625)), calc(100vw - 24px));
    pointer-events: auto;
    transition: width 0.25s ease, opacity 0.25s ease, transform 0.25s ease;
}

.kb-videomate-floating.kbvm-shape-square {
    --kbvm-card-width: var(--kbvm-floating-width-square);
}

.kb-videomate-floating.kbvm-shape-landscape {
    --kbvm-card-width: var(--kbvm-floating-width-landscape);
}

.kb-videomate-floating.is-closing {
    opacity: 0;
    transform: translateY(12px);
}

.kb-videomate-floating .kb-videomate-floating-body {
    position: relative;
    width: 100%;
    height: auto;
    padding: 0;
    aspect-ratio: var(--kbvm-ratio, 0.5625);
    background: #000;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    transition: border-radius 0.25s ease;
}

@supports not (aspect-ratio: 1 / 1) {
    .kb-videomate-floating .kb-videomate-floating-body {
        padding-bottom: calc(100% / var(--kbvm-ratio, 0.5625));
    }
}

.kb-videomate-floating .kb-videomate-floating-body video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    margin: 0;
    object-fit: cover;
    background: #000;
    box-sizing: border-box;
}

/* Buttons (reset theme button styles) */
.kb-videomate-floating .kb-videomate-floating-btn {
    -webkit-appearance: none;
    appearance: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    min-width: 0;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    line-height: 1;
    box-shadow: none;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.kb-videomate-floating .kb-videomate-floating-btn:hover,
.kb-videomate-floating .kb-videomate-floating-btn:focus-visible {
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
}

.kb-videomate-floating .kb-videomate-floating-btn:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 1px;
}

.kb-videomate-floating .kb-videomate-floating-btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.kb-videomate-floating-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 3;
    display: flex;
    gap: 6px;
}

.kb-videomate-floating .kb-videomate-mute-btn {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 3;
}

.kb-videomate-floating .kb-videomate-mute-btn .kb-videomate-mute-icon,
.kb-videomate-floating .kb-videomate-mute-btn.is-muted .kb-videomate-volume-icon {
    display: none;
}

.kb-videomate-floating .kb-videomate-mute-btn.is-muted .kb-videomate-mute-icon {
    display: block;
}

/* Play hint, only shown in the minimized bubble */
.kb-videomate-floating-play {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 2;
    display: none;
    width: 26px;
    height: 26px;
    margin: -13px 0 0 -13px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.45);
    pointer-events: none;
}

.kb-videomate-floating-play svg {
    width: 16px;
    height: 16px;
    margin: 5px 0 0 6px;
    fill: #fff;
}

/* ---------- Minimized bubble ---------- */
.kb-videomate-floating.is-minimized {
    width: var(--kbvm-bubble-size);
    cursor: pointer;
}

.kb-videomate-floating.is-minimized .kb-videomate-floating-body {
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    background: var(--kbvm-ring);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    animation: kbvm-bubble-pulse 2.4s ease-out infinite;
}

@supports not (aspect-ratio: 1 / 1) {
    .kb-videomate-floating.is-minimized .kb-videomate-floating-body {
        padding-bottom: 100%;
    }
}

/* Video inside the gradient ring, separated by a white border */
.kb-videomate-floating.is-minimized .kb-videomate-floating-body video {
    top: 3px;
    left: 3px;
    width: calc(100% - 6px);
    height: calc(100% - 6px);
    border: 2px solid #fff;
    border-radius: 50%;
}

.kb-videomate-floating.is-minimized .kb-videomate-floating-play {
    display: block;
}

.kb-videomate-floating.is-minimized .kb-videomate-mute-btn,
.kb-videomate-floating.is-minimized .kb-videomate-floating-minimize {
    display: none;
}

/* Close becomes a small badge on the bubble */
.kb-videomate-floating.is-minimized .kb-videomate-floating-actions {
    top: -4px;
    right: -4px;
}

.kb-videomate-floating.is-minimized .kb-videomate-floating-btn {
    width: 22px;
    height: 22px;
    background: #333;
    border: 2px solid #fff;
}

.kb-videomate-floating.is-minimized .kb-videomate-floating-btn svg {
    width: 12px;
    height: 12px;
}

.kb-videomate-floating.is-minimized:focus-visible {
    outline: none;
}

.kb-videomate-floating.is-minimized:focus-visible .kb-videomate-floating-body {
    outline: 3px solid #2271b1;
    outline-offset: 2px;
}

@keyframes kbvm-bubble-pulse {
    0% { box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25), 0 0 0 0 var(--kbvm-ring-pulse); }
    70% { box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25), 0 0 0 10px rgba(238, 42, 123, 0); }
    100% { box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25), 0 0 0 0 rgba(238, 42, 123, 0); }
}

@media (prefers-reduced-motion: reduce) {
    .kb-videomate-floating,
    .kb-videomate-floating .kb-videomate-floating-body {
        transition: none;
    }

    .kb-videomate-floating.is-minimized .kb-videomate-floating-body {
        animation: none;
    }
}

@media (max-width: 768px) {
    .kb-videomate-floating-stack {
        --kbvm-floating-width: 150px;
        --kbvm-floating-width-square: 180px;
        --kbvm-floating-width-landscape: 260px;
        --kbvm-floating-max-height: 50vh;
        --kbvm-bubble-size: 60px;
        bottom: 16px;
        gap: 10px;
    }

    .kb-videomate-floating-stack--right {
        right: 12px;
    }

    .kb-videomate-floating-stack--left {
        left: 12px;
    }

    .kb-videomate-floating .kb-videomate-floating-btn {
        width: 26px;
        height: 26px;
    }

    .kb-videomate-floating .kb-videomate-floating-btn svg {
        width: 16px;
        height: 16px;
    }
}
/* ==========================================================================
 * Video title (carousel): top overlay so it never covers the native controls
 * ========================================================================== */
.kb-videomate-video-wrapper .kb-videomate-video-title {
    top: 0;
    bottom: auto;
    z-index: 2;
    background: linear-gradient(rgba(0, 0, 0, 0.6), transparent);
    text-align: left;
    pointer-events: none;
}

/* ==========================================================================
 * Shop this video (shoppable products)
 * One product card per view (scroll-snap) with a small pager; no cut-off peek.
 * Everything is scoped under .kbvm-shop so theme img/a/button rules cannot reach it.
 * ========================================================================== */
.kbvm-shop {
    --kbvm-shop-ink: #1d1d1f;
    --kbvm-shop-muted: #6e6e73;
    --kbvm-shop-accent: #111;
    --kbvm-shop-sale: #c62828;
    margin-top: 8px;
    max-width: 100%;
    box-sizing: border-box;
    font-size: 13px;
    line-height: 1.3;
}

.kbvm-shop .kbvm-shop-list {
    display: flex;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.kbvm-shop .kbvm-shop-list::-webkit-scrollbar {
    display: none;
}

.kbvm-shop .kbvm-shop-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    flex: 0 0 100%;
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 10px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.14);
    scroll-snap-align: start;
    scroll-snap-stop: always;
    box-sizing: border-box;
    overflow: hidden;
}

.kbvm-shop .kbvm-shop-link {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1 1 100%;
    min-width: 0;
    color: var(--kbvm-shop-ink);
    text-decoration: none;
}

.kbvm-shop .kbvm-shop-link:hover,
.kbvm-shop .kbvm-shop-link:focus {
    color: var(--kbvm-shop-ink);
    text-decoration: none;
}

.kbvm-shop .kbvm-shop-link:hover .kbvm-shop-name,
.kbvm-shop .kbvm-shop-link:focus-visible .kbvm-shop-name {
    text-decoration: underline;
}

/* Thumbnail: fixed box with border + light background so white product shots stay visible */
.kbvm-shop .kbvm-shop-thumb {
    position: relative;
    display: block;
    flex: 0 0 52px;
    width: 52px;
    height: 52px;
    min-width: 52px;
    margin: 0;
    padding: 0;
    border: 1px solid #e3e3e8;
    border-radius: 10px;
    background: #f5f5f7;
    box-sizing: border-box;
    overflow: hidden;
}

.kbvm-shop .kbvm-shop-thumb img,
.kbvm-shop a .kbvm-shop-thumb img {
    display: block;
    position: static;
    width: 100%;
    height: 100%;
    min-width: 0;
    max-width: none;
    min-height: 0;
    max-height: none;
    margin: 0;
    padding: 3px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    opacity: 1;
    visibility: visible;
    object-fit: contain;
    box-sizing: border-box;
}

/* Broken or missing image: neutral placeholder block (class set by frontend.js) */
.kbvm-shop .kbvm-shop-thumb.is-broken img {
    display: none;
}

.kbvm-shop .kbvm-shop-thumb.is-broken::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23b0b0b8'><path d='M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3 3.5-4.5 4.5 6H5l3.5-4.5z'/></svg>") center / contain no-repeat;
}

.kbvm-shop .kbvm-shop-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1 1 auto;
    min-width: 0;
}

.kbvm-shop .kbvm-shop-name {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
    white-space: normal;
    overflow-wrap: break-word;
    word-break: normal;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
}

.kbvm-shop .kbvm-shop-price {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 2px 6px;
    color: var(--kbvm-shop-ink);
    font-size: 13px;
    font-weight: 600;
}

.kbvm-shop .kbvm-shop-price del {
    color: var(--kbvm-shop-muted);
    font-size: 11px;
    font-weight: 400;
}

.kbvm-shop .kbvm-shop-price ins {
    color: var(--kbvm-shop-sale);
    text-decoration: none;
}

/* Add / View button (reset theme button styles) */
.kbvm-shop .kbvm-shop-add {
    -webkit-appearance: none;
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    flex: 1 1 0;
    min-width: 36px;
    height: 36px;
    min-height: 36px;
    margin: 0;
    padding: 0 12px;
    border: 0;
    border-radius: 18px;
    background: var(--kbvm-shop-accent);
    color: #fff;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    box-sizing: border-box;
    box-shadow: none;
    text-shadow: none;
    cursor: pointer;
}

.kbvm-shop .kbvm-shop-add:hover,
.kbvm-shop .kbvm-shop-add:focus-visible {
    background: #333;
    color: #fff;
    text-decoration: none;
}

.kbvm-shop .kbvm-shop-add:focus-visible,
.kbvm-shop .kbvm-shop-cart-link:focus-visible,
.kbvm-shop .kbvm-shop-pager button:focus-visible {
    outline: 2px solid var(--kbvm-shop-accent);
    outline-offset: 2px;
}

.kbvm-shop .kbvm-shop-add svg {
    flex: 0 0 16px;
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.kbvm-shop .kbvm-shop-add.is-loading {
    opacity: 0.7;
    cursor: progress;
}

.kbvm-shop .kbvm-shop-add.is-added {
    background: #1e7e34;
}

.kbvm-shop .kbvm-shop-add-text,
.kbvm-shop .kbvm-shop-cart-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/*
 * "View cart" (added by frontend.js after a successful add): outlined pill in the same action row,
 * same height as the Add button, so the card keeps its height.
 */
.kbvm-shop-cart-link[hidden] {
    display: none !important;
}

.kbvm-shop .kbvm-shop-cart-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    flex: 1 1 0;
    min-width: 36px;
    height: 36px;
    min-height: 36px;
    margin: 0;
    padding: 0 12px;
    border: 1px solid var(--kbvm-shop-accent);
    border-radius: 18px;
    background: #fff;
    color: var(--kbvm-shop-accent);
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    box-sizing: border-box;
    box-shadow: none;
}

.kbvm-shop .kbvm-shop-cart-link:hover,
.kbvm-shop .kbvm-shop-cart-link:focus-visible {
    background: var(--kbvm-shop-accent);
    color: #fff;
    text-decoration: none;
}

.kbvm-shop .kbvm-shop-cart-link svg {
    flex: 0 0 14px;
    width: 14px;
    height: 14px;
    fill: currentColor;
}

/* Pager: prev / "1 / 3" / next */
.kbvm-shop .kbvm-shop-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 6px 0 0;
    padding: 0;
}

.kbvm-shop .kbvm-shop-pager button {
    -webkit-appearance: none;
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    color: var(--kbvm-shop-ink);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    line-height: 1;
    cursor: pointer;
}

.kbvm-shop .kbvm-shop-pager button:disabled {
    opacity: 0.4;
    cursor: default;
}

.kbvm-shop .kbvm-shop-pager svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.kbvm-shop .kbvm-shop-count {
    min-width: 36px;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.95);
    color: var(--kbvm-shop-ink);
    font-size: 12px;
    font-weight: 600;
    text-align: center;
}

/* Wide cards (landscape popup on desktop, carousel): everything in one row, actions to the right */
.kb-videomate-carousel .kbvm-shop .kbvm-shop-link,
.kb-videomate-floating.kbvm-shape-landscape .kbvm-shop .kbvm-shop-link {
    flex: 1 1 0;
}

.kb-videomate-carousel .kbvm-shop .kbvm-shop-add,
.kb-videomate-carousel .kbvm-shop .kbvm-shop-cart-link,
.kb-videomate-floating.kbvm-shape-landscape .kbvm-shop .kbvm-shop-add,
.kb-videomate-floating.kbvm-shape-landscape .kbvm-shop .kbvm-shop-cart-link {
    flex: 0 0 auto;
    max-width: 45%;
}

/* After adding, the Add button keeps only its icon so the pill and the name still have room */
.kbvm-shop .kbvm-shop-item.has-cart-link {
    gap: 6px;
}

.kbvm-shop .kbvm-shop-item.has-cart-link button.kbvm-shop-add {
    flex: 0 0 36px;
    width: 36px;
    padding: 0;
}

.kbvm-shop .kbvm-shop-item.has-cart-link button.kbvm-shop-add .kbvm-shop-add-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

/* Floating widget: hidden while minimized */
.kb-videomate-floating.is-minimized .kbvm-shop {
    display: none;
}

/* Wide single-row cards: the Add button is icon-only (label for screen readers) */
.kb-videomate-floating.kbvm-shape-landscape .kbvm-shop button.kbvm-shop-add {
    flex: 0 0 36px;
    width: 36px;
    padding: 0;
}

.kb-videomate-floating.kbvm-shape-landscape .kbvm-shop button.kbvm-shop-add .kbvm-shop-add-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

/* Phones: the popup is narrow, so the card always stacks (info on top, full-width actions below) */
@media (max-width: 768px) {
    .kb-videomate-floating .kbvm-shop .kbvm-shop-link {
        flex: 1 1 100%;
    }

    .kb-videomate-floating .kbvm-shop .kbvm-shop-add,
    .kb-videomate-floating .kbvm-shop .kbvm-shop-cart-link {
        flex: 1 1 0;
        max-width: none;
    }

    .kb-videomate-floating .kbvm-shop button.kbvm-shop-add {
        width: auto;
        padding: 0 12px;
    }

    .kb-videomate-floating .kbvm-shop button.kbvm-shop-add .kbvm-shop-add-text {
        position: static;
        width: auto;
        height: auto;
        clip: auto;
    }

    .kb-videomate-floating .kbvm-shop .kbvm-shop-item.has-cart-link button.kbvm-shop-add {
        flex: 0 0 36px;
        width: 36px;
        padding: 0;
    }

    .kb-videomate-floating .kbvm-shop .kbvm-shop-item.has-cart-link button.kbvm-shop-add .kbvm-shop-add-text {
        position: absolute;
        width: 1px;
        height: 1px;
        clip: rect(0 0 0 0);
    }
}

/* Theme button styles (padding, min-width) must not squash the carousel arrows */
.kb-videomate-carousel .kb-videomate-carousel-nav {
    min-width: 0;
    min-height: 0;
    padding: 0;
    line-height: 1;
}

/* ==========================================================================
 * Device targeting (CSS only, so it also works with full-page caching)
 * ========================================================================== */
@media (max-width: 767px) {
    .kbvm-device-desktop {
        display: none !important;
    }
}

@media (min-width: 768px) {
    .kbvm-device-mobile {
        display: none !important;
    }
}

/* Floating video waiting for its display trigger (delay / scroll) */
.kb-videomate-floating.is-waiting {
    display: none !important;
}

/* ==========================================================================
 * YouTube / Vimeo: poster + play button, iframe created on click
 * ========================================================================== */
.kbvm-embed {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    overflow: hidden;
}

.kbvm-embed-poster {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    margin: 0;
    object-fit: cover;
}

.kbvm-embed iframe {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    width: 100%;
    height: 100%;
    border: 0;
}

.kbvm-embed .kbvm-embed-play {
    -webkit-appearance: none;
    appearance: none;
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    min-width: 0;
    min-height: 0;
    margin: -32px 0 0 -32px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    box-shadow: none;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.kbvm-embed .kbvm-embed-play:hover,
.kbvm-embed .kbvm-embed-play:focus-visible {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.06);
}

.kbvm-embed .kbvm-embed-play:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 2px;
}

.kbvm-embed .kbvm-embed-play svg {
    width: 30px;
    height: 30px;
    margin-left: 4px;
    fill: currentColor;
}

.kbvm-embed.is-active .kbvm-embed-play,
.kbvm-embed.is-active .kbvm-embed-poster {
    display: none;
}

/* Embed inside the floating card and the minimized bubble */
.kb-videomate-floating .kbvm-embed .kbvm-embed-play {
    width: 52px;
    height: 52px;
    margin: -26px 0 0 -26px;
}

.kb-videomate-floating.is-embed:not(.is-minimized) .kb-videomate-floating-play {
    display: none;
}

.kb-videomate-floating.is-minimized .kbvm-embed {
    top: 3px;
    left: 3px;
    width: calc(100% - 6px);
    height: calc(100% - 6px);
    border: 2px solid #fff;
    border-radius: 50%;
    box-sizing: border-box;
}

.kb-videomate-floating.is-minimized .kbvm-embed-play {
    display: none;
}

/* ==========================================================================
 * Video in a box of a different shape (widget "Video Shape", or a carousel's
 * minority videos): shown whole, centred over a blurred copy of its poster.
 * frontend.js adds kbvm-fit-wide (video wider than the box) or kbvm-fit-tall
 * to the box and sets --kbvm-media-ratio (the video's width / height).
 * The minimized bubble always fills its circle instead.
 * ========================================================================== */
.kbvm-backdrop {
    display: none;
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background-color: #000;
    background-position: center;
    background-size: cover;
    filter: blur(18px) brightness(0.7);
    transform: scale(1.25);
    pointer-events: none;
}

.kb-videomate-video-wrapper.kbvm-fit-wide > .kbvm-backdrop,
.kb-videomate-video-wrapper.kbvm-fit-tall > .kbvm-backdrop,
.kb-videomate-floating:not(.is-minimized) .kbvm-fit-wide > .kbvm-backdrop,
.kb-videomate-floating:not(.is-minimized) .kbvm-fit-tall > .kbvm-backdrop {
    display: block;
}

.kb-videomate-video-wrapper.kbvm-fit-wide > video,
.kb-videomate-video-wrapper.kbvm-fit-tall > video,
.kb-videomate-floating:not(.is-minimized) .kbvm-fit-wide > video,
.kb-videomate-floating:not(.is-minimized) .kbvm-fit-tall > video {
    object-fit: contain;
    background: transparent;
}

/* YouTube / Vimeo: size the player itself to the video, so it has no black bars */
.kb-videomate-video-wrapper.kbvm-fit-wide > .kbvm-embed,
.kb-videomate-floating:not(.is-minimized) .kbvm-fit-wide > .kbvm-embed {
    top: 50%;
    left: 0;
    width: 100%;
    height: auto;
    aspect-ratio: var(--kbvm-media-ratio, 1.7778);
    transform: translateY(-50%);
}

.kb-videomate-video-wrapper.kbvm-fit-tall > .kbvm-embed,
.kb-videomate-floating:not(.is-minimized) .kbvm-fit-tall > .kbvm-embed {
    top: 0;
    left: 50%;
    width: auto;
    height: 100%;
    aspect-ratio: var(--kbvm-media-ratio, 0.5625);
    transform: translateX(-50%);
}

/* Square carousel (widget "Video Shape: Square", or mostly square videos) */
.kb-videomate-carousel.square-mode .kb-videomate-carousel-inner {
    gap: 15px;
}

.kb-videomate-carousel.square-mode .kb-videomate-video-wrapper {
    padding-bottom: 100%;
}

@media (max-width: 768px) {
    .kb-videomate-carousel.square-mode .kb-videomate-carousel-item {
        flex: 0 0 100%;
        max-width: 100%;
        margin: 0;
    }

    .kb-videomate-carousel.square-mode .kb-videomate-video-wrapper {
        max-width: 85%;
        margin: 0 auto;
    }
}

/* Gutenberg block preview when no carousel is chosen */
.kbvm-block-empty {
    padding: 16px;
    border: 1px dashed #c3c4c7;
    color: #50575e;
}

/* Slides without a product strip should not stretch to the tallest slide */
.kb-videomate-carousel .kb-videomate-carousel-inner {
    align-items: flex-start;
}

/* OpenCart: "Visit" redirect button */
.kbvm-visit {
    position: absolute;
    right: 10px;
    bottom: 52px; /* above the native control bar */
    max-width: calc(100% - 20px);
    box-sizing: border-box;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.2;
    z-index: 5;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.kbvm-visit:hover,
.kbvm-visit:focus {
    background: #fff;
    color: #000;
    text-decoration: none;
}
.kb-videomate-floating.is-minimized .kbvm-visit {
    display: none;
}

/* ==========================================================================
 * Carousel height cap: a slide is never taller than its cap, whatever the
 * video shape or how few slides are visible. The box keeps its aspect ratio
 * and is centred in the slide; the cap also stops a single full-width slide
 * (phones, tablets) from growing to the full screen height.
 * ========================================================================== */
@supports (aspect-ratio: 1 / 1) {
    .kb-videomate-carousel .kb-videomate-video-wrapper {
        --kbvm-cap: 340px;
        --kbvm-box: 1.7778;
        height: auto;
        padding-bottom: 0;
        width: 100%;
        max-height: var(--kbvm-cap);
        max-width: calc(var(--kbvm-cap) * var(--kbvm-box));
        aspect-ratio: var(--kbvm-box);
        margin-left: auto;
        margin-right: auto;
    }

    .kb-videomate-carousel.landscape-mode .kb-videomate-video-wrapper {
        --kbvm-cap: 340px;
        --kbvm-box: 1.7778;
        padding-bottom: 0;
    }

    .kb-videomate-carousel.portrait-mode .kb-videomate-video-wrapper {
        --kbvm-cap: 460px;
        --kbvm-box: 0.5625;
        padding-bottom: 0;
    }

    .kb-videomate-carousel.square-mode .kb-videomate-video-wrapper {
        --kbvm-cap: 380px;
        --kbvm-box: 1;
        padding-bottom: 0;
    }

    @media (max-width: 768px) {
        .kb-videomate-carousel .kb-videomate-video-wrapper,
        .kb-videomate-carousel.portrait-mode .kb-videomate-video-wrapper {
            max-height: min(var(--kbvm-cap), 60vh);
            max-width: calc(min(var(--kbvm-cap), 60vh) * var(--kbvm-box));
        }
    }
}
