/* Global styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

html {
    overflow-y: scroll; /* Verhindert Scrollbar-Springen */
    height: 100%; /* Wichtig für stabile Layout-Berechnung */
    scroll-behavior: smooth; /* Sanfte Scroll-Animation */
}

body {
    background-color: #f0f2f5;
    padding: 20px;
    font-size: 16px;
    line-height: 1.6;
    min-height: 100vh; /* Verhindert Springen bei kurzen Inhalten */
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
    width: 100%;
    min-height: 600px; /* Mindesthöhe für Desktop - verhindert Springen */
}

h1 {
    text-align: center;
    color: #1d3557;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e63946;
    font-size: 1.8rem;
    min-height: 50px; /* Größere Höhe für Desktop */
}

/* Club buttons */
.club-logos {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 30px;
    min-height: 120px; /* Größere Höhe für Desktop */
    contain: layout; /* Verhindert Layout-Shifts */
}

.club-button {
    padding: 8px;
    margin: 3px;
    background-color: #1d3557;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
    font-size: 0.8rem;
    max-width: 120px;
    text-align: center;
    flex: 1 1 auto;
    min-width: 80px;
    contain: layout; /* Verhindert Button-bedingte Layout-Shifts */
}

.club-button:hover {
    background-color: #457b9d;
}

.club-button.active {
    background-color: #e63946;
}

/* Fixtures section */
.fixtures {
    margin-top: 20px;
    min-height: 500px; /* Deutlich größere Höhe für Desktop */
    position: relative; /* Wichtig für fixed-size Positionierung */
    contain: layout; /* Verhindert Layout-Shifts */
}

.match-day {
    margin-bottom: 30px;
    contain: layout; /* Verhindert Layout-Shifts */
}

.match-day-title {
    background-color: #1d3557;
    color: white;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 10px;
    font-size: 1rem;
    height: 40px; /* Feste Höhe für Spieltag-Header */
    contain: layout; /* Verhindert Layout-Shifts */
}

.match {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #ddd;
    background-color: #f8f9fa;
    border-radius: 5px;
    margin-bottom: 10px;
    min-height: 125px; /* Feste Mindesthöhe für Matches */
    contain: layout; /* Verhindert Match-bedingte Layout-Shifts */
}

/* LIVE-Spiel Styling */
.match-live {
    border-left: 4px solid #e63946;
    background-color: #fff9f9;
}

.live-indicator {
    background-color: #e63946;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
    margin-left: 5px;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

.match-time {
    flex: 1 1 100%;
    font-weight: bold;
    color: #1d3557;
    margin-bottom: 10px;
    min-height: 40px; /* Feste Mindesthöhe */
    display: flex;
    align-items: center;
}

.match-teams {
    flex: 1 1 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    min-height: 30px; /* Feste Mindesthöhe */
}

.team {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 40%;
    min-height: 25px; /* Feste Mindesthöhe */
}

.home-team {
    text-align: right;
    justify-content: flex-end;
}

.away-team {
    text-align: left;
    justify-content: flex-start;
}

.vs {
    margin: 0 15px;
    font-weight: bold;
    color: #1d3557;
}

.match-tv {
    flex: 1 1 100%;
    text-align: center;
    font-weight: bold;
    color: #1d3557;
    background-color: #f0f2f5;
    padding: 5px 10px;
    border-radius: 5px;
    min-height: 30px; /* Feste Mindesthöhe */
}

/* Status styles */
.loading {
    text-align: center;
    padding: 20px;
    font-size: 18px;
    color: #1d3557;
    position: absolute; /* Verhindert Layout-Shifts beim Laden */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(255, 255, 255, 0.9);
    padding: 20px 30px;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    z-index: 1;
}

.error {
    color: #e63946;
    text-align: center;
    padding: 20px;
}

/* Control elements */
.filter-controls {
    margin-bottom: 20px;
    text-align: center;
    min-height: 50px; /* Größere Höhe für Desktop */
    contain: layout; /* Verhindert Layout-Shifts */
}

button {
    background-color: #1d3557;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    margin: 0 5px;
    transition: background-color 0.3s;
    contain: layout paint; /* Verhindert Button-bedingte Layout-Shifts */
}

button:hover {
    background-color: #457b9d;
}

button.active {
    background-color: #e63946;
}

button:focus, a:focus {
    outline: 3px solid #457b9d;
    outline-offset: 2px;
}

.update-time {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: #6c757d;
    min-height: 20px; /* Feste Mindesthöhe */
}

/* Footer */
.footer {
    margin-top: 30px;
    border-top: 1px solid #e9ecef;
    padding-top: 20px;
    font-size: 14px;
    color: #6c757d;
    min-height: 100px; /* Größere Höhe für Desktop */
    contain: layout; /* Verhindert Footer-bedingte Layout-Shifts */
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 10px;
    flex-wrap: wrap;
    min-height: 30px; /* Feste Mindesthöhe */
}

.footer-links a {
    color: #1d3557;
    text-decoration: none;
    padding: 5px;
}

.footer-links a:hover {
    text-decoration: underline;
}

.data-source-info {
    text-align: center;
    margin-top: 10px;
    font-size: 14px;
    color: #6c757d;
    border-top: 1px solid #e9ecef;
    padding-top: 10px;
    min-height: 30px; /* Feste Mindesthöhe */
}

/* Modal styles */
.legal-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    overflow: auto;
    contain: layout style; /* Wichtig für Desktop-Performance */
    transform: translateZ(0); /* Aktiviert Hardware-Beschleunigung */
    will-change: opacity; /* Optimiert für Animation */
}

