﻿/*
 * ds-carousel-ssr.css — Global (unscoped) carousel base styles
 * for SSR-rendered carousels that don't go through the DSCarousel
 * Blazor component (whose scoped CSS doesn't apply to SSR markup).
 *
 * These are the same rules from DSCarousel.razor.css but without
 * Blazor CSS isolation scoping, so they apply to any .ds-carousel
 * element in the DOM.
 */

.ds-carousel {
    position: relative;
}

.ds-carousel-viewport {
    overflow: hidden;
    width: 100%;
}

.ds-carousel-track {
    display: flex;
    cursor: grab;
    will-change: transform;
}

.ds-carousel-track:active {
    cursor: grabbing;
}

.ds-carousel-slide {
    flex-shrink: 0;
    box-sizing: border-box;
}

/* ── Arrow navigation ─────────────────────────────────── */

.ds-carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: #fff;
    border: 1px solid #E5E7EB;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    z-index: 10;
    color: #111827;
    transition: background-color 0.2s ease, transform 0.2s ease;
    font-size: 20px;
}

.ds-carousel-arrow:hover {
    background: #F9FAFB;
    transform: translateY(-50%) scale(1.05);
}

.ds-carousel-arrow:active {
    transform: translateY(-50%) scale(0.95);
}

.ds-carousel-arrow.hidden {
    display: none;
}

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

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

@media (max-width: 768px) {
    .ds-carousel-prev {
        left: -10px;
    }
    .ds-carousel-next {
        right: -10px;
    }
}

/* Hide carousel arrows on mobile — swipe/drag still works */
@media (max-width: 767px) {
    .ds-carousel-arrow {
        display: none !important;
    }
}

/* ── Dot navigation ───────────────────────────────────── */

.ds-carousel-dots {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 16px 0 8px;
}

.ds-carousel-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: none;
    background: #D1D5DB;
    cursor: pointer;
    padding: 0;
    transition: background-color 0.3s ease;
}

.ds-carousel-dot.active {
    background: #17D07E;
    width: 24px;
    height: 12px;
    border-radius: 16px;
}

.ds-carousel-dot:hover {
    background: #6EE7B7;
}

/* ── Loading state: hide content + show spinner until JS init ── */

/*
 * Before DSCarousel.init() runs, the track renders all slides in a
 * raw flex row causing a visual "blink". We keep the viewport in the
 * layout (opacity: 0) so the JS can compute slide widths, but hide it
 * visually behind an absolute spinner overlay. DSCarousel.init() sets
 * [data-ssr-initialized] which fades in the carousel and removes the
 * spinner. This applies to both SSR-rendered and WASM-rendered carousels.
 */

/* Keep carousel content in layout but invisible so init() can measure */
.ds-carousel:not([data-ssr-initialized]) .ds-carousel-viewport,
.ds-carousel:not([data-ssr-initialized]) .ds-carousel-dots {
    opacity: 0;
}

/* Fade in when ready */
.ds-carousel[data-ssr-initialized] .ds-carousel-viewport,
.ds-carousel[data-ssr-initialized] .ds-carousel-dots {
    opacity: 1;
    transition: opacity 0.3s ease;
}

/* Spinner overlay — sits on top of the invisible carousel */
.ds-carousel-loading {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-surface-app, #FAFAFA);
}

/* Hide spinner once carousel is ready */
.ds-carousel[data-ssr-initialized] .ds-carousel-loading {
    display: none;
}

/* Spinner ring */
.ds-carousel-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #E5E7EB;
    border-top-color: #24CB80;
    border-radius: 50%;
    animation: ds-carousel-spin 0.8s linear infinite;
}

@keyframes ds-carousel-spin {
    to { transform: rotate(360deg); }
}
