/* ===== BB SWIPER CURSOR MODULE ===== */

.bb-swiper-cursor-wrapper {
    position: relative;
}

/* ===== BREAKOUT - Går ut till högerkanten ===== */
.bb-swiper-cursor-wrapper.breakout-right {
    --_container-left: calc((100vw - 100%) / 2);
    overflow: visible;
    /* Utöka wrappern till höger fönsterkant */
    margin-right: calc(-1 * var(--_container-left));
    padding-right: 0;
    width: auto;
}

.bb-swiper-cursor-wrapper.breakout-right .swiper {
    overflow: visible !important;
    width: 100%;
}

.bb-swiper-cursor-wrapper.breakout-right .swiper-wrapper {
    /* Se till att slides kan gå utanför */
    overflow: visible;
}

/* Klipp vänsterkant - kort försvinner vid containerkanten */
/* Använd clip-path istället för overflow för att bara klippa vänster */
.bb-swiper-cursor-wrapper.breakout-right.clip-left {
    overflow: visible;
    clip-path: inset(0 -100vw 0 0);
}

/* ===== SWIPER ===== */
.bb-swiper-cursor-wrapper .swiper {
    width: 100%;
    padding: 20px 0;
}

.bb-swiper-cursor-wrapper .swiper-slide {
    height: auto;
    /* Förhindra markering vid drag */
    -webkit-user-select: none;
    user-select: none;
}

/* ===== KORT ===== */
.bb-swiper-card {
    display: block;
    text-decoration: none;
    color: inherit;
}

