/**
 * Swiper Slider Custom Styles
 * Version: 4.0.5 - Performance & Scroll Fixes
 */

/* ========== SCROLL FIX (GitHub Issues #3529, #7231) ========== */
/* Verhindert dass Swiper mit Seiten-Scroll interferiert */
.swiper-slider-wrapper {
    touch-action: pan-y !important;
}

.swiper-slider-wrapper .swiper-wrapper {
    touch-action: pan-y !important;
}

.swiper-slider-wrapper.swiper-vertical {
    touch-action: pan-x !important;
}

.swiper-slider-wrapper.swiper-vertical .swiper-wrapper {
    touch-action: pan-x !important;
}

/* ========== PERFORMANCE FIXES ========== */
/* FIX: will-change entfernen (verursacht Lag) */
.swiper-slider-wrapper *,
.swiper-slide *,
.swiper-wrapper * {
    will-change: auto !important;
}

/* FIX: Keine Filter auf Bildern (verursacht Lag) */
.swiper-slide img {
    filter: none !important;
}

/* FIX: Transform-Optimierung für Safari */
.swiper-slide {
    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

/* FIX: Reduziert Flickering */
.swiper-wrapper {
    -webkit-transform-style: preserve-3d;
    transform-style: preserve-3d;
}

/* ========== SLIDER WRAPPER ========== */
.swiper-slider-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
}

/* ========== SLIDES ========== */
.swiper-slide {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
}

.swiper-slide-inner {
    position: relative;
    width: 100%;
    height: 100%;
}

.swiper-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ========== PLACEHOLDER ========== */
.swiper-slide-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: rgba(255, 255, 255, 0.5);
}

/* ========== LAZY LOADING ========== */
.swiper-lazy-preloader {
    width: 42px;
    height: 42px;
    position: absolute;
    left: 50%;
    top: 50%;
    margin-left: -21px;
    margin-top: -21px;
    z-index: 10;
    transform-origin: 50%;
    animation: swiper-preloader-spin 1s infinite linear;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    border-top-color: #fff;
}

@keyframes swiper-preloader-spin {
    100% {
        transform: rotate(360deg);
    }
}

/* ========== CAPTIONS ========== */
.swiper-caption {
    position: absolute;
    z-index: 10;
    padding: 1.5rem;
    pointer-events: none;
}

.swiper-caption * {
    pointer-events: auto;
}

/* Caption Positions */
.swiper-caption-top-left {
    top: 0;
    left: 0;
}

.swiper-caption-top-center {
    top: 0;
    left: 50%;
    transform: translateX(-50%);
}

.swiper-caption-top-right {
    top: 0;
    right: 0;
}

.swiper-caption-center-left {
    top: 50%;
    left: 0;
    transform: translateY(-50%);
}

