/* Beitrags Slider Styles */
.beitrags-slider-container {
    position: relative;
    max-width: 100%;
    margin: 20px 0;
    overflow: hidden;
    /* Wichtig: Verhindert horizontales Scrollen */
    width: 100%;
}

.beitrags-slider {
    display: flex;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: transform 0.5s ease;
    width: 100%;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    /* Kritisch für mobile Geräte: Verhindert Sub-Pixel-Rendering-Probleme */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

.beitrags-slider.dragging {
    cursor: grabbing;
    transition: none;
}

.slide {
    /* Exakte 100% Breite ohne Rundungsfehler */
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    flex-shrink: 0;
    flex-grow: 0;
    position: relative;
    /* Verhindert Sub-Pixel-Gaps zwischen Slides */
    box-sizing: border-box;
}

.slide-content {
    position: relative;
}

.slide-image {
    position: relative;
    overflow: hidden;
    height: 400px;
    background: #f5f5f5;
}

.slide-date-top {
    position: absolute;
    top: 15px;
    left: 15px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.9em;
    font-weight: 500;
    z-index: 10;
}

.slide-image img {
    width: 100%;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center center !important;
    transition: transform 0.3s ease;
    pointer-events: none;
}

.slide-image:hover img {
    transform: scale(1.05);
}

.slide-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0.3) 50%, transparent 100%);
    padding: 60px 30px 30px;
    color: white;
}

.slide-title {
    margin: 0;
    font-size: 1.8em;
    font-weight: 700;
    line-height: 1.3;
}

.slide-title a {
    color: white;
    text-decoration: none;
    transition: color 0.3s ease;
}

.slide-title a:hover {
    color: #ffd700;
}

/* Navigation */
.slider-nav {
    position: absolute;
    top: 50%;
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    pointer-events: none;
    transform: translateY(-50%);
}