.legal-modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 20px;
    width: 80%;
    max-width: 800px;
    border-radius: 10px;
    max-height: 80vh;
    overflow-y: auto;
    transform: translateZ(0); /* Aktiviert Hardware-Beschleunigung */
    will-change: transform; /* Optimiert für Animation */
}

.legal-modal h2 {
    color: #1d3557;
    margin-bottom: 20px;
}

.legal-modal h3 {
    margin-top: 20px;
    color: #1d3557;
}

.legal-modal p {
    margin-bottom: 15px;
    line-height: 1.5;
}

.close-button {
    color: #6c757d;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    width: 30px;
    height: 30px;
    text-align: center;
    line-height: 30px;
}

.close-button:hover {
    color: #e63946;
}

/* Cookie banner */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #1d3557;
    color: white;
    padding: 15px;
    text-align: center;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    transform: translateZ(0); /* Aktiviert Hardware-Beschleunigung */
    will-change: transform; /* Optimiert für Animation */
    contain: layout paint style; /* Wichtig für Desktop-Performance */
}

.cookie-banner button {
    background-color: white;
    color: #1d3557;
    border: none;
    padding: 8px 15px;
    margin: 5px;
    border-radius: 5px;
    cursor: pointer;
}

.cookie-banner button:hover {
    background-color: #f0f2f5;
}

/* Scroll-to-Top Button */
.scroll-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background-color: #1d3557;
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 999;
}

.scroll-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.scroll-to-top:hover {
    background-color: #e63946;
}

.scroll-to-top i {
    font-size: 24px;
    line-height: 40px;
}

/* Pfeil-Icon mit CSS erstellen, falls keine Fontawesome verfügbar */
.arrow-up {
    width: 0; 
    height: 0; 
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 12px solid white;
    margin-top: -3px;
}

/* Responsive styles - Weniger aggressiv, um CLS zu reduzieren */
@media (min-width: 768px) {
    .match {
        flex-wrap: nowrap;
        height: 125px; /* Feste Höhe für Desktop */
    }
    
    .match-time {
        flex: 0 0 120px;
        margin-bottom: 0;
    }
    
    .match-teams {
        flex: 1;
        margin-bottom: 0;
    }
    
    .match-tv {
        flex: 0 0 120px;
    }
    
    .cookie-banner {
        flex-direction: row;
    }
    
    .legal-modal-content {
        padding: 30px;
        margin: 10% auto;
    }
    
    .container {
        min-height: 800px; /* Größere Mindesthöhe für breitere Screens */
    }
    
    .fixtures {
        min-height: 600px; /* Größere Mindesthöhe für breitere Screens */
    }
}

@media (max-width: 767px) {
    .club-button {
        min-width: 45%;
        font-size: 0.7rem;
        padding: 7px 4px;
    }
    
    body {
        padding: 10px;
    }
    
    .container {
        padding: 15px;
        border-radius: 5px;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    /* Scroll-to-Top Button für Mobile anpassen */
    .scroll-to-top {
        bottom: 70px; /* Höher platzieren, wenn Cookie-Banner sichtbar ist */
    }
    
    .cookie-banner-accepted .scroll-to-top {
        bottom: 20px; /* Zurück zur normalen Position, wenn Cookie-Banner akzeptiert wurde */
    }
}

@media (max-width: 480px) {
    .club-button {
        min-width: 48%;
        font-size: 0.7rem;
        padding: 6px 3px;
    }
    
    body {
        padding: 5px;
    }
    
    .container {
        padding: 10px;
    }
    
    h1 {
        font-size: 1.3rem;
        margin-bottom: 15px;
    }
    
    .footer-links {
        gap: 10px;
    }
    
    .footer-links a {
        font-size: 0.8rem;
    }
    
    .footer .copyright {
        font-size: 0.8rem;
        text-align: center;
    }
    
    .match-time, .match-teams, .match-tv {
        font-size: 0.9rem;
    }
    
    .match {
        padding: 10px;
    }
    
    .filter-controls button {
        padding: 8px 12px;
        font-size: 0.9rem;
    }
    
    .legal-modal-content {
        width: 95%;
        padding: 15px;
        margin: 5% auto;
    }
    
    .legal-modal h2 {
        font-size: 1.3rem;
    }
    
    .legal-modal h3 {
        font-size: 1.1rem;
    }
    
    .legal-modal p, .legal-modal ul li {
        font-size: 0.9rem;
    }
    
    .cookie-banner {
        padding: 10px;
    }
    
    .cookie-banner p {
        font-size: 0.9rem;
    }
    
    .cookie-banner button {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
    
    .live-indicator {
        font-size: 0.7rem;
        padding: 1px 4px;
    }
}