.swiper-caption-center-center {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.swiper-caption-center-right {
    top: 50%;
    right: 0;
    transform: translateY(-50%);
}

.swiper-caption-bottom-left {
    bottom: 0;
    left: 0;
}

.swiper-caption-bottom-center {
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
}

.swiper-caption-bottom-right {
    bottom: 0;
    right: 0;
}

/* Caption Content */
.swiper-caption-content {
    /* Kein Default - kommt von Custom CSS */
    padding: 2rem;
    border-radius: 8px;
    /* backdrop-filter kommt von Custom CSS wenn aktiviert */
    max-width: 500px;
    width: auto; /* Wichtig für flexible Breite */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    opacity: 0; /* Initial komplett versteckt - verhindert Blinken */
    transition: none; /* Keine Transition initial */
}

/* Bei center-center: Größere max-width damit Caption nicht zu schmal wird */
.swiper-caption-center-center .swiper-caption-content {
    max-width: 90%;
    min-width: 300px;
}

/* Caption wird durch JS mit .caption-visible sichtbar gemacht */
.swiper-caption-content.caption-visible {
    opacity: 1;
}

.swiper-caption-content.animated {
    opacity: 1;
}

.swiper-caption-title {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 1rem 0;
    /* Color kommt von Custom CSS */
}

.swiper-caption-text {
    font-size: 1rem;
    line-height: 1.6;
    margin: 0 0 1.5rem 0;
    /* Color kommt von Custom CSS */
}

.swiper-caption-button {
    display: inline-block;
    padding: 0.75rem 2rem;
    /* Background & Color kommen von Custom CSS */
    text-decoration: none;
    border-radius: 4px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.swiper-caption-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    opacity: 0.9;
}

/* ========== NAVIGATION ========== */
.swiper-button-prev,
.swiper-button-next {
    color: #fff;
    background: rgba(0, 0, 0, 0.5);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.swiper-button-prev:after,
.swiper-button-next:after {
    font-size: 20px;
    font-weight: bold;
}

.swiper-button-prev:hover,
.swiper-button-next:hover {
    background: rgba(0, 0, 0, 0.7);
    transform: scale(1.1);
}

/* ========== PAGINATION ========== */
.swiper-pagination {
    bottom: 20px !important;
}

.swiper-pagination-bullet {
    width: 12px;
    height: 12px;
    background: rgba(255, 255, 255, 0.5);
    opacity: 1;
    transition: all 0.3s ease;
}

.swiper-pagination-bullet-active {
    background: #fff;
    width: 32px;
    border-radius: 6px;
}

/* Fraction Pagination */
.swiper-pagination-fraction {
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    width: auto;
    left: 50%;
    transform: translateX(-50%);
    font-weight: 600;
}

/* Progress Bar */
.swiper-pagination-progressbar {
    background: rgba(255, 255, 255, 0.25);
    height: 4px;
}

.swiper-pagination-progressbar-fill {
    background: #fff;
}

/* ========== SCROLLBAR ========== */
.swiper-scrollbar {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    height: 8px;
}

.swiper-scrollbar-drag {
    background: rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    cursor: grab;
}

.swiper-scrollbar-drag:active {
    cursor: grabbing;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .swiper-caption-content {
        padding: 1.5rem;
        max-width: 90%;
    }
    
    .swiper-caption-title {
        font-size: 1.5rem;
    }
    
    .swiper-caption-text {
        font-size: 0.9rem;
    }
    
    .swiper-caption-button {
        padding: 0.6rem 1.5rem;
        font-size: 0.9rem;
    }
    
    .swiper-button-prev,
    .swiper-button-next {
        width: 36px;
        height: 36px;
    }
    
    .swiper-button-prev:after,
    .swiper-button-next:after {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .swiper-caption {
        padding: 1rem;
    }
    
    .swiper-caption-content {
        padding: 1rem;
    }
    
    .swiper-caption-title {
        font-size: 1.25rem;
        margin-bottom: 0.75rem;
    }
    
    .swiper-caption-text {
        font-size: 0.85rem;
        margin-bottom: 1rem;
    }
}

/* ========== EFFECTS ========== */

/* Fade Effect */
.swiper-fade .swiper-slide {
    pointer-events: none;
}

.swiper-fade .swiper-slide-active {
    pointer-events: auto;
}

/* Cube Effect */
.swiper-cube {
    overflow: visible;
}

.swiper-cube .swiper-slide {
    visibility: hidden;
    transform-origin: 0 0;
    backface-visibility: hidden;
}

.swiper-cube .swiper-slide-active,
.swiper-cube .swiper-slide-next,
.swiper-cube .swiper-slide-prev {
    visibility: visible;
}

/* Cards Effect */
.swiper-cards {
    overflow: visible;
}

.swiper-cards .swiper-slide {
    border-radius: 12px;
    overflow: hidden;
}

/* ========== ACCESSIBILITY ========== */
.swiper-button-prev:focus,
.swiper-button-next:focus,
.swiper-pagination-bullet:focus {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .swiper-slide,
    .swiper-caption-content,
    .swiper-button-prev,
    .swiper-button-next {
        transition: none !important;
        animation: none !important;
    }
}
