/* =========================================
   1. VARIABLES & RESET
   ========================================= */
:root {
    /* --- FARBPALETTE: WARM MINIMALISM --- */
    
    /* Hauptfarbe (Orange) */
    --primary: #F97316;       
    --primary-hover: #EA580C; 
    
    /* Hintergrund (Off-White) */
    --bg-body: #F8FAFC;       
    
    /* Glassmorphism Werte (Light Mode) */
    --glass-bg: rgba(255, 255, 255, 0.75); 
    --glass-border: rgba(0, 0, 0, 0.06); 
    --glass-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.1);
    
    /* Textfarben */
    --text-main: #0F172A;     /* Sehr dunkles Blau-Grau */
    --text-muted: #64748B;    /* Mittelgrau */
    
    /* Status */
    --error: #ef4444;
    --success: #10b981;
    
    /* Globale Werte */
    --radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Scrollbars im Body verhindern */
}

/* =========================================
   2. BACKGROUND ANIMATION
   ========================================= */
.background-anim {
    position: fixed;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    /* Zarter Verlauf: Hauch von Orange auf Hellgrau */
    background: radial-gradient(circle at 50% 50%, rgba(249, 115, 22, 0.08), transparent 60%);
    z-index: -1;
    animation: pulse 10s infinite alternate;
    pointer-events: none;
}

@keyframes pulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.1); }
}

/* =========================================
   3. GLASS COMPONENTS (Global)
   ========================================= */
.glass-panel, .glass-nav {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

/* =========================================
   4. NAVIGATION
   ========================================= */
.glass-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    margin: 1rem;
    border-radius: var(--radius);
    
    /* Wichtig für Dropdown Layering */
    position: relative;
    z-index: 1000;
    overflow: visible; 
}

.logo { font-weight: 700; font-size: 1.2rem; letter-spacing: -0.5px; color: var(--text-main); }
.logo span { color: var(--primary); }

.glass-nav ul { list-style: none; display: flex; gap: 20px; align-items: center;}
.glass-nav a { 
    text-decoration: none; 
    color: var(--text-muted); 
    transition: 0.2s; 
    font-size: 0.95rem;
    font-weight: 500;
}
.glass-nav a:hover, .glass-nav a.active { 
    color: var(--primary); 
    font-weight: 600;
}
.admin-link { color: #f43f5e !important; }

/* Mobile Nav Stack */
@media (max-width: 768px) {
    .glass-nav { flex-direction: column; gap: 1rem; }
    .glass-nav ul { flex-wrap: wrap; justify-content: center; }
}

/* =========================================
   5. DROPDOWN MENU
   ========================================= */
.dropdown {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
    cursor: pointer;
}

.arrow-down { font-size: 0.7em; margin-left: 5px; vertical-align: middle; }

.dropdown-menu {
    display: none !important; /* Standard: Versteckt */
    
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 240px;
    flex-direction: column;
    margin-top: 10px;
    padding: 0.5rem 0;
    
    background: #FFFFFF; /* Reines Weiß für Lesbarkeit */
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: 0 10px 40px -5px rgba(0,0,0,0.1);
    z-index: 2000; /* Über allem anderen */
}

/* Gap Fix: Unsichtbare Brücke */
.dropdown-menu::before {
    content: "";
    display: block;
    position: absolute;
    bottom: 100%;
    left: 0;
    width: 100%;
    height: 20px; /* Füllt die Lücke zum Button */
    background: transparent;
}

/* Hover Logik */
.dropdown:hover .dropdown-menu {
    display: flex !important;
}

.dropdown-menu li { width: 100%; display: block; }

.dropdown-menu a {
    display: block;
    width: 100%;
    padding: 12px 20px;
    border-radius: 0;
    color: var(--text-main);
}

.dropdown-menu a:hover {
    background: rgba(249, 115, 22, 0.08);
    color: var(--primary);
    padding-left: 25px; /* Kleiner Slide-Effekt */
}

/* =========================================
   6. CONTENT AREA
   ========================================= */
.content {
    flex: 1;
    margin: 0 1rem 1rem 1rem;
    padding: 3rem;
    border-radius: var(--radius);
    overflow-y: auto;
    position: relative;
    z-index: 1;
}

h2 { 
    margin-bottom: 1rem; 
    font-size: 1.8rem; 
    letter-spacing: -0.02em;
    background: linear-gradient(to right, var(--text-main), var(--primary)); 
    -webkit-background-clip: text; 
    -webkit-text-fill-color: transparent;
}

p { line-height: 1.7; color: var(--text-muted); margin-bottom: 1rem; max-width: 800px;}

/* =========================================
   7. FORMS & INPUTS
   ========================================= */
.login-container {
    margin: auto;
    padding: 3rem;
    border-radius: 16px;
    width: 100%;
    max-width: 420px;
    text-align: center;
}

.input-group {
    position: relative;
    width: 100%;
    margin: 15px 0;
}

input, select {
    width: 100%;
    padding: 12px 15px;
    border-radius: 8px;
    border: 1px solid #E2E8F0;
    background: white;
    color: var(--text-main);
    font-size: 1rem;
    outline: none;
    transition: 0.3s;
}

.input-group input { padding-right: 45px; margin: 0; }

input:focus, select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15);
}

