/* =========================================
   1. VARIABLES & THEME CONFIG
   ========================================= */
:root {
    /* Colors */
    --primary: #3785da;
    --primary-hover: #0056b3;
    --accent: #00c6ff;
    
    /* Text Colors (Dark Theme Basis) */
    --text-main: #e0e0e0;      
    --text-muted: #a0a0a0;     
    --text-inverse: #ffffff;   
    --text-dark: #1a1a1a; /* Für Inputs */

    /* Backgrounds */
    --bg-color: rgb(7, 18, 36);
    
    /* Glassmorphism */
    --glass-bg: rgba(15, 25, 50, 0.65); 
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-nav-bg: rgba(7, 18, 36, 0.85);
    
    /* Dimensions */
    --radius: 16px;
    --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    --header-height: 90px;
    --nav-height: 70px;
}

/* =========================================
   2. RESET & GLOBAL
   ========================================= */
* { box-sizing: border-box; }

html {
    /* WICHTIG FÜR IOS: Verhindert automatisches Zoomen der Schrift */
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    margin: 0;
    padding: 0;
    /* FIX: System-Fonts zuerst für saubere Ausrichtung auf iOS */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    /* Fix für Zahlenausrichtung */
    font-variant-numeric: tabular-nums;
    /* Padding unten für Bottom Nav */
    padding-bottom: var(--nav-height);
}

/* iOS Fixed Background Hack */
body::before {
    content: "";
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: url('/background.webp');
    background-size: cover;
    background-position: center;
    z-index: -1;
    pointer-events: none;
}

h1, h2, h3, h4, h5, h6 { margin: 0; color: var(--text-main); }
a { text-decoration: none; color: inherit; transition: opacity 0.2s; }
ul { list-style: none; padding: 0; margin: 0; }
button, input, select, textarea { font-family: inherit; }

/* =========================================
   3. LAYOUT STRUCTURE (Wiederhergestellt!)
   ========================================= */
.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0; /* DEINE ÄNDERUNG */
    padding-bottom: 100px; /* Safe space */
    width: 100%;
}

main {
    flex: 1;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px 7px; /* DEINE ÄNDERUNG: Weniger Padding mobil */
}

footer {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* =========================================
   4. GLASSMORPHISM & CARDS
   ========================================= */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
    border-radius: var(--radius);
    color: var(--text-main);
}

