Jelajahi Sumber

Button für Design (Hell/Dunkel) auf allen Seiten eingefügt

erdo 2 hari lalu
induk
melakukan
c0ff1d2c37
5 mengubah file dengan 302 tambahan dan 134 penghapusan
  1. 71 60
      admin.php
  2. 50 12
      besitz.php
  3. 43 20
      gesamtliste.php
  4. 48 9
      gespielte_spiele.php
  5. 90 33
      index.php

+ 71 - 60
admin.php

@@ -24,17 +24,21 @@ if ($show_login):
     <meta charset="UTF-8">
     <title>Admin Login</title>
     <style>
-        body { font-family: 'Segoe UI', sans-serif; background: #f4f7f6; color: #333; display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; }
-        .login-box { background: white; padding: 40px; border-radius: 12px; border: 1px solid #ddd; box-shadow: 0 4px 15px rgba(0,0,0,0.1); text-align: center; width: 300px; }
-        input { width: 100%; padding: 12px; margin: 15px 0; border-radius: 5px; border: 1px solid #ccc; background: #fff; color: #333; box-sizing: border-box; }
+        :root { --bg: #f4f7f6; --card: #ffffff; --text: #333; --border: #ddd; }
+        .dark-theme { --bg: #121212; --card: #1e1e1e; --text: #e0e0e0; --border: #333; }
+        body { font-family: 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; }
+        .login-box { background: var(--card); padding: 40px; border-radius: 12px; border: 1px solid var(--border); box-shadow: 0 4px 15px rgba(0,0,0,0.1); text-align: center; width: 300px; }
+        input { width: 100%; padding: 12px; margin: 15px 0; border-radius: 5px; border: 1px solid var(--border); background: var(--card); color: var(--text); box-sizing: border-box; }
         button { background: #e67e22; color: white; border: none; padding: 12px; border-radius: 5px; cursor: pointer; width: 100%; font-weight: bold; }
-        .error { color: #e74c3c; font-size: 0.9em; }
     </style>
+    <script>
+        if (localStorage.getItem('theme') === 'dark') document.documentElement.classList.add('dark-theme');
+    </script>
 </head>
 <body>
     <div class="login-box">
         <h2>🔐 Admin Login</h2>
-        <?php if(isset($login_error)) echo "<div class='error'>$login_error</div>"; ?>
+        <?php if(isset($login_error)) echo "<div style='color:red;'>$login_error</div>"; ?>
         <form method="POST">
             <input type="password" name="pw" placeholder="Passwort" autofocus required>
             <button type="submit" name="login_auth">Einloggen</button>
@@ -89,53 +93,62 @@ $typen = $pdo->query("SELECT * FROM game_typen ORDER BY bezeichnung ASC")->fetch
     <meta charset="UTF-8">
     <title>EXIT Admin - Stammdaten</title>
     <style>
-        body { font-family: 'Segoe UI', sans-serif; background: #f4f7f6; color: #333; padding: 20px; scroll-behavior: smooth; }
+        /* THEME VARIABLEN */
+        :root { 
+            --bg: #f4f7f6; --card: #ffffff; --text: #333; --border: #ddd; 
+            --header-bg: #f8f9fa; --input-bg: #fff; --unknown-bg: #fff3e0;
+        }
+        .dark-theme { 
+            --bg: #121212; --card: #1e1e1e; --text: #e0e0e0; --border: #333; 
+            --header-bg: #252525; --input-bg: #2a2a2a; --unknown-bg: #4d2b00;
+        }
+
+        body { font-family: 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); padding: 20px; scroll-behavior: smooth; transition: background 0.3s, color 0.3s; }
         .container { max-width: 1400px; margin: 0 auto; position: relative; }
         
-        /* Alerts */
+        /* Theme Switcher Button */
+        .theme-toggle { background: var(--card); border: 1px solid var(--border); color: var(--text); padding: 8px 12px; border-radius: 20px; cursor: pointer; font-size: 1.2rem; margin-right: 10px; transition: 0.3s; }
+        .theme-toggle:hover { transform: scale(1.1); }
+
+        /* Admin Layout */
         .alert { padding: 15px; border-radius: 8px; margin-bottom: 20px; font-weight: bold; text-align: center; position: sticky; top: 10px; z-index: 1000; border: 1px solid transparent; }
-        .alert-success { background: #d4edda; color: #155724; border-color: #c3e6cb; box-shadow: 0 4px 10px rgba(0,0,0,0.05); }
-        .alert-error { background: #f8d7da; color: #721c24; border-color: #f5c6cb; }
+        .alert-success { background: #d4edda; color: #155724; border-color: #c3e6cb; }
+        .dark-theme .alert-success { background: #1b4332; color: #74c69d; }
+
+        .admin-card { background: var(--card); padding: 20px; border-radius: 12px; box-shadow: 0 4px 15px rgba(0,0,0,0.1); margin-bottom: 30px; border: 1px solid var(--border); }
+        table { width: 100%; border-collapse: collapse; margin-top: 20px; table-layout: fixed; background: var(--card); }
+        th { background: var(--header-bg); color: var(--text); padding: 12px 10px; text-align: left; font-size: 0.85em; text-transform: uppercase; border-bottom: 2px solid var(--border); }
+        td { padding: 10px; border-bottom: 1px solid var(--border); }
+        
+        input, select { padding: 8px; border: 1px solid var(--border); border-radius: 6px; width: 100%; box-sizing: border-box; background: var(--input-bg); color: var(--text); font-size: 0.95em; }
         
-        .admin-card { background: white; padding: 20px; border-radius: 12px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); margin-bottom: 30px; border: 1px solid #eee; }
-        table { width: 100%; border-collapse: collapse; margin-top: 20px; table-layout: fixed; background: white; }
-        th, td { padding: 12px 10px; border-bottom: 1px solid #f0f0f0; text-align: left; overflow: hidden; }
-        th { background: #f8f9fa; color: #555; font-size: 0.85em; text-transform: uppercase; letter-spacing: 1px; border-top: 1px solid #eee; }
-        input, select { padding: 8px; border: 1px solid #ddd; border-radius: 6px; width: 100%; box-sizing: border-box; background: #fff; color: #333; font-size: 0.95em; transition: border-color 0.2s; }
-        input:focus, select:focus { border-color: #e67e22; outline: none; }
+        /* Spaltenbreiten */
+        .col-img { width: 60px; } .col-titel { width: auto; } .col-ean { width: 130px; } .col-typ { width: 160px; } .col-lvl { width: 150px; } .col-url { width: 180px; } .col-akt { width: 100px; text-align: center; }
+
+        .lvl-unknown { background: var(--unknown-bg) !important; color: #e67e22 !important; }
         
-        /* Spaltenbreiten Tabelle */
-        .col-img { width: 60px; }
-        .col-titel { width: auto; } 
-        .col-ean { width: 130px; }
-        .col-typ { width: 160px; }
-        .col-lvl { width: 150px; }
-        .col-url { width: 180px; }
-        .col-akt { width: 100px; text-align: center; }
-
-        .lvl-unknown { background: #fff3e0 !important; border-color: #ffb74d !important; color: #e65100 !important; }
-        .btn { padding: 10px 15px; border: none; border-radius: 6px; cursor: pointer; font-weight: bold; color: white; text-decoration: none; display: inline-block; font-size: 0.9em; transition: opacity 0.2s; }
-        .btn:hover { opacity: 0.85; }
+        .btn { padding: 10px 15px; border: none; border-radius: 6px; cursor: pointer; font-weight: bold; color: white; text-decoration: none; display: inline-block; font-size: 0.9em; }
         .btn-add { background: #27ae60; width: 100%; margin-top: 10px; }
         .btn-save { background: #2980b9; }
         .btn-del { background: #c0392b; }
         .btn-nav { background: #e67e22; }
-        .btn-scroll { background: #7f8c8d; margin-left: 5px; }
 
-        /* Floating Button */
-        #scrollToTop { position: fixed; bottom: 30px; right: 30px; background: #34495e; color: white; width: 45px; height: 45px; border-radius: 50%; border: none; cursor: pointer; display: none; font-size: 20px; z-index: 1000; box-shadow: 0 4px 10px rgba(0,0,0,0.2); }
-        
-        .img-preview { width: 40px; height: 40px; object-fit: cover; border-radius: 4px; background: #eee; display: block; margin: 0 auto; border: 1px solid #ddd; }
+        #scrollToTop { position: fixed; bottom: 30px; right: 30px; background: #e67e22; color: white; width: 45px; height: 45px; border-radius: 50%; border: none; cursor: pointer; display: none; z-index: 1000; box-shadow: 0 4px 10px rgba(0,0,0,0.2); }
+        .img-preview { width: 40px; height: 40px; object-fit: cover; border-radius: 4px; border: 1px solid var(--border); background: #eee; }
     </style>
+    <script>
+        // Theme sofort beim Laden anwenden (verhindert weißes Flackern)
+        if (localStorage.getItem('theme') === 'dark') document.documentElement.classList.add('dark-theme');
+    </script>
 </head>
 <body id="top">
 
 <div class="container">
     <div style="display:flex; justify-content: space-between; align-items: center; margin-bottom: 20px;">
-        <h1 style="color: #2c3e50;">🛠 Stammdaten Verwaltung</h1>
-        <div>
+        <h1>🛠 Stammdaten</h1>
+        <div style="display: flex; align-items: center;">
+            <button onclick="toggleTheme()" class="theme-toggle" id="theme-icon">🌙</button>
             <a href="index.php" class="btn btn-nav">Dashboard</a>
-            <button onclick="window.scrollTo(0, document.body.scrollHeight);" class="btn btn-scroll">⬇ Nach unten</button>
             <a href="admin.php?logout=1" class="btn btn-del" style="margin-left:15px;">Logout</a>
         </div>
     </div>
@@ -145,7 +158,7 @@ $typen = $pdo->query("SELECT * FROM game_typen ORDER BY bezeichnung ASC")->fetch
     <?php endif; ?>
 
     <div class="admin-card">
-        <h3 style="margin-top:0; color: #2c3e50;">🆕 Neues Spiel hinzufügen</h3>
+        <h3>🆕 Neues Spiel hinzufügen</h3>
         <form method="POST">
             <div style="display: grid; grid-template-columns: 3fr 1fr 1.2fr 1.2fr 2fr; gap: 10px;">
                 <input type="text" name="new_titel" placeholder="Spieltitel" required>
@@ -162,15 +175,14 @@ $typen = $pdo->query("SELECT * FROM game_typen ORDER BY bezeichnung ASC")->fetch
                     <option value="Fortgeschrittene">Fortgeschrittene</option>
                     <option value="Profi">Profi</option>
                 </select>
-                <input type="text" name="new_bild_url" placeholder="Bild-URL (Optional)">
+                <input type="text" name="new_bild_url" placeholder="Bild-URL">
             </div>
-            <button type="submit" name="add_new_game" class="btn btn-add">Spiel in Datenbank speichern</button>
+            <button type="submit" name="add_new_game" class="btn btn-add">In Datenbank speichern</button>
         </form>
     </div>
 
     <div class="admin-card" style="padding: 0; overflow: hidden;">
-        <h3 style="padding: 20px 20px 0 20px; margin-bottom: 10px; color: #2c3e50;">📋 Aktueller Bestand</h3>
-        <table>
+        <table id="bestand-table">
             <thead>
                 <tr>
                     <th class="col-img">Bild</th>
@@ -210,8 +222,8 @@ $typen = $pdo->query("SELECT * FROM game_typen ORDER BY bezeichnung ASC")->fetch
                         </td>
                         <td class="col-url"><input type="text" name="bild_url" value="<?= htmlspecialchars($sp['bild_url']) ?>"></td>
                         <td class="col-akt">
-                            <button type="submit" name="update_game" class="btn btn-save" title="Speichern">💾</button>
-                            <button type="submit" name="delete_game" class="btn btn-del" onclick="return confirm('Wirklich löschen?')" title="Löschen">🗑</button>
+                            <button type="submit" name="update_game" class="btn btn-save">💾</button>
+                            <button type="submit" name="delete_game" class="btn btn-del" onclick="return confirm('Löschen?')">🗑</button>
                         </td>
                     </form>
                 </tr>
@@ -219,33 +231,32 @@ $typen = $pdo->query("SELECT * FROM game_typen ORDER BY bezeichnung ASC")->fetch
             </tbody>
         </table>
     </div>
-    
-    <div id="page-bottom" style="padding-bottom: 60px; text-align: center; color: #999; font-size: 0.85em;">
-        — Ende der Sammlungs-Liste —
-    </div>
 </div>
 
-<button id="scrollToTop" onclick="window.scrollTo(0,0);" title="Nach oben">▲</button>
+<button id="scrollToTop" onclick="window.scrollTo(0,0);">▲</button>
 
 <script>
-    // Erfolgsmeldung sanft ausblenden
+    // THEME LOGIK
+    function toggleTheme() {
+        const isDark = document.documentElement.classList.toggle('dark-theme');
+        localStorage.setItem('theme', isDark ? 'dark' : 'light');
+        document.getElementById('theme-icon').innerText = isDark ? '☀️' : '🌙';
+    }
+    
+    // Icon beim Laden anpassen
+    if (localStorage.getItem('theme') === 'dark') {
+        document.getElementById('theme-icon').innerText = '☀️';
+    }
+
+    // Alerts ausblenden
     setTimeout(() => { 
         const msg = document.getElementById('msg-box');
-        if(msg) {
-            msg.style.transition = 'opacity 0.5s';
-            msg.style.opacity = '0';
-            setTimeout(() => { msg.style.display = 'none'; }, 500);
-        }
+        if(msg) { msg.style.transition = 'opacity 0.5s'; msg.style.opacity = '0'; }
     }, 3000);
 
-    // Floating Button Logik
+    // Scroll Button
     window.onscroll = function() {
-        const btn = document.getElementById("scrollToTop");
-        if (document.body.scrollTop > 300 || document.documentElement.scrollTop > 300) {
-            btn.style.display = "block";
-        } else {
-            btn.style.display = "none";
-        }
+        document.getElementById("scrollToTop").style.display = (window.scrollY > 300) ? "block" : "none";
     };
 </script>
 

+ 50 - 12
besitz.php

@@ -20,26 +20,54 @@ $spiele = $pdo->query("SELECT s.*, t.bezeichnung as typ_name FROM spiele s LEFT
     <meta charset="UTF-8">
     <title>EXIT - Bestandsverwaltung</title>
     <style>
-        body { font-family: 'Segoe UI', sans-serif; background: #121212; color: #e0e0e0; padding: 20px; }
+        /* THEME VARIABLEN */
+        :root { 
+            --bg: #f4f7f6; --card: #ffffff; --text: #333; --border: #ddd; --accent: #e67e22;
+            --table-head: #f8f9fa;
+        }
+        .dark-theme { 
+            --bg: #121212; --card: #1e1e1e; --text: #e0e0e0; --border: #333;
+            --table-head: #2a2a2a;
+        }
+
+        body { font-family: 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); padding: 20px; transition: 0.3s; }
         .container { max-width: 1200px; margin: auto; }
-        h1 { color: #e67e22; }
-        .alert { background: #27ae60; color: white; padding: 10px; border-radius: 5px; margin-bottom: 20px; text-align: center; }
-        table { width: 100%; border-collapse: collapse; background: #1e1e1e; border-radius: 8px; overflow: hidden; }
-        th, td { padding: 12px; border-bottom: 1px solid #333; text-align: left; }
-        th { background: #2a2a2a; color: #e67e22; text-transform: uppercase; font-size: 0.85em; }
+        
+        header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
+        h1 { color: var(--accent); margin: 0; }
+        
+        .alert { background: #27ae60; color: white; padding: 10px; border-radius: 5px; margin-bottom: 20px; text-align: center; transition: opacity 0.5s; }
+        
+        table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
+        th, td { padding: 12px; border-bottom: 1px solid var(--border); text-align: left; }
+        th { background: var(--table-head); color: var(--accent); text-transform: uppercase; font-size: 0.85em; }
+        
         .game-info { display: flex; align-items: center; gap: 15px; }
-        .game-info img { width: 40px; height: 40px; object-fit: cover; border-radius: 4px; border: 1px solid #444; }
-        select { background: #2a2a2a; color: white; border: 1px solid #444; padding: 5px; border-radius: 4px; width: 100%; cursor: pointer; }
+        .game-info img { width: 40px; height: 40px; object-fit: cover; border-radius: 4px; border: 1px solid var(--border); }
+        
+        select { background: var(--card); color: var(--text); border: 1px solid var(--border); padding: 8px; border-radius: 4px; width: 100%; cursor: pointer; transition: 0.3s; }
         select.besitzt { border-left: 4px solid #27ae60; }
         select.verkauft { border-left: 4px solid #f39c12; }
         select.nicht { border-left: 4px solid #7f8c8d; }
-        .back-link { color: #e67e22; text-decoration: none; font-weight: bold; margin-bottom: 20px; display: inline-block; }
+        
+        .back-link { color: var(--accent); text-decoration: none; font-weight: bold; border: 1px solid var(--accent); padding: 5px 15px; border-radius: 6px; }
+        .theme-toggle { background: var(--card); border: 1px solid var(--border); color: var(--text); padding: 8px 12px; border-radius: 20px; cursor: pointer; font-size: 1.1rem; }
     </style>
+    <script>
+        if (localStorage.getItem('theme') === 'dark') document.documentElement.classList.add('dark-theme');
+    </script>
 </head>
 <body>
 <div class="container">
-    <a href="index.php" class="back-link">← Zurück zum Dashboard</a>
+    <header>
+        <a href="index.php" class="back-link">← Dashboard</a>
+        <div style="display: flex; align-items: center; gap: 15px;">
+            <button onclick="toggleTheme()" class="theme-toggle" id="theme-icon">🌙</button>
+        </div>
+    </header>
+
     <h1>📦 Bestandsverwaltung</h1>
+    <p style="margin-bottom: 20px; opacity: 0.7;">Wer besitzt welches Spiel?</p>
     
     <?php if ($msg): ?><div class="alert" id="msg-box"><?= $msg ?></div><?php endif; ?>
 
@@ -57,10 +85,10 @@ $spiele = $pdo->query("SELECT s.*, t.bezeichnung as typ_name FROM spiele s LEFT
             <tr>
                 <td>
                     <div class="game-info">
-                        <img src="<?= htmlspecialchars($sp['bild_url']) ?>">
+                        <img src="<?= htmlspecialchars($sp['bild_url'] ?: 'https://via.placeholder.com/40') ?>">
                         <div>
                             <strong><?= htmlspecialchars($sp['titel']) ?></strong><br>
-                            <small style="color:#888"><?= htmlspecialchars($sp['typ_name']) ?></small>
+                            <small style="opacity: 0.6;"><?= htmlspecialchars($sp['typ_name']) ?></small>
                         </div>
                     </div>
                 </td>
@@ -90,6 +118,16 @@ $spiele = $pdo->query("SELECT s.*, t.bezeichnung as typ_name FROM spiele s LEFT
 </div>
 
 <script>
+    function toggleTheme() {
+        const isDark = document.documentElement.classList.toggle('dark-theme');
+        localStorage.setItem('theme', isDark ? 'dark' : 'light');
+        document.getElementById('theme-icon').innerText = isDark ? '☀️' : '🌙';
+    }
+
+    if (localStorage.getItem('theme') === 'dark') {
+        document.getElementById('theme-icon').innerText = '☀️';
+    }
+
     setTimeout(function() { 
         var msg = document.getElementById('msg-box'); 
         if(msg) msg.style.opacity = '0'; 

+ 43 - 20
gesamtliste.php

@@ -30,49 +30,67 @@ $spieler = $pdo->query("SELECT * FROM spieler ORDER BY name ASC")->fetchAll();
     <meta name="viewport" content="width=device-width, initial-scale=1.0">
     <title>EXIT - Gesamtliste</title>
     <style>
-        body { font-family: 'Segoe UI', sans-serif; background: #f8f9fa; margin: 0; padding: 20px; color: #333; }
+        /* THEME VARIABLEN */
+        :root { 
+            --bg: #f8f9fa; --card: #ffffff; --text: #333; --border: #ddd; 
+            --header-bg: #2c3e50; --header-text: #ffffff; --row-border: #eee;
+        }
+        .dark-theme { 
+            --bg: #121212; --card: #1e1e1e; --text: #e0e0e0; --border: #333; 
+            --header-bg: #252525; --header-text: #e67e22; --row-border: #2a2a2a;
+        }
+
+        body { font-family: 'Segoe UI', sans-serif; background: var(--bg); margin: 0; padding: 20px; color: var(--text); transition: 0.3s; }
         .container { max-width: 1400px; margin: 0 auto; }
         .header-area { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; }
-        .back-link { color: #e67e22; text-decoration: none; font-weight: bold; padding: 8px 15px; border: 2px solid #e67e22; border-radius: 6px; }
         
-        .filter-bar { background: white; padding: 15px; border-radius: 12px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); display: flex; gap: 15px; margin-bottom: 20px; align-items: center; }
-        select, input { padding: 12px; border: 1px solid #ddd; border-radius: 8px; }
+        .nav-group { display: flex; align-items: center; gap: 10px; }
+        .back-link { color: #e67e22; text-decoration: none; font-weight: bold; padding: 8px 15px; border: 2px solid #e67e22; border-radius: 6px; }
+        .theme-toggle { background: var(--card); border: 1px solid var(--border); color: var(--text); padding: 8px 12px; border-radius: 20px; cursor: pointer; font-size: 1.1rem; }
+
+        .filter-bar { background: var(--card); padding: 15px; border-radius: 12px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); display: flex; gap: 15px; margin-bottom: 20px; align-items: center; border: 1px solid var(--border); }
+        select, input { padding: 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--card); color: var(--text); }
         input { flex-grow: 1; }
 
-        table { width: 100%; border-collapse: collapse; background: white; border-radius: 12px; overflow: hidden; box-shadow: 0 4px 20px rgba(0,0,0,0.08); }
-        th { background: #2c3e50; color: white; text-align: left; padding: 15px; cursor: pointer; font-size: 0.8em; }
-        td { padding: 12px 15px; border-bottom: 1px solid #eee; }
+        table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 12px; overflow: hidden; box-shadow: 0 4px 20px rgba(0,0,0,0.08); }
+        th { background: var(--header-bg); color: var(--header-text); text-align: left; padding: 15px; cursor: pointer; font-size: 0.8em; }
+        td { padding: 12px 15px; border-bottom: 1px solid var(--row-border); }
         
-        .game-thumb { width: 55px; height: 55px; object-fit: cover; border-radius: 8px; border: 1px solid #ddd; cursor: pointer; transition: 0.2s; }
+        .game-thumb { width: 55px; height: 55px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); cursor: pointer; transition: 0.2s; }
         .game-thumb:hover { transform: scale(1.1); border-color: #e67e22; }
 
-        /* Badges & Unbekannt-Status */
         .lvl-badge { padding: 4px 10px; border-radius: 20px; color: white; font-size: 11px; font-weight: bold; text-transform: uppercase; }
         .lvl-Einsteiger { background: #27ae60; } 
         .lvl-Fortgeschrittene { background: #2980b9; } 
         .lvl-Profi { background: #c0392b; }
-        .lvl-unknown, .badge-unknown { background: #f39c12; color: white; } /* Gelb/Orange für Unbekannt */
+        .lvl-unknown, .badge-unknown { background: #f39c12; color: white; }
 
         .st-badge { padding: 5px 12px; border-radius: 15px; font-size: 11px; font-weight: bold; }
         .st-besitzt { background: #d4edda; color: #155724; }
+        .dark-theme .st-besitzt { background: #1b4332; color: #74c69d; }
         .st-verkauft { background: #fff3cd; color: #856404; }
         .st-keins { background: #f8d7da; color: #721c24; }
         
-        .team-pill { display: inline-flex; align-items: center; background: #f1f2f6; padding: 4px 10px; border-radius: 6px; font-size: 12px; margin: 2px; border: 1px solid #dfe4ea; }
+        .team-pill { display: inline-flex; align-items: center; background: var(--bg); padding: 4px 10px; border-radius: 6px; font-size: 12px; margin: 2px; border: 1px solid var(--border); }
         .dot { height: 8px; width: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
 
-        /* Modal & Preview */
-        .image-preview { position: absolute; display: none; width: 220px; border: 4px solid white; border-radius: 12px; z-index: 999; box-shadow: 0 15px 35px rgba(0,0,0,0.4); pointer-events: none; }
         #imgModal { display: none; position: fixed; z-index: 10000; left: 0; top: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.9); align-items: center; justify-content: center; cursor: zoom-out; }
         #modalContent { max-width: 90%; max-height: 90%; border-radius: 10px; }
+        .image-preview { position: absolute; display: none; width: 220px; border: 4px solid white; border-radius: 12px; z-index: 999; box-shadow: 0 15px 35px rgba(0,0,0,0.4); pointer-events: none; }
     </style>
+    <script>
+        if (localStorage.getItem('theme') === 'dark') document.documentElement.classList.add('dark-theme');
+    </script>
 </head>
 <body>
 
 <div class="container">
     <div class="header-area">
         <h1>📝 Sammlungs-Übersicht</h1>
-        <a href="index.php" class="back-link">← Zum Dashboard</a>
+        <div class="nav-group">
+            <button onclick="toggleTheme()" class="theme-toggle" id="theme-icon">🌙</button>
+            <a href="index.php" class="back-link">← Zum Dashboard</a>
+        </div>
     </div>
 
     <div class="filter-bar">
@@ -98,7 +116,6 @@ $spieler = $pdo->query("SELECT * FROM spieler ORDER BY name ASC")->fetchAll();
         </thead>
         <tbody>
             <?php foreach ($inventory as $row): 
-                // Logik für unbekannte Werte
                 $lvl = (empty($row['level']) || strtolower($row['level']) == 'unknown') ? 'unknown' : $row['level'];
                 $typ = (empty($row['typ_name']) || strtolower($row['typ_name']) == 'unknown') ? 'Unbekannt' : $row['typ_name'];
             ?>
@@ -117,7 +134,7 @@ $spieler = $pdo->query("SELECT * FROM spieler ORDER BY name ASC")->fetchAll();
                     <?php if($typ == 'Unbekannt'): ?>
                         <small class="lvl-badge badge-unknown" style="padding: 1px 6px; font-size: 9px;">UNBEKANNT</small>
                     <?php else: ?>
-                        <small style="color:#777;"><?= htmlspecialchars($typ) ?></small>
+                        <small style="opacity: 0.7;"><?= htmlspecialchars($typ) ?></small>
                     <?php endif; ?>
                 </td>
                 <td>
@@ -134,7 +151,9 @@ $spieler = $pdo->query("SELECT * FROM spieler ORDER BY name ASC")->fetchAll();
                     else:
                         if ($row['besitz_info']) {
                             foreach (explode('||', $row['besitz_info']) as $t) {
-                                list($tn, $ts) = explode(': ', $t);
+                                $parts = explode(': ', $t);
+                                if(count($parts) < 2) continue;
+                                list($tn, $ts) = $parts;
                                 $dot = ($ts == 'besitzt') ? '#27ae60' : '#f39c12';
                                 echo "<span class='team-pill'><span class='dot' style='background:$dot'></span>$tn ($ts)</span>";
                             }
@@ -151,12 +170,17 @@ $spieler = $pdo->query("SELECT * FROM spieler ORDER BY name ASC")->fetchAll();
 <img id="hoverPreview" class="image-preview" src="">
 
 <script>
-    // Modal-Logik
+    function toggleTheme() {
+        const isDark = document.documentElement.classList.toggle('dark-theme');
+        localStorage.setItem('theme', isDark ? 'dark' : 'light');
+        document.getElementById('theme-icon').innerText = isDark ? '☀️' : '🌙';
+    }
+    if (localStorage.getItem('theme') === 'dark') document.getElementById('theme-icon').innerText = '☀️';
+
     const modal = document.getElementById("imgModal");
     const modalImg = document.getElementById("modalContent");
     function openModal(url) { modal.style.display = "flex"; modalImg.src = url; hidePreview(); }
 
-    // Hover-Logik
     const preview = document.getElementById('hoverPreview');
     function showPreview(e, url) { 
         if(modal.style.display === "flex") return;
@@ -166,7 +190,6 @@ $spieler = $pdo->query("SELECT * FROM spieler ORDER BY name ASC")->fetchAll();
     function updatePos(e) { preview.style.left = (e.pageX + 20) + 'px'; preview.style.top = (e.pageY - 100) + 'px'; }
     document.addEventListener('mousemove', (e) => { if(preview.style.display==='block') updatePos(e); });
 
-    // Filter & Sortierung
     function filterTable() {
         let val = document.getElementById("searchInput").value.toUpperCase();
         let tr = document.getElementById("exitTable").getElementsByTagName("tr");

+ 48 - 9
gespielte_spiele.php

@@ -1,5 +1,5 @@
 <?php
-include 'db_config.php'; // Falls du die Connection auslagerst, sonst Code von oben kopieren
+include 'db_config.php'; 
 
 $sql = "SELECT DISTINCT sp.* FROM spiele sp
         JOIN scores sc ON sp.id = sc.spiel_id
@@ -13,24 +13,63 @@ $playedGames = $stmt->fetchAll();
     <meta charset="UTF-8">
     <title>Gespielte Spiele</title>
     <style>
-        body { font-family: sans-serif; background: #121212; color: white; padding: 20px; }
+        /* THEME VARIABLEN */
+        :root { 
+            --bg: #f4f7f6; --card: #ffffff; --text: #333; --border: #ddd; --accent: #e67e22;
+        }
+        .dark-theme { 
+            --bg: #121212; --card: #1e1e1e; --text: #ffffff; --border: #333; 
+        }
+
+        body { font-family: 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); padding: 20px; transition: 0.3s; }
+        
+        header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
+        
         .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 20px; }
-        .item { background: #1e1e1e; padding: 10px; border-radius: 8px; text-align: center; border: 1px solid #333; }
-        .item img { width: 100%; border-radius: 4px; height: 150px; object-fit: cover; }
-        h1 { color: #e67e22; }
-        .back { display: inline-block; margin-bottom: 20px; color: #e67e22; text-decoration: none; }
+        .item { background: var(--card); padding: 10px; border-radius: 8px; text-align: center; border: 1px solid var(--border); box-shadow: 0 4px 10px rgba(0,0,0,0.1); }
+        .item img { width: 100%; border-radius: 4px; height: 150px; object-fit: cover; background: #2a2a2a; }
+        
+        h1 { color: var(--accent); margin: 0; }
+        .back { color: var(--accent); text-decoration: none; font-weight: bold; border: 1px solid var(--accent); padding: 5px 15px; border-radius: 6px; }
+        
+        .theme-toggle { background: var(--card); border: 1px solid var(--border); color: var(--text); padding: 8px 12px; border-radius: 20px; cursor: pointer; font-size: 1.1rem; }
     </style>
+    <script>
+        if (localStorage.getItem('theme') === 'dark') document.documentElement.classList.add('dark-theme');
+    </script>
 </head>
 <body>
-    <a href="index.php" class="back">← Zurück zum Dashboard</a>
+
+    <header>
+        <a href="index.php" class="back">← Dashboard</a>
+        <div style="display: flex; align-items: center; gap: 15px;">
+            <button onclick="toggleTheme()" class="theme-toggle" id="theme-icon">🌙</button>
+        </div>
+    </header>
+
     <h1>📂 Gelöste Abenteuer</h1>
+    <p style="margin-bottom: 30px; opacity: 0.8;">Diese Spiele wurden bereits erfolgreich beendet.</p>
+
     <div class="grid">
         <?php foreach ($playedGames as $game): ?>
             <div class="item">
-                <img src="<?= htmlspecialchars($game['bild_url']) ?>">
-                <p><?= htmlspecialchars($game['titel']) ?></p>
+                <img src="<?= htmlspecialchars($game['bild_url']) ?>" onerror="this.src='https://via.placeholder.com/200x150?text=Kein+Bild'">
+                <p style="font-weight: bold; margin-top: 10px;"><?= htmlspecialchars($game['titel']) ?></p>
             </div>
         <?php endforeach; ?>
     </div>
+
+<script>
+    function toggleTheme() {
+        const isDark = document.documentElement.classList.toggle('dark-theme');
+        localStorage.setItem('theme', isDark ? 'dark' : 'light');
+        document.getElementById('theme-icon').innerText = isDark ? '☀️' : '🌙';
+    }
+
+    // Icon beim Laden anpassen
+    if (localStorage.getItem('theme') === 'dark') {
+        document.getElementById('theme-icon').innerText = '☀️';
+    }
+</script>
 </body>
 </html>

+ 90 - 33
index.php

@@ -1,5 +1,5 @@
 <?php
-include 'db_config.php';
+require_once 'db_config.php';
 
 // --- LOGIK: NEUEN SPIELER HINZUFÜGEN ---
 if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['add_player'])) {
@@ -47,57 +47,102 @@ $allScores = $pdo->query($sqlScores)->fetchAll();
     <title>EXIT - Dashboard</title>
     <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css" />
     <style>
-        body { font-family: 'Segoe UI', sans-serif; background: #121212; color: #e0e0e0; margin: 0; padding-bottom: 100px; }
+        /* THEME VARIABLEN */
+        :root { 
+            --bg: #f4f7f6; --card: #ffffff; --text: #333; --border: #ddd; --accent: #e67e22;
+            --input-bg: #fff; --footer-bg: #f1f1f1;
+        }
+        .dark-theme { 
+            --bg: #121212; --card: #1e1e1e; --text: #e0e0e0; --border: #333;
+            --input-bg: #2a2a2a; --footer-bg: #1a1a1a;
+        }
+
+        body { font-family: 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); margin: 0; padding-bottom: 120px; transition: 0.3s; }
         .container { max-width: 1200px; margin: auto; padding: 20px; }
         
+        /* HEADER FIX */
+        header { 
+            display: flex; 
+            justify-content: space-between; 
+            align-items: center; 
+            margin-bottom: 25px; 
+            border-bottom: 1px solid var(--border);
+            padding-bottom: 15px;
+        }
+        h1 { color: var(--accent); margin: 0; font-size: 1.6em; }
+
+        /* KOMPAKTER THEME-TOGGLE (Identisch zu den anderen Seiten) */
+        .theme-toggle { 
+            background: var(--card); 
+            border: 1px solid var(--border); 
+            color: var(--text); 
+            width: 42px;            /* Feste Breite */
+            height: 34px;           /* Feste Höhe */
+            padding: 0; 
+            border-radius: 10px; 
+            cursor: pointer; 
+            font-size: 1.1rem; 
+            display: flex;
+            align-items: center;
+            justify-content: center;
+            transition: 0.3s;
+            flex-shrink: 0;         /* Verhindert Aufblähen */
+        }
+        .theme-toggle:hover { border-color: var(--accent); }
+
+        /* Swiper & Cards */
         .swiper { width: 100%; padding-bottom: 40px; }
         .swiper-slide { width: 320px; height: auto; }
-        
-        .card { background: #1e1e1e; border-radius: 12px; border: 1px solid #333; overflow: hidden; height: 100%; }
-        .card img { width: 100%; height: 180px; object-fit: cover; opacity: 0.7; }
+        .card { background: var(--card); border-radius: 12px; border: 1px solid var(--border); overflow: hidden; height: 100%; box-shadow: 0 4px 15px rgba(0,0,0,0.1); }
+        .card img { width: 100%; height: 180px; object-fit: cover; opacity: 0.9; }
         .content { padding: 15px; }
         
-        h1 { color: #e67e22; }
-        h2 { color: #e67e22; margin-top: 0; font-size: 1.2em; }
+        h2 { color: var(--accent); margin-top: 0; font-size: 1.1em; }
         .stats { width: 100%; border-collapse: collapse; font-size: 0.85em; }
-        .stats td { padding: 6px 0; border-bottom: 1px solid #2a2a2a; }
+        .stats td { padding: 6px 0; border-bottom: 1px solid var(--border); }
         
-        /* Badges inkl. Unbekannt-Logik */
         .badge { padding: 4px 8px; border-radius: 4px; font-size: 0.7em; font-weight: bold; text-transform: uppercase; color: white; display: inline-block; margin-bottom: 5px; }
         .level-Einsteiger { background: #27ae60; } 
         .level-Profi { background: #c0392b; } 
         .level-Fortgeschrittene { background: #2980b9; }
-        .level-unknown { background: #f39c12; } /* Gelb/Orange für Unbekannt */
+        .level-unknown { background: #f39c12; }
 
+        /* Formulare & Layout */
         .bottom-section { display: grid; grid-template-columns: 1fr 2fr; gap: 20px; margin-top: 20px; }
         @media (max-width: 768px) { .bottom-section { grid-template-columns: 1fr; } }
 
-        .form-section, .info-section { background: #1e1e1e; padding: 20px; border-radius: 12px; border: 1px solid #444; }
-        .highlight-border { border-color: #e67e22; }
+        .form-section, .info-section { background: var(--card); padding: 20px; border-radius: 12px; border: 1px solid var(--border); }
+        .highlight-border { border-color: var(--accent); }
         
-        input, select { width: 100%; padding: 10px; background: #2a2a2a; border: 1px solid #444; color: white; border-radius: 5px; box-sizing: border-box; margin-bottom: 10px; }
-        button { background: #e67e22; color: white; border: none; padding: 12px; border-radius: 5px; cursor: pointer; font-weight: bold; width: 100%; }
+        input, select { width: 100%; padding: 10px; background: var(--input-bg); border: 1px solid var(--border); color: var(--text); border-radius: 5px; box-sizing: border-box; margin-bottom: 10px; }
+        button { background: var(--accent); color: white; border: none; padding: 12px; border-radius: 5px; cursor: pointer; font-weight: bold; width: 100%; }
 
-        .footer-nav { position: fixed; bottom: 0; left: 0; width: 100%; background: #1a1a1a; border-top: 2px solid #e67e22; padding: 15px 0; display: flex; justify-content: center; gap: 20px; z-index: 1000; flex-wrap: wrap; }
-        .footer-nav a { color: #e67e22; text-decoration: none; font-weight: bold; font-size: 0.85em; padding: 5px 10px; border: 1px solid transparent; transition: 0.3s; }
-        .footer-nav a:hover { border-color: #e67e22; border-radius: 5px; }
+        /* Footer Nav */
+        .footer-nav { position: fixed; bottom: 0; left: 0; width: 100%; background: var(--footer-bg); border-top: 2px solid var(--accent); padding: 15px 0; display: flex; justify-content: center; gap: 20px; z-index: 1000; flex-wrap: wrap; }
+        .footer-nav a { color: var(--accent); text-decoration: none; font-weight: bold; font-size: 0.8em; padding: 5px 10px; border: 1px solid transparent; transition: 0.3s; }
+        .footer-nav a:hover { border-color: var(--accent); border-radius: 5px; }
         
-        .info-section a { color: #e67e22; text-decoration: none; display: block; padding: 10px; border: 1px dashed #444; border-radius: 8px; text-align: center; }
-        .info-section a:hover { background: #252525; }
+        .info-section a { color: var(--accent); text-decoration: none; display: block; padding: 10px; border: 1px dashed var(--border); border-radius: 8px; text-align: center; }
 
-        #playerModal { display: none; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: #1e1e1e; padding: 30px; border-radius: 12px; border: 1px solid #e67e22; z-index: 2000; box-shadow: 0 0 50px rgba(0,0,0,0.8); }
+        /* Modal */
+        #playerModal { display: none; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: var(--card); padding: 30px; border-radius: 12px; border: 1px solid var(--accent); z-index: 2000; box-shadow: 0 0 50px rgba(0,0,0,0.5); color: var(--text); }
         .overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); z-index: 1500; }
     </style>
+    <script>
+        if (localStorage.getItem('theme') === 'dark') document.documentElement.classList.add('dark-theme');
+    </script>
 </head>
 <body>
 
 <div class="container">
-    <h1>🏆 EXIT Highscores</h1>
+    <header>
+        <h1>🏆 EXIT Highscores</h1>
+        <button onclick="toggleTheme()" class="theme-toggle" id="theme-icon">🌙</button>
+    </header>
 
     <div class="swiper mySwiper">
         <div class="swiper-wrapper">
             <?php foreach ($exitGames as $game): 
-                // Logik für unbekanntes Level
                 $lvl_class = (empty($game['level']) || strtolower($game['level']) == 'unknown') ? 'unknown' : $game['level'];
                 $lvl_display = ($lvl_class == 'unknown') ? 'Unbekannt' : $game['level'];
             ?>
@@ -118,7 +163,7 @@ $allScores = $pdo->query($sqlScores)->fetchAll();
                                         <td style="color:#f1c40f"><?= $entry['sterne'] ?>★</td>
                                     </tr>
                                 <?php endif; endforeach; 
-                                if (!$found) echo "<tr><td colspan='3' style='color:#666'>Noch keine Scores.</td></tr>";
+                                if (!$found) echo "<tr><td colspan='3' style='opacity:0.5'>Noch keine Scores.</td></tr>";
                                 ?>
                             </table>
                         </div>
@@ -132,7 +177,7 @@ $allScores = $pdo->query($sqlScores)->fetchAll();
     <div class="bottom-section">
         <div class="info-section">
             <h2>📜 Archiv</h2>
-            <p style="font-size: 0.8em; color: #888;">Hier findest du alle Details zu den bereits gelösten Abenteuern.</p>
+            <p style="font-size: 0.8em; opacity: 0.6;">Bereits gelöste Abenteuer einsehen.</p>
             <a href="gespielte_spiele.php">📂 Übersicht gespielte Spiele</a>
         </div>
 
@@ -163,7 +208,7 @@ $allScores = $pdo->query($sqlScores)->fetchAll();
 
 <div class="footer-nav">
     <a href="javascript:void(0)" onclick="toggleModal()">👤 NEUER SPIELER</a>
-    <a href="besitz.php">📦 BESTAND PFLEGEN</a> 
+    <a href="besitz.php">📦 BESTAND</a> 
     <a href="gesamtliste.php">📝 GESAMTÜBERSICHT</a>
     <a href="admin.php">🛠 ADMIN</a>
 </div>
@@ -174,29 +219,41 @@ $allScores = $pdo->query($sqlScores)->fetchAll();
     <form method="POST">
         <input type="text" name="neuer_spieler_name" placeholder="Name (z.B. Die Füchse)" required>
         <button type="submit" name="add_player">Anlegen</button>
-        <button type="button" onclick="toggleModal()" style="background: #444; margin-top: 10px;">Abbrechen</button>
+        <button type="button" onclick="toggleModal()" style="background: #666; margin-top: 10px;">Abbrechen</button>
     </form>
 </div>
 
 <script src="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.js"></script>
 <script>
+    // Theme-Logik
+    function toggleTheme() {
+        const isDark = document.documentElement.classList.toggle('dark-theme');
+        localStorage.setItem('theme', isDark ? 'dark' : 'light');
+        updateIcon(isDark);
+    }
+
+    function updateIcon(isDark) {
+        document.getElementById('theme-icon').innerText = isDark ? '☀️' : '🌙';
+    }
+
+    if (localStorage.getItem('theme') === 'dark') updateIcon(true);
+
+    // Swiper
     const swiper = new Swiper(".mySwiper", {
         slidesPerView: "auto",
         spaceBetween: 20,
         centeredSlides: false,
         grabCursor: true,
-        pagination: {
-            el: ".swiper-pagination",
-            clickable: true,
-        },
+        pagination: { el: ".swiper-pagination", clickable: true },
     });
 
+    // Modal
     function toggleModal() {
         const modal = document.getElementById('playerModal');
         const overlay = document.getElementById('overlay');
-        const display = modal.style.display === 'block' ? 'none' : 'block';
-        modal.style.display = display;
-        overlay.style.display = display;
+        const isVisible = modal.style.display === 'block';
+        modal.style.display = isVisible ? 'none' : 'block';
+        overlay.style.display = isVisible ? 'none' : 'block';
     }
 </script>