* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background-image: url('https://landing.sts-finanzen.de/ressources/stsfa/bilder/Schumacher-BG.jpg');
    background-size: cover;
    min-height: 100vh;
    min-height: 100vh;
    color: #fff;
}

.header {
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    will-change: transform;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    height: 50px;
    /* Lazy loading für Logo */
    loading: lazy;
}

.back-btn {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    will-change: transform;
}

.back-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(231, 76, 60, 0.4);
}

.back-btn::before {
    content: "←";
    font-size: 16px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

.page-title {
    text-align: center;
    margin-bottom: 40px;
}

.page-title h1 {
    font-size: 3em;
    font-weight: 300;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #ff6b6b, #feca57, #48dbfb, #ff9ff3);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-title p {
    font-size: 1.2em;
    opacity: 0.9;
}

.filter-tabs {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.filter-tab {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 25px;
    padding: 12px 24px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    will-change: transform;
}

.filter-tab:hover,
.filter-tab.active {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.media-item {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    will-change: transform;
    /* Performance: Prevent layout shifts */
    contain: layout style paint;
}

.media-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    background: rgba(255, 255, 255, 0.15);
}

.media-preview {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
    /* Performance: Create stacking context */
    transform: translateZ(0);
}

.media-preview img,
.media-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    /* Lazy loading und Performance */
    loading: lazy;
    decoding: async;
}

/* Placeholder für lazy loading */
.media-preview img:not([src]),
.media-preview img[src=""] {
    background: linear-gradient(45deg, #f0f0f0 25%, #e0e0e0 25%, #e0e0e0 50%, #f0f0f0 50%, #f0f0f0 75%, #e0e0e0 75%);
    background-size: 20px 20px;
    animation: loading-shimmer 1.5s infinite;
}

@keyframes loading-shimmer {
    0% {
        background-position: 0 0;
    }

    100% {
        background-position: 40px 0;
    }
}

.media-item:hover .media-preview img,
.media-item:hover .media-preview video {
    transform: scale(1.05);
}

.media-type-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 600;
    backdrop-filter: blur(5px);
}

.video-play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
    transition: all 0.3s ease;
    will-change: transform;
}

.media-item:hover .video-play-overlay {
    background: rgba(231, 76, 60, 0.8);
    transform: translate(-50%, -50%) scale(1.1);
}

.media-info {
    padding: 15px;
}

.media-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 5px;
    opacity: 0.9;
}

.media-date {
    font-size: 12px;
    opacity: 0.7;
}

/* Virtual Scrolling Container */
.virtual-scroll-container {
    height: 600px;
    overflow-y: auto;
    position: relative;
}

.virtual-scroll-content {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
}

/* Modal Styles mit Performance-Optimierungen */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(5px);
    /* Performance */
    will-change: opacity;
    contain: layout style paint;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        backdrop-filter: blur(0px);
    }

    to {
        opacity: 1;
        backdrop-filter: blur(5px);
    }
}

.modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    overflow: hidden;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    /* Performance */
    contain: layout style paint;
    transform: translateZ(0);
}

.modal-media {
    width: 100%;
    height: auto;
    max-height: 80vh;
    object-fit: contain;
    /* Lazy loading für Modal-Medien */
    loading: lazy;
    decoding: async;
}

.modal-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.8) 0%, transparent 100%);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
}

.modal-title {
    color: white;
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    will-change: transform;
}

.modal-close:hover {
    background: rgba(231, 76, 60, 0.8);
    transform: scale(1.1);
}

.modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.6);
    border: none;
    color: white;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    cursor: pointer;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
    will-change: transform;
}

.modal-nav:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: translateY(-50%) scale(1.1);
}

.modal-nav.prev {
    left: 20px;
}

.modal-nav.next {
    right: 20px;
}

.modal-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.8) 0%, transparent 100%);
    padding: 20px;
    color: white;
}

.loading-spinner {
    display: none;
    text-align: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top: 4px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Intersection Observer Fade-in Animation */
.media-item {
    opacity: 0;
    transform: translateY(50px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.media-item.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Performance: Reduce paint operations */
.media-item:hover {
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Responsive optimiert */
@media (max-width: 768px) {
    .nav-container {
        padding: 0 15px;
    }

    .logo {
        height: 30px;
    }

    .back-btn {
        padding: 10px 18px;
        font-size: 12px;
    }

    .container {
        padding: 20px 15px;
    }

    .page-title h1 {
        font-size: 2.2em;
    }

    .page-title p {
        font-size: 1em;
    }

    .media-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 15px;
    }

    .media-preview {
        height: 150px;
    }

    .filter-tabs {
        gap: 8px;
    }

    .filter-tab {
        padding: 10px 20px;
        font-size: 12px;
    }

    .modal-content {
        max-width: 95vw;
        max-height: 95vh;
    }

    .modal-nav {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    .modal-nav.prev {
        left: 10px;
    }

    .modal-nav.next {
        right: 10px;
    }

    .modal-header {
        padding: 15px;
    }

    .modal-title {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .media-grid {
        grid-template-columns: 1fr;
    }

    .page-title h1 {
        font-size: 1.8em;
    }
}

/* Progressive loading styles */
.loading-placeholder {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