.glass-nav {
    background: var(--glass-nav-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
}

.card {
    padding: 15px;
    margin-bottom: 15px;
    border-radius: var(--radius);
    /* Falls .glass nicht genutzt wird, Fallback: */
    background: var(--glass-bg); 
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.no-pad { padding: 0 !important; }

/* =========================================
   5. HEADER & NAVIGATION
   ========================================= */
header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo {
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Sidebar / Menu Overlay */
.menu-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); backdrop-filter: blur(3px);
    z-index: 90;
}

.app-sidebar {
    position: fixed; top: 0; left: 0; width: 280px; height: 100%;
    z-index: 100;
    display: flex; flex-direction: column;
    border-right: 1px solid var(--glass-border);
}

.sidebar-head {
    padding: 15px;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
}

.sidebar-nav {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    overflow-y: auto;
    flex: 1;
}

.sidebar-link {
    padding: 12px 15px;
    color: var(--text-main);
    font-weight: 500;
    border-radius: 8px;
    display: flex; align-items: center; gap: 12px;
    transition: background 0.2s;
}
.sidebar-link:hover {
    background: rgba(255,255,255,0.1);
    color: var(--primary);
}
.sidebar-link i { width: 20px; text-align: center; }

.menu-divider {
    border: 0;
    border-top: 1px solid var(--glass-border);
    margin: 10px 0;
    width: 100%;
}

.logout-btn {
    background: none; border: none; color: #dc3545;
    width: 100%; text-align: left; font-size: 1rem;
    padding: 12px 15px; cursor: pointer; display: flex; align-items: center; gap: 12px;
}
.logout-btn:hover { background: rgba(220, 53, 69, 0.1); border-radius: 8px; }

/* Bottom Nav */
.bottom-nav {
    position: fixed; bottom: 0; left: 0; width: 100%; height: var(--nav-height);
    display: grid; grid-template-columns: repeat(5, 1fr);
    z-index: 100;
    border-top: 1px solid var(--glass-border);
    /* WICHTIG: Overflow visible für FAB */
    overflow: visible !important;
    padding-bottom: env(safe-area-inset-bottom);
    padding-top: 5px;
}

.nav-item {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-decoration: none; color: var(--text-muted);
    font-size: 0.8rem; transition: color 0.2s;
    position: relative;
}

.nav-item i { font-size: 2rem; margin-bottom: -4px; transition: transform 0.2s; }
.nav-item.active { color: var(--primary); text-shadow: 0 0 10px rgba(55, 133, 218, 0.3); }
.nav-item.active i { transform: translateY(-3px); }
.nav-item span { margin-top: 6px;  }

/* Floating Action Button (FAB) FIX FINAL */
.fab-wrapper { 
    position: relative; 
    z-index: 101; 
    overflow: visible; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
}
.fab {
    width: 60px !important; height: 60px;
    /* Expliziter Background Fallback */
    background-color: #3785da; 
    background-image: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white !important; /* Farbe erzwingen */
    border-radius: 50%;
    
    /* WICHTIG FÜR ZENTRIERUNG */
    display: flex; 
    align-items: center; 
    justify-content: center;
    
    font-size: 1.6rem;
    box-shadow: 0 8px 20px rgba(0,0,0,0.4);
    transform: translateY(-25px);
    border: 4px solid rgba(255, 255, 255, 0.1);
    margin: 0 auto;
    padding: 0; 
}
.fab:active { transform: translateY(-22px) scale(0.95); }
/* Icon Reset für perfekte Zentrierung */
.fab i { font-size: 2rem; margin: 0; padding: 12px 10px; line-height: 0.9; display: block; }

/* =========================================
   6. NOTIFICATIONS & USER
   ========================================= */
.noti-wrap { position: relative; }
.noti-badge {
    position: absolute; top: -8px; right: -2px;
    background: #dc3545; color: white;
    font-size: 0.6rem; 
    padding: 2px 5px;
    border-radius: 10px;
    border: 2px solid var(--bg-color);
}

.noti-dropdown {
    position: absolute; top: 50px; right: -10px;
    width: 320px; max-height: 400px;
    display: flex; flex-direction: column;
    z-index: 200;
}

.noti-head { padding: 12px; font-weight: bold; border-bottom: 1px solid var(--glass-border); background: rgba(0,0,0,0.2); }
.noti-list { overflow-y: auto; }
.noti-item {
    display: flex; gap: 12px; padding: 12px;
    border-bottom: 1px solid var(--glass-border);
    color: var(--text-main);
}
.noti-item:hover { background: rgba(255,255,255,0.05); }
.noti-item.unread { background: rgba(55, 133, 218, 0.15); border-left: 3px solid var(--primary); }
.noti-content .title { font-weight: bold; font-size: 1.1rem; }
.noti-content .body { font-size: 0.85rem; color: var(--text-muted); }

/* User Profile Header */
.user-badge { display: flex; align-items: center; gap: 10px; }
.user-avatar {
    width: 52px; height: 52px; border-radius: 50%;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.3);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden; color: #fff;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.login-link { color: var(--primary); font-size: 1.4rem; }

/* =========================================
   7. FORMS & INPUTS
   ========================================= */
.form-group { margin-bottom: 15px; }
.form-row { display: flex; gap: 15px; }
.form-row .form-group { flex: 1; }

label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 1.1rem;
    color: var(--text-light); /* Helles Grau auf dunklem Grund */
}

/* High Contrast Inputs für Dark Mode */
input, textarea, select {
    width: 100%;
    padding: 12px;
    border: 1px solid rgba(0,0,0,0.2);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3); /* Fast weiß für Lesbarkeit */
    color: var(--text-main); /* Dunkler Text */
    font-size: 1.2rem;
    transition: all 0.2s;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(80, 80, 80, 0.3);
    box-shadow: 0 0 0 3px rgba(55, 133, 218, 0.3);
}