/* Toggle Password Button */
.toggle-pwd {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    height: auto;
    width: 30px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.toggle-pwd:hover {
    color: var(--primary);
    transform: translateY(-50%) scale(1.1);
}
.toggle-pwd svg { width: 20px; height: 20px; stroke-width: 2; margin-top: -1px; }

button {
    width: 100%;
    padding: 12px;
    margin-top: 10px;
    border-radius: 8px;
    border: none;
    background: var(--primary);
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
    box-shadow: 0 4px 10px rgba(249, 115, 22, 0.3);
}

button:hover { background: var(--primary-hover); transform: translateY(-1px); }

/* Messages */
.error { color: var(--error); margin-bottom: 10px; background: rgba(239,68,68,0.1); padding: 10px; border-radius: 6px;}
.success { color: var(--success); margin-bottom: 10px; padding: 10px; background: rgba(16, 185, 129, 0.1); border-radius: 6px;}

/* =========================================
   8. ADMIN AREA
   ========================================= */
.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.file-card {
    background: white;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.2s, box-shadow 0.2s;
}

.file-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.05);
    border-color: var(--primary);
}

.file-info h4 { margin: 0 0 5px 0; color: var(--text-main); font-size: 1rem; }
.file-info small { color: var(--text-muted); font-family: monospace; font-size: 0.8rem; word-break: break-all;}

.btn-delete {
    background: rgba(239, 68, 68, 0.05);
    color: var(--error);
    border: 1px solid transparent;
    margin-top: 1rem;
    box-shadow: none;
}
.btn-delete:hover { background: var(--error); color: white; }

.admin-divider { border-top: 1px solid #E2E8F0; margin: 2rem 0; }

/* =========================================
   9. GAME OVERRIDES (Lesbarkeit)
   ========================================= */
/* Erzwingt helle Container für importierte Spiele */
.game-wrapper .panel, 
.game-wrapper .cardArea, 
.game-wrapper .zone,
.game-wrapper .feedback,
.game-wrapper .reviewItem {
    background: #FFFFFF !important;
    border: 1px solid #E2E8F0 !important;
    color: var(--text-main) !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05) !important;
}

/* Spielkarten */
.game-wrapper .card {
    background: #FFFFFF !important;
    border: 1px solid #E2E8F0 !important;
    color: var(--text-main) !important;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05) !important;
}
.game-wrapper .card:hover {
    border-color: var(--primary) !important;
}

/* Texte im Spiel */
.game-wrapper h1, .game-wrapper h2, .game-wrapper h3, .game-wrapper p, .game-wrapper li {
    color: var(--text-main);
}
.game-wrapper .sub, .game-wrapper small, .game-wrapper .hint {
    color: var(--text-muted) !important;
}

/* Spiel-Buttons */
.game-wrapper button {
    background: var(--primary) !important;
    color: white !important;
    border: none !important;
}
.game-wrapper button:disabled {
    background: #CBD5E1 !important; /* Grau deaktiviert */
    cursor: not-allowed;
}

/* --- Admin Image Gallery --- */
.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.image-card {
    background: white;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

.image-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.05);
    border-color: var(--primary);
}

.img-preview {
    width: 100%;
    height: 120px;
    background: #F8FAFC; /* Schachbrettmuster wäre optional, aber hellgrau reicht */
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid #E2E8F0;
}

.img-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.img-actions {
    padding: 10px;
    text-align: center;
}

.img-name {
    font-size: 0.8rem;
    color: var(--text-main);
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

/* Button zum Kopieren des Pfades */
.btn-copy {
    background: #F1F5F9;
    color: var(--text-muted);
    font-size: 0.75rem;
    padding: 4px 8px;
    margin-bottom: 6px;
    border: 1px solid #E2E8F0;
    width: 100%;
    box-shadow: none;
}
.btn-copy:hover {
    background: white;
    border-color: var(--primary);
    color: var(--primary);
    transform: none;
}

/* Kleiner Delete Button für Bilder */
.btn-img-delete {
    background: transparent;
    color: var(--error);
    font-size: 0.75rem;
    padding: 4px;
    margin: 0;
    width: auto;
    display: inline-block;
    box-shadow: none;
    text-decoration: underline;
}
.btn-img-delete:hover {
    background: transparent;
    color: #b91c1c;
}

/* --- FileManager Erweiterung --- */

/* Ordner Karte */
.folder-card {
    background: #F1F5F9; /* Hellgrau */
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    text-align: center;
    transition: 0.2s;
    text-decoration: none;
    color: var(--text-main);
    min-height: 140px;
    position: relative;
}

.folder-card:hover {
    background: white;
    border-color: var(--primary);
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.folder-icon {
    font-size: 2.5rem;
    color: #94a3b8;
    margin-bottom: 10px;
}
.folder-card:hover .folder-icon { color: var(--primary); }

.folder-name { font-weight: 600; font-size: 0.9rem; word-break: break-word;}

/* Wrapper für Ordner und Löschbutton */
.folder-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Der Lösch-Button (Standardmäßig unsichtbar) */
.btn-folder-delete {
    position: absolute;
    top: -8px; 
    right: -8px;
    background: white; /* Weißer Hintergrund damit man das X sieht */
    border: 1px solid var(--error);
    border-radius: 50%;
    color: var(--error);
    font-size: 1.2rem;
    line-height: 1;
    width: 24px;
    height: 24px;
    cursor: pointer;
    opacity: 0; /* Unsichtbar */
    transition: all 0.2s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

/* WICHTIG: Wenn man über den Wrapper fährt, wird der Button sichtbar */
.folder-wrapper:hover .btn-folder-delete {
    opacity: 1;
    top: -10px; /* Kleiner Animationseffekt nach oben */
}

.btn-folder-delete:hover {
    background: var(--error);
    color: white;
}

/* Breadcrumb Navigation */
.breadcrumb {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 1rem;
    font-size: 1rem;
    color: var(--text-muted);
}
.breadcrumb a { color: var(--primary); text-decoration: none; font-weight: 600; }
.breadcrumb span { color: var(--text-muted); }