/* ===== REVEAL ANIMATION ===== */
.bb-swiper-cursor-wrapper.has-reveal .swiper-slide {
    opacity: 0;
    transform: translateX(60px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.bb-swiper-cursor-wrapper.has-reveal .swiper-slide.revealed {
    opacity: 1;
    transform: translateX(0);
}

/* Staggered delay för varje kort */
.bb-swiper-cursor-wrapper.has-reveal .swiper-slide:nth-child(1) { transition-delay: 0ms; }
.bb-swiper-cursor-wrapper.has-reveal .swiper-slide:nth-child(2) { transition-delay: 100ms; }
.bb-swiper-cursor-wrapper.has-reveal .swiper-slide:nth-child(3) { transition-delay: 200ms; }
.bb-swiper-cursor-wrapper.has-reveal .swiper-slide:nth-child(4) { transition-delay: 300ms; }
.bb-swiper-cursor-wrapper.has-reveal .swiper-slide:nth-child(5) { transition-delay: 400ms; }
.bb-swiper-cursor-wrapper.has-reveal .swiper-slide:nth-child(6) { transition-delay: 500ms; }

/* Reduced motion - ingen animation */
@media (prefers-reduced-motion: reduce) {
    .bb-swiper-cursor-wrapper.has-reveal .swiper-slide {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

.bb-swiper-card__image-wrapper {
    position: relative;
    overflow: hidden;
}

.bb-swiper-card__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--bb-swiper-zoom-duration, 700ms) cubic-bezier(0.4, 0, 0.2, 1);
    /* Förhindra att bilder dras */
    -webkit-user-drag: none;
    user-drag: none;
    -webkit-user-select: none;
    user-select: none;
    pointer-events: none;
}

.bb-swiper-card:hover .bb-swiper-card__image {
    transform: scale(var(--bb-swiper-zoom-scale, 1.05));
}

.bb-swiper-card--no-zoom:hover .bb-swiper-card__image {
    transform: none;
}

.bb-swiper-card__content {
    padding: 16px 0;
}

.bb-swiper-card__category {
    font-size: 0.875rem;
    margin: 4px 0 0 0;
    color: var(--bb-swiper-category-color, #666666);
}

.bb-swiper-card__title {
    font-size: 1.25rem;
    font-weight: 500;
    margin: 0;
    color: var(--bb-swiper-title-color, #1a1a1a);
}

.bb-swiper-card__excerpt {
    margin-top: 8px;
    font-size: 0.875rem;
    line-height: 1.6;
}

.bb-swiper-card__date {
    display: block;
    margin-top: 8px;
    font-size: 0.75rem;
    color: var(--bb-swiper-date-color, #999);
}

/* ===== CUSTOM FIELDS ===== */
.bb-swiper-custom-field {
    margin-top: 8px;
    font-size: 0.875rem;
    line-height: 1.5;
}

.bb-swiper-custom-field__label {
    font-weight: 600;
    color: var(--bb-swiper-custom-field-label-color, inherit);
}

.bb-swiper-custom-field__value {
    color: var(--bb-swiper-custom-field-value-color, inherit);
}

/* Nummer-fält */
.bb-swiper-custom-field--number .bb-swiper-custom-field__value {
    font-weight: 600;
}

/* Bild-fält */
.bb-swiper-custom-field--image {
    margin-top: 12px;
}

.bb-swiper-custom-field__image {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

/* Länk-fält */
.bb-swiper-custom-field--link {
    margin-top: 12px;
}

.bb-swiper-custom-field__link {
    display: inline-block;
    padding: 8px 16px;
    background: var(--bb-swiper-link-bg, #1a1a1a);
    color: var(--bb-swiper-link-color, #fff);
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.813rem;
    font-weight: 500;
    transition: opacity 0.2s ease;
}

.bb-swiper-custom-field__link:hover {
    opacity: 0.85;
}

/* WYSIWYG-fält */
.bb-swiper-custom-field--wysiwyg {
    margin-top: 12px;
}

.bb-swiper-custom-field--wysiwyg p {
    margin: 0 0 8px;
}

.bb-swiper-custom-field--wysiwyg p:last-child {
    margin-bottom: 0;
}

/* Datum-fält */
.bb-swiper-custom-field--date {
    color: var(--bb-swiper-date-color, #999);
    font-size: 0.75rem;
}

/* True/False-fält (kan användas som badges) */
.bb-swiper-custom-field--true_false .bb-swiper-custom-field__value {
    display: inline-block;
    padding: 2px 8px;
    background: var(--bb-swiper-badge-bg, #e8e8e8);
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* ===== CUSTOM CURSOR ===== */
.bb-swiper-custom-cursor {
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.bb-swiper-custom-cursor--blur {
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.bb-swiper-custom-cursor.active {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* Grabbing state - tydlig visuell feedback vid drag */
.bb-swiper-custom-cursor.grabbing {
    transform: translate(-50%, -50%) scale(0.85);
    opacity: 0.9;
}

.bb-swiper-custom-cursor svg {
    width: 16px;
    height: 16px;
}

/* Dölj vanlig cursor när custom cursor är aktiv */
.bb-swiper-cursor-wrapper.cursor-active {
    cursor: none;
}

/* Swiper-containern behåller grab/grabbing för bättre UX */
.bb-swiper-cursor-wrapper.cursor-active .swiper {
    cursor: grab;
    cursor: -webkit-grab;
}

.bb-swiper-cursor-wrapper.cursor-active .swiper:active {
    cursor: grabbing;
    cursor: -webkit-grabbing;
}

/* Övriga element döljer cursor */
.bb-swiper-cursor-wrapper.cursor-active .swiper-slide,
.bb-swiper-cursor-wrapper.cursor-active .bb-swiper-card {
    cursor: inherit;
}

/* ===== PAGINATION ===== */
.bb-swiper-cursor-wrapper .swiper-pagination {
    position: relative;
    margin-top: 24px;
}

.bb-swiper-cursor-wrapper .swiper-pagination-fraction {
    font-size: 0.875rem;
    font-weight: 500;
    width: auto;
}

.bb-swiper-cursor-wrapper .swiper-pagination-bullets {
    display: flex;
    gap: 8px;
    width: auto;
}

.bb-swiper-cursor-wrapper .swiper-pagination-bullet {
    width: 8px;
    height: 8px;
    opacity: 0.3;
    transition: opacity 0.3s ease;
}

.bb-swiper-cursor-wrapper .swiper-pagination-bullet-active {
    opacity: 1;
}

.bb-swiper-cursor-wrapper .swiper-pagination-progressbar {
    position: relative;
    height: 2px;
    background: rgba(0, 0, 0, 0.1);
}

/* Pagination alignment */
.bb-swiper-pagination--left {
    text-align: left;
}

.bb-swiper-pagination--center {
    text-align: center;
}

.bb-swiper-pagination--right {
    text-align: right;
}

/* ===== NAVIGATION ===== */

/* Controls wrapper - pagination + navigation på samma rad */
.bb-swiper-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 0;
    position: relative;
    z-index: 10;
}

.bb-swiper-controls__spacer {
    flex: 1;
}

.bb-swiper-nav-buttons {
    display: flex;
    gap: 8px;
}

/* Pagination utanför swiper (i controls) */
.bb-swiper-pagination-outside {
    position: relative !important;
    bottom: auto !important;
    left: auto !important;
    width: auto !important;
    margin: 0 !important;
}

/* För breakout - controls position justeras via JavaScript */
/* för att linjera med fl-row-content-wrap */

/* Navigation wrapper för top positioner (behåll för bakåtkompatibilitet) */
.bb-swiper-nav-wrapper {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    position: relative;
    z-index: 10;
    width: 100%;
}

/* För breakout - flytta höger-navigation tillbaka till containern */
.bb-swiper-cursor-wrapper.breakout-right .bb-swiper-nav--top-right .bb-swiper-nav-btn:last-child {
    margin-right: var(--_container-left, 0px);
}

.bb-swiper-nav--top-right {
    justify-content: flex-end;
    padding-right: 0;
}

.bb-swiper-nav--top-left {
    justify-content: flex-start;
}

/* Navigation knappar */
.bb-swiper-nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: calc(var(--nav-size, 20px) * 2);
    height: calc(var(--nav-size, 20px) * 2);
    padding: 0;
    border: none;
    background: var(--nav-bg, transparent);
    color: var(--nav-color, #1a1a1a);
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.2s ease;
    border-radius: 4px;
}

.bb-swiper-nav-btn:hover {
    opacity: 0.7;
}

.bb-swiper-nav-btn:active {
    transform: scale(0.95);
}

.bb-swiper-nav-btn svg {
    width: var(--nav-size, 20px);
    height: var(--nav-size, 20px);
    color: inherit;
}

.bb-swiper-nav-btn.swiper-button-disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Sides navigation (inuti swiper) */
.bb-swiper-cursor-wrapper .swiper-button-prev.bb-nav-sides,
.bb-swiper-cursor-wrapper .swiper-button-next.bb-nav-sides {
    width: calc(var(--nav-size, 20px) * 2.4);
    height: calc(var(--nav-size, 20px) * 2.4);
    background: var(--nav-bg, rgba(255, 255, 255, 0.9));
    color: var(--nav-color, #1a1a1a);
    border-radius: 50%;
    border: none;
    transition: all 0.3s ease;
}

.bb-swiper-cursor-wrapper .swiper-button-prev.bb-nav-sides::after,
.bb-swiper-cursor-wrapper .swiper-button-next.bb-nav-sides::after {
    display: none;
}

.bb-swiper-cursor-wrapper .swiper-button-prev.bb-nav-sides svg,
.bb-swiper-cursor-wrapper .swiper-button-next.bb-nav-sides svg {
    width: var(--nav-size, 20px);
    height: var(--nav-size, 20px);
    color: inherit;
}

.bb-swiper-cursor-wrapper .swiper-button-prev.bb-nav-sides:hover,
.bb-swiper-cursor-wrapper .swiper-button-next.bb-nav-sides:hover {
    transform: scale(1.1);
}

/* Fallback för gamla navigation utan dashicons */
.bb-swiper-cursor-wrapper .swiper-button-prev:not(.bb-nav-sides),
.bb-swiper-cursor-wrapper .swiper-button-next:not(.bb-nav-sides) {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.bb-swiper-cursor-wrapper .swiper-button-prev:not(.bb-nav-sides):hover,
.bb-swiper-cursor-wrapper .swiper-button-next:not(.bb-nav-sides):hover {
    background: #fff;
    transform: scale(1.1);
}

.bb-swiper-cursor-wrapper .swiper-button-prev:not(.bb-nav-sides)::after,
.bb-swiper-cursor-wrapper .swiper-button-next:not(.bb-nav-sides)::after {
    font-size: 18px;
    font-weight: bold;
}

/* ===== TILLGÄNGLIGHET / ACCESSIBILITY ===== */

/* Screen reader text - visuellt dolt men tillgängligt för skärmläsare */
.screen-reader-text {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Skip link - synlig vid fokus */
.bb-swiper-skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #000;
    color: #fff;
    padding: 8px 16px;
    z-index: 10000;
    text-decoration: none;
    font-weight: 500;
    border-radius: 0 0 4px 0;
    transition: top 0.2s ease;
}

.bb-swiper-skip-link:focus {
    position: absolute !important;
    width: auto !important;
    height: auto !important;
    padding: 8px 16px !important;
    margin: 0 !important;
    overflow: visible !important;
    clip: auto !important;
    white-space: normal !important;
    top: 0;
    outline: 2px solid #005fcc;
    outline-offset: 2px;
}

/* Live region för skärmläsare */
.bb-swiper-live-region {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Fokusindikatorer */
.bb-swiper-cursor-wrapper.a11y-focus-visible .swiper-slide:focus {
    outline: 3px solid var(--bb-swiper-focus-color, #005fcc);
    outline-offset: 4px;
}

.bb-swiper-cursor-wrapper.a11y-focus-visible .swiper-slide:focus-visible {
    outline: 3px solid var(--bb-swiper-focus-color, #005fcc);
    outline-offset: 4px;
}

.bb-swiper-cursor-wrapper.a11y-focus-visible:focus {
    outline: 2px solid var(--bb-swiper-focus-color, #005fcc);
    outline-offset: 2px;
}

.bb-swiper-cursor-wrapper.a11y-focus-visible:focus-visible {
    outline: 2px solid var(--bb-swiper-focus-color, #005fcc);
    outline-offset: 2px;
}

.bb-swiper-cursor-wrapper.a11y-focus-visible .bb-swiper-card:focus,
.bb-swiper-cursor-wrapper.a11y-focus-visible .bb-swiper-card:focus-visible {
    outline: 3px solid var(--bb-swiper-focus-color, #005fcc);
    outline-offset: 2px;
}

.bb-swiper-cursor-wrapper.a11y-focus-visible .swiper-button-prev:focus,
.bb-swiper-cursor-wrapper.a11y-focus-visible .swiper-button-next:focus,
.bb-swiper-cursor-wrapper.a11y-focus-visible .swiper-button-prev:focus-visible,
.bb-swiper-cursor-wrapper.a11y-focus-visible .swiper-button-next:focus-visible {
    outline: 3px solid var(--bb-swiper-focus-color, #005fcc);
    outline-offset: 2px;
}

.bb-swiper-cursor-wrapper.a11y-focus-visible .swiper-pagination-bullet:focus,
.bb-swiper-cursor-wrapper.a11y-focus-visible .swiper-pagination-bullet:focus-visible {
    outline: 2px solid var(--bb-swiper-focus-color, #005fcc);
    outline-offset: 2px;
}

/* Reduced motion - respektera användarens inställningar */
@media (prefers-reduced-motion: reduce) {
    .bb-swiper-cursor-wrapper.a11y-reduced-motion .swiper-wrapper {
        transition-duration: 0ms !important;
    }

    .bb-swiper-cursor-wrapper.a11y-reduced-motion .bb-swiper-card__image {
        transition: none !important;
    }

    .bb-swiper-cursor-wrapper.a11y-reduced-motion .bb-swiper-card:hover .bb-swiper-card__image {
        transform: none !important;
    }

    .bb-swiper-cursor-wrapper.a11y-reduced-motion .bb-swiper-custom-cursor {
        transition: none !important;
    }

    .bb-swiper-cursor-wrapper.a11y-reduced-motion .swiper-button-prev,
    .bb-swiper-cursor-wrapper.a11y-reduced-motion .swiper-button-next {
        transition: none !important;
    }

    .bb-swiper-cursor-wrapper.a11y-reduced-motion .swiper-pagination-bullet {
        transition: none !important;
    }
}

/* ===== GRID FILTER ===== */
.bb-grid-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}

.bb-grid-filter--left {
    justify-content: flex-start;
}

.bb-grid-filter--center {
    justify-content: center;
}

.bb-grid-filter--right {
    justify-content: flex-end;
}

/* Filter-knappar - Buttons stil */
.bb-grid-filter__btn {
    padding: 8px 16px;
    border: 1px solid currentColor;
    background: transparent;
    color: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0.6;
}

.bb-grid-filter__btn:hover {
    opacity: 1;
}

.bb-grid-filter__btn.is-active {
    background: currentColor;
    opacity: 1;
}

.bb-grid-filter__btn.is-active span,
.bb-grid-filter__btn.is-active {
    color: inherit;
}

/* Invertera textfärg för aktiv knapp */
.bb-grid-filter__btn.is-active {
    background: var(--bb-filter-active-bg, #1a1a1a);
    border-color: var(--bb-filter-active-bg, #1a1a1a);
    color: var(--bb-filter-active-color, #fff);
}

/* Pills stil */
.bb-grid-filter--pills .bb-grid-filter__btn {
    border-radius: 50px;
    padding: 8px 20px;
}

/* Minimal stil */
.bb-grid-filter--minimal .bb-grid-filter__btn {
    border: none;
    background: none;
    padding: 8px 12px;
    position: relative;
}

.bb-grid-filter--minimal .bb-grid-filter__btn::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 12px;
    right: 12px;
    height: 2px;
    background: currentColor;
    transform: scaleX(0);
    transition: transform 0.2s ease;
}

.bb-grid-filter--minimal .bb-grid-filter__btn.is-active::after,
.bb-grid-filter--minimal .bb-grid-filter__btn:hover::after {
    transform: scaleX(1);
}

.bb-grid-filter--minimal .bb-grid-filter__btn.is-active {
    background: transparent;
    color: inherit;
    opacity: 1;
}

/* ===== GRID LAYOUT ===== */
.bb-swiper-grid {
    display: grid;
    grid-template-columns: repeat(var(--bb-grid-columns, 3), 1fr);
    gap: var(--bb-grid-gap, 24px);
}

/* Grid item filter animation */
.bb-grid-item {
    transition: opacity 0.3s ease;
}

/* Under filtrering - hela gridet fadar */
.bb-swiper-grid.is-filtering .bb-grid-item {
    opacity: 0;
}

/* Dolda items */
.bb-grid-item.is-hidden {
    display: none;
}

/* Grid Reveal Animation */
.bb-swiper-cursor-wrapper.has-reveal .bb-grid-item {
    opacity: 0;
    transform: translateY(40px) scale(0.95);
}

.bb-swiper-cursor-wrapper.has-reveal .bb-grid-item.revealed {
    opacity: 1;
    transform: translateY(0) scale(1);
    transition:
        opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Staggered delay för grid items - längre för finare effekt */
.bb-swiper-cursor-wrapper.has-reveal .bb-grid-item:nth-child(1) { transition-delay: 0ms; }
.bb-swiper-cursor-wrapper.has-reveal .bb-grid-item:nth-child(2) { transition-delay: 80ms; }
.bb-swiper-cursor-wrapper.has-reveal .bb-grid-item:nth-child(3) { transition-delay: 160ms; }
.bb-swiper-cursor-wrapper.has-reveal .bb-grid-item:nth-child(4) { transition-delay: 240ms; }
.bb-swiper-cursor-wrapper.has-reveal .bb-grid-item:nth-child(5) { transition-delay: 320ms; }
.bb-swiper-cursor-wrapper.has-reveal .bb-grid-item:nth-child(6) { transition-delay: 400ms; }
.bb-swiper-cursor-wrapper.has-reveal .bb-grid-item:nth-child(7) { transition-delay: 480ms; }
.bb-swiper-cursor-wrapper.has-reveal .bb-grid-item:nth-child(8) { transition-delay: 560ms; }
.bb-swiper-cursor-wrapper.has-reveal .bb-grid-item:nth-child(9) { transition-delay: 640ms; }
.bb-swiper-cursor-wrapper.has-reveal .bb-grid-item:nth-child(10) { transition-delay: 720ms; }
.bb-swiper-cursor-wrapper.has-reveal .bb-grid-item:nth-child(11) { transition-delay: 800ms; }
.bb-swiper-cursor-wrapper.has-reveal .bb-grid-item:nth-child(12) { transition-delay: 880ms; }

/* Reduced motion - ingen animation för grid */
@media (prefers-reduced-motion: reduce) {
    .bb-swiper-cursor-wrapper.has-reveal .bb-grid-item {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .bb-grid-item {
        transition: none;
    }
}

.bb-swiper-grid .bb-grid-item {
    /* Säkerställ att korten fyller hela grid-cellen */
    min-width: 0;
}

.bb-swiper-grid .bb-swiper-card {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.bb-swiper-grid .bb-swiper-card__image-wrapper {
    aspect-ratio: var(--bb-swiper-image-ratio, 4/3);
    border-radius: var(--bb-swiper-image-radius, 8px);
}

.bb-swiper-grid .bb-swiper-card__content {
    flex: 1;
}

/* Grid-specifika responsiva breakpoints */
@media (max-width: 1024px) {
    .bb-swiper-grid {
        grid-template-columns: repeat(var(--bb-grid-columns-tablet, 2), 1fr);
        gap: var(--bb-grid-gap-tablet, 20px);
    }
}

@media (max-width: 768px) {
    .bb-swiper-grid {
        grid-template-columns: repeat(var(--bb-grid-columns-mobile, 1), 1fr);
        gap: var(--bb-grid-gap-mobile, 16px);
    }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .bb-swiper-custom-cursor {
        display: none !important;
    }

    .bb-swiper-cursor-wrapper.cursor-active,
    .bb-swiper-cursor-wrapper.cursor-active * {
        cursor: grab !important;
    }
}
