/* =========================================
   OPTIMIERTES CSS FÜR RASPBERRY PI 3
   - GPU-Beschleunigung aktiviert
   - Reduzierte Animationen
   - Bessere Rendering-Performance
   ========================================= */

/* =========================================
   1. GRUNDEINSTELLUNGEN
   ========================================= */
* {
    box-sizing: border-box;
}

body, html {
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
    overflow: hidden;
    /* System-Fonts statt Google Fonts für schnelleres Laden */
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 
                 'Roboto', 'Helvetica', 'Arial', sans-serif;
    background-color: #000;
    
    /* Performance-Optimierung */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* =========================================
   2. HAUPT-LAYOUT
   ========================================= */
.grid-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    /* GPU-Beschleunigung */
    transform: translateZ(0);
    will-change: auto;
}

/* OBERER BEREICH (BILDER & ESSEN) */
.content-area {
    display: flex;
    height: 90vh;
    width: 100%;
    background-color: #000;
}

/* =========================================
   3. LINKE SEITE (SLIDESHOW)
   ========================================= */
.left-panel {
    width: 65%;
    background-color: #000;
    position: relative;
    border-right: 5px solid #ffba00;
    overflow: hidden;
    /* Performance */
    transform: translateZ(0);
}

#slideshow {
    width: 100%;
    height: 100%;
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
    
    /* OPTIMIERTE ANIMATION für schwache Hardware */
    opacity: 1;
    transition: opacity 0.8s ease-in-out;
    
    /* GPU-Beschleunigung aktivieren */
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
    
    /* Smooth Rendering */
    -webkit-backface-visibility: hidden;
    will-change: opacity;
}

/* Fade-Out Effekt */
#slideshow.fade-out {
    opacity: 0;
}

/* Ladeindikator */
.loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #ffba00;
    font-size: 2rem;
    font-weight: bold;
    text-align: center;
    z-index: 5;
    text-shadow: 2px 2px 8px rgba(0,0,0,0.8);
}

/* =========================================
   4. RECHTE SEITE (SPEISEPLAN)
   ========================================= */
.right-panel {
    width: 35%;
    background-color: white;
    position: relative;
    overflow: hidden;
    /* Performance */
    transform: translateZ(0);
}

.iframe-container {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0; 
    left: 0;
}

.iframe-container iframe {
    border: none;
    position: absolute;
    top: 0;
    left: 0;
    
    /* ZOOM-Anpassung */
    transform: scale(0.85);
    transform-origin: top left;
    
    width: 118%;
    height: 118%;
    
    /* Performance-Hints */
    will-change: auto;
}

/* =========================================
   5. FOOTER (TICKER)
   ========================================= */
.footer {
    height: 10vh;
    background: linear-gradient(135deg, #ff8c00 0%, #ffba00 100%);
    display: flex;
    align-items: center;
    overflow: hidden;
    position: relative;
    z-index: 10;
    box-shadow: 0 -5px 15px rgba(0,0,0,0.3);
    border-top: 2px solid #fff;
    
    /* Performance */
    transform: translateZ(0);
}

.ticker-wrap {
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
}

.ticker {
    display: inline-block;
    padding-left: 100%;
    
    /* OPTIMIERTE Animation - längere Dauer = weniger CPU-Last */
    animation: ticker 30s linear infinite;
    
    /* GPU-Beschleunigung */
    will-change: transform;
    transform: translateZ(0);
    
    /* Text-Styling */
    color: #ffffff;
    font-size: 3.5rem;
    font-weight: 800;
    text-transform: uppercase;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.4);
    line-height: 10vh;
}

.ticker::before {
    content: "📢 ";
    color: #fffbe6;
    margin-right: 30px;
    font-weight: 400;
}

/* OPTIMIERTE Animation mit GPU-Beschleunigung */
@keyframes ticker {
    0%   { 
        transform: translate3d(0, 0, 0); 
    }
    100% { 
        transform: translate3d(-100%, 0, 0); 
    }
}

/* =========================================
   6. RESPONSIVE ANPASSUNGEN
   ========================================= */
@media (max-height: 600px) {
    .ticker { 
        font-size: 2rem; 
    }
}

/* Bei sehr kleinen Screens */
@media (max-width: 800px) {
    .left-panel {
        width: 100%;
        border-right: none;
    }
    
    .right-panel {
        display: none; /* Speiseplan ausblenden */
    }
}

/* =========================================
   7. PERFORMANCE-OPTIMIERUNGEN
   ========================================= */

/* Reduziere Repaints */
* {
    -webkit-tap-highlight-color: transparent;
}

/* Smoother Scrolling (falls nötig) */
html {
    scroll-behavior: smooth;
}

/* Verhindere Text-Selection bei Interaktionen */
.ticker, #slideshow {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
}

/* =========================================
   8. PRINT-STYLES (optional)
   ========================================= */
@media print {
    .ticker, .footer {
        display: none;
    }
    
    .content-area {
        height: 100vh;
    }
}