/* File Upload Button Wrapper */
.upload-btn-wrapper { position: relative; overflow: hidden; display: inline-block; width: 100%; }
.upload-btn-wrapper input[type=file] { font-size: 100px; position: absolute; left: 0; top: 0; opacity: 0; cursor: pointer; height: 100%; }

/* =========================================
   8. BUTTONS
   ========================================= */
.btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    font-size: 1.2rem;
    cursor: pointer;
    transition: transform 0.1s, filter 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-inverse);
}

.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; filter: grayscale(1); }

.btn-primary, .save-btn {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    box-shadow: 0 4px 15px rgba(55, 133, 218, 0.3);
}

.btn-danger { background: #dc3545; }
.btn-secondary { background: rgba(255,255,255,0.1); color: var(--text-main); border: 1px solid var(--glass-border); }

.btn-outline {
    background: transparent;
    border: 2px dashed rgba(255,255,255,0.3);
    color: var(--text-muted);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

/* Icon Only Buttons */
.icon-btn {
    background: none; border: none; font-size: 2rem; color: var(--text-main);
    padding: 8px; border-radius: 50%; transition: background 0.2s; cursor: pointer;
}
.icon-btn:hover { background: rgba(255,255,255,0.1); color: var(--primary); }

/* =========================================
   8. LISTS & TABLES
   ========================================= */
.list { display: flex; flex-direction: column; gap: 10px; }

.list-item {
    display: flex; align-items: center; gap: 15px;
    padding: 15px;
    border-bottom: 1px solid var(--glass-border);
    transition: background 0.2s;
}
.list-item:last-child { border-bottom: none; }
.list-item:hover { background: rgba(255,255,255,0.05); }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 12px; background: rgba(0,0,0,0.2); font-size: 1rem; color: var(--text-main); }
td { padding: 12px; border-bottom: 1px solid var(--glass-border); vertical-align: middle; }
tr:last-child td { border: none; }
tr:hover td { background: rgba(255,255,255,0.05); }

/* =========================================
   9. BADGES & ICONS
   ========================================= */
.badge {
    padding: 4px 0;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: bold;
    color: white;
    background: var(--text-light);
    display: inline-block;
}
.badge.green { background: #28a745; }
.badge.blue { background: var(--primary); }
.badge.red { background: #dc3545; }
.badge.orange { background: #fd7e14; }
.badge.live { background: #28a745; box-shadow: 0 0 10px rgba(40, 167, 69, 0.4); }

/* Icon Colors */
.icon-gold { color: #ffc107; text-shadow: 0 0 10px rgba(255, 193, 7, 0.3); }
.icon-blue { color: var(--primary); }

.red { color: #dc3545; } 
.blue { color: #ffffff; } 
.green { color: #28a745; } 
.gold { color: #ffc107; }

/* =========================================
   10. AVATARS & IMAGES
   ========================================= */
.thumb, .avatar {
    background: #2a3b55;
    border-radius: 50%; /* Standard rund */
    overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    color: #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    border: 2px solid rgba(255,255,255,0.1);
}

.thumb { width: 50px; height: 50px; border-radius: 12px; /* Thumbs eckiger */ }
.avatar { width: 40px; height: 40px; }
.avatar-big { width: 120px; height: 120px; font-size: 3rem; margin: 0 auto 15px; }

.thumb img, .avatar img { width: 100%; height: 100%; object-fit: cover; }

/* =========================================
   11. HEADER ROW (Standard Page Header)
   ========================================= */
.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--glass-border);
}
.header-row h1 { margin: 0; font-size: 1.5rem; text-align: left; }

/* =========================================
   12. HELPERS
   ========================================= */
.synced { color: #28a745; } 
.unsynced { color: #ffc107; }
.stats { font-weight: bold; color: #fff; }

/* Loading Spinner */
.spinner {
    animation: spin 1s infinite linear;
    display: inline-block;
}
@keyframes spin { 100% { transform: rotate(360deg); } }