.slider-nav button {
    background: rgba(255,255,255,0.9);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    pointer-events: all;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.slider-nav button:hover {
    background: white;
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.slider-nav button:active {
    transform: scale(0.95);
}

/* Dots */
.slider-dots {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(0,0,0,0.2);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.dot:hover {
    background: rgba(0,0,0,0.4);
}

.dot.active {
    background: #333;
    transform: scale(1.3);
    border-color: rgba(0,0,0,0.1);
}

/* Ajax Loading Styles */
.slider-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 100;
    background: rgba(255,255,255,0.9);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.slider-loading.hidden {
    display: none;
}

.loading-spinner {
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #333;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Load More Button */
.load-more-container {
    text-align: center;
    margin-top: 20px;
}

.load-more-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.load-more-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.load-more-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.load-more-btn.loading {
    position: relative;
    color: transparent;
}

.load-more-btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Performance Optimierungen */
.slide {
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.beitrags-slider {
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Preloading States */
.slide.preloading {
    opacity: 0.7;
}

.slide.loaded {
    opacity: 1;
    transition: opacity 0.3s ease;
}

/* Error States */
.slider-error {
    text-align: center;
    padding: 20px;
    color: #666;
    font-style: italic;
}

.slider-error.hidden {
    display: none;
}

/* Dark Theme Support */
@media (prefers-color-scheme: dark) {
    .slide-image {
        background: #1a1a1a;
    }
    
    .slider-nav button {
        background: rgba(30,30,30,0.9);
        color: white;
    }
    
    .slider-nav button:hover {
        background: rgba(50,50,50,0.9);
    }
    
    .dot {
        background: rgba(255,255,255,0.3);
    }
    
    .dot.active {
        background: white;
        border-color: rgba(255,255,255,0.2);
    }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .slide-image {
        height: 350px;
    }
    
    .slide-info {
        padding: 50px 25px 25px;
    }
    
    .slide-title {
        font-size: 1.6em;
    }
    
    .slide-date-top {
        top: 12px;
        left: 12px;
        padding: 7px 11px;
        font-size: 0.9em;
    }
}

@media (max-width: 768px) {
    .slide-image {
        height: 300px;
    }
    
    .slide-info {
        padding: 40px 20px 20px;
    }
    
    .slide-title {
        font-size: 1.4em;
    }
    
    .slider-nav {
        padding: 0 10px;
    }
    
    .slider-nav button {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    
    .slide-date-top {
        top: 10px;
        left: 10px;
        padding: 6px 10px;
        font-size: 0.85em;
    }
}

@media (max-width: 480px) {
    .slide-image {
        height: 250px;
    }
    
    .slide-title {
        font-size: 1.2em;
    }
    
    .slide-info {
        padding: 35px 15px 15px;
    }
    
    .slide-date-top {
        top: 8px;
        left: 8px;
        padding: 5px 8px;
        font-size: 0.8em;
    }
    
    .slider-dots {
        gap: 8px;
    }
    
    .dot {
        width: 8px;
        height: 8px;
    }
    
    /* Mobile-spezifische Fixes für perfekte Slide-Positionierung */
    .beitrags-slider-container {
        /* Verhindert horizontales Scrollen auf mobilen Geräten */
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
    }
    
    .beitrags-slider {
        /* Exakte Positionierung für mobile Geräte */
        transform: translate3d(0, 0, 0);
        -webkit-transform: translate3d(0, 0, 0);
        /* Verhindert Webkit-spezifische Rendering-Probleme */
        -webkit-backface-visibility: hidden;
        -webkit-perspective: 1000;
    }
    
    .slide {
        /* Verhindert Sub-Pixel-Gaps auf mobilen Geräten */
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
        /* Exakte Breite ohne Rundungsfehler */
        width: 100vw;
        max-width: 100%;
        min-width: 100%;
    }
    
    .slide-content {
        /* Verhindert Overflow-Probleme */
        width: 100%;
        overflow: hidden;
    }
}

/* Zusätzliche mobile Fixes für alle Bildschirmgrößen unter 768px */
@media (max-width: 768px) {
    .beitrags-slider-container {
        /* Verhindert horizontales Scrollen */
        overflow-x: hidden;
        position: relative;
        /* Wichtig: Verhindert Touch-Scrolling-Konflikte */
        touch-action: pan-y pinch-zoom;
    }
    
    .beitrags-slider {
        /* Hardware-Beschleunigung für bessere Performance */
        transform: translate3d(0, 0, 0);
        -webkit-transform: translate3d(0, 0, 0);
        /* Verhindert Flackern bei Animationen */
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
        /* Touch-Optimierung */
        touch-action: pan-y;
        -webkit-touch-callout: none;
        -webkit-tap-highlight-color: transparent;
    }
    
    .slide {
        /* Exakte Positionierung ohne Sub-Pixel-Probleme */
        position: relative;
        float: none; /* Wichtig: float kann Probleme verursachen */
        clear: none;
        /* Verhindert Gaps zwischen Slides */
        margin: 0;
        padding: 0;
        border: none;
        outline: none;
        /* Verhindert Text-Selection während Swipe */
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }
    
    /* Verhindert Zoom bei Doppeltipp */
    .slide-image img {
        touch-action: manipulation;
        -webkit-touch-callout: none;
    }
}

/* Fallback für sehr alte Browser */
.no-js .beitrags-slider {
    overflow-x: auto;
    scroll-snap-type: x mandatory;
}

.no-js .slide {
    scroll-snap-align: start;
}

/* Print-Styles */
@media print {
    .beitrags-slider-container {
        overflow: visible;
    }
    
    .beitrags-slider {
        display: block;
        transform: none !important;
    }
    
    .slide {
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
        page-break-inside: avoid;
        margin-bottom: 20px;
    }
    
    .slider-nav,
    .slider-dots,
    .load-more-container {
        display: none !important;
    }
}
