/* ═══════════════════════════════════════════════════════════════
   Drixo Dashboard — Dark Gold Theme
   ═══════════════════════════════════════════════════════════════ */

/* ── CSS-Variablen Referenz ───────────────────────────────────────
   --bg-deep      #0f1117   Tiefstes Hintergrundlayer (Body-Hintergrund, volle Seite)
   --bg-surface   #1a1d26   Sidebar, Karten-Hintergrund, Panels
   --bg-raised    #252836   Eingabefelder, Hover-Zustand, aktive Nav-Items
   --gold         #f0a500   Primäre Akzentfarbe: Überschriften, Buttons, Badges, Links
   --gold-dim     #b07800   Gedimmtes Gold: Hover-Zustand von gold-Elementen
   --text         #e8eaf0   Haupttext: alle normalen Textinhalte
   --text-muted   #8b8fa8   Untertitel, Labels, Hilfstexte, Nav-Items (inaktiv)
   --border       #2d3149   Trennlinien, Input-Rahmen, Card-Borders
   --success      #00c851   Erfolgsmeldungen, aktive Toggles, grüne Badges
   --danger       #ff4444   Fehlermeldungen, Lösch-Buttons, rote Warnungen
   --info         #5865f2   Discord-Blau: Info-Hinweise, sekundäre Buttons
   ─────────────────────────────────────────────────────────────────
   Weitere Klassen-spezifische Farben (inline in site.css):
   --card-bg      (wird per JavaScript oder inline gesetzt) Card-Hintergrund einzelner Kacheln
   ─────────────────────────────────────────────────────────────────
*/

:root {
    --bg-deep:    #0f1117;   /* Body-Hintergrund — tiefstes Layer */
    --bg-surface: #1a1d26;   /* Sidebar, Cards, Panels */
    --bg-raised:  #252836;   /* Inputs, Hover, aktive Items */
    --gold:       #f0a500;   /* Primäre Akzentfarbe (Buttons, Badges, Links) */
    --gold-dim:   #b07800;   /* Hover-Zustand für gold-Elemente */
    --text:       #e8eaf0;   /* Normaler Fließtext */
    --text-muted: #8b8fa8;   /* Labels, Hilfstexte, inaktive Nav */
    --border:     #2d3149;   /* Trennlinien, Input-Rahmen */
    --success:    #00c851;   /* Erfolgsstatus, aktive Toggles */
    --danger:     #ff4444;   /* Fehler, Lösch-Aktionen */
    --info:       #5865f2;   /* Info-Hinweise, Discord-Blau */
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
    height: 100%;
    overflow-x: hidden;
}

body {
    background: var(--bg-deep);
    color: var(--text);
    font-family: 'Segoe UI', system-ui, sans-serif;
    font-size: 14px;
    min-height: 100vh;
    height: auto;
    overflow-y: auto;
    overflow-x: hidden;
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: 220px; height: 100vh;
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 0;
    z-index: 100;
}

.sidebar-logo {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    font-size: 18px;
    font-weight: 700;
    color: var(--gold);
    letter-spacing: 1px;
}

.sidebar-logo span { color: var(--text-muted); font-size: 11px; display: block; font-weight: 400; }

.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; overflow-x: hidden; max-height: calc(100vh - 120px); }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: var(--text-muted);
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: all 0.15s;
    font-size: 13px;
}

.nav-item:hover, .nav-item.active {
    color: var(--text);
    background: var(--bg-raised);
    border-left-color: var(--gold);
}

.nav-item .icon { font-size: 16px; width: 20px; text-align: center; }

.nav-section-label {
    padding: 12px 20px 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    opacity: 0.5;
}

.badge-danger  { background: rgba(255,68,68,.15); color: var(--danger); }

/* ── Sidebar Gruppen (details/summary) ───────────────────────── */
.nav-group { list-style: none; }

.nav-group-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    padding: 12px 20px 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    opacity: 0.6;
    transition: opacity 0.15s;
}
.nav-group-toggle:hover { opacity: 1; }
.nav-group-toggle::-webkit-details-marker { display: none; }

.nav-group-arrow {
    font-size: 14px;
    font-weight: 400;
    transition: transform 0.2s;
}
details[open] .nav-group-arrow { transform: rotate(90deg); }

.nav-sub {
    padding-left: 30px;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-muted);
}

/* ── Main Content ────────────────────────────────────────────── */
.main-content {
    margin-left: 220px;
    padding: 28px 32px;
    min-height: 100vh;
    overflow-y: visible;
    overflow-x: hidden;
}

.page-header {
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 16px;
}

.page-header h1 { font-size: 22px; font-weight: 600; color: var(--text); }
.page-header p  { color: var(--text-muted); margin-top: 4px; font-size: 13px; }

/* ── Cards ───────────────────────────────────────────────────── */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.card-title {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

/* ── Stat Cards ──────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--gold);
}

.stat-value  { font-size: 32px; font-weight: 700; color: var(--gold); }
.stat-label  { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.stat-icon   { font-size: 24px; float: right; opacity: 0.4; }

/* ── Status Badge ────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}
.badge-online  { background: rgba(0,200,81,.15);  color: var(--success); }
.badge-offline { background: rgba(255,68,68,.15); color: var(--danger); }
.badge-info    { background: rgba(88,101,242,.15); color: var(--info); }
.badge-gold    { background: rgba(240,165,0,.15); color: var(--gold); }

/* ── Table ───────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }
th {
    text-align: left;
    padding: 10px 12px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}
td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(45,49,73,.5);
    font-size: 13px;
    color: var(--text);
}
tr:hover td { background: var(--bg-raised); }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    border-radius: 6px;
    border: none;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}
.btn-gold    { background: var(--gold);   color: #000; }
.btn-gold:hover { background: #d4920a; }
.btn-primary { background: var(--gold); color: #000; }
.btn-primary:hover { background: #d4920a; }
.btn-success { background: rgba(67,181,129,.15); color: #43b581; border: 1px solid rgba(67,181,129,.3); }
.btn-success:hover { background: rgba(67,181,129,.25); }
.btn-danger  { background: rgba(255,68,68,.15); color: var(--danger); border: 1px solid rgba(255,68,68,.3); }
.btn-danger:hover { background: rgba(255,68,68,.25); }
.btn-ghost   { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--gold); }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ── Tab-Navigation ──────────────────────────────────────────── */
.tab-btn {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 8px 16px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    border-radius: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.tab-btn:hover  { color: var(--text); border-bottom-color: var(--border); }
.tab-btn.active { color: var(--gold); border-bottom-color: var(--gold); }

/* ── Forms ───────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
label       { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 6px; font-weight: 500; }
input[type="text"], input[type="password"], input[type="email"],
input[type="number"], textarea, select {
    width: 100%;
    background: var(--bg-deep);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 9px 12px;
    color: var(--text);
    font-size: 13px;
    outline: none;
    transition: border-color 0.15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--gold); }

/* ── Checkboxen (Dark Theme) ─────────────────────────────────── */
input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 17px;
    height: 17px;
    min-width: 17px;
    background: var(--bg-deep);
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    vertical-align: middle;
    position: relative;
    transition: background 0.15s, border-color 0.15s;
}
input[type="checkbox"]:checked {
    background: var(--gold);
    border-color: var(--gold);
}
input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    color: #000;
    font-size: 11px;
    font-weight: 800;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}
input[type="checkbox"]:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 2px rgba(240,165,0,0.2);
}

/* ── Alerts ──────────────────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.alert-success { background: rgba(0,200,81,.1); border: 1px solid rgba(0,200,81,.3); color: var(--success); }
.alert-danger  { background: rgba(255,68,68,.1); border: 1px solid rgba(255,68,68,.3); color: var(--danger); }

/* ── Log Levels ──────────────────────────────────────────────── */
.log-INFO  { color: var(--text-muted); }
.log-WARN  { color: #ffbb33; }
.log-ERROR { color: var(--danger); font-weight: 500; }

/* ── Login Page ──────────────────────────────────────────────── */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-deep);
}
.login-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 40px;
    width: 360px;
}
.login-logo {
    text-align: center;
    margin-bottom: 28px;
}
.login-logo h1 { font-size: 28px; color: var(--gold); font-weight: 700; }
.login-logo p  { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

/* ═══════════════════════════════════════════════════════════════
   Responsive Design
   ═══════════════════════════════════════════════════════════════ */

/* ── Hamburger-Button (nur mobil sichtbar) ─────────────────── */
.hamburger {
    display: none;
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 300;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    color: var(--gold);
    transition: background 0.15s;
    line-height: 1;
}
.hamburger:hover { background: var(--bg-raised); }

/* ── Sidebar-Overlay (Mobile-Abdunkelung) ──────────────────── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 140;
    backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

/* ── Tablet (769–1024px) ───────────────────────────────────── */
@media (max-width: 1024px) and (min-width: 769px) {
    .sidebar     { width: 200px; }
    .main-content { margin-left: 200px; padding: 22px 24px; }
    .stats-grid  { grid-template-columns: repeat(3, 1fr); }
}

/* ── Mobile (≤768px) ───────────────────────────────────────── */
@media (max-width: 768px) {
    .hamburger { display: flex; }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        z-index: 150;
        width: 240px;
    }
    .sidebar.open { transform: translateX(0); }

    .main-content {
        margin-left: 0;
        padding: 16px 16px 24px;
        padding-top: 68px;
    }

    .page-header h1 { font-size: 18px; }
    .page-header p  { font-size: 12px; }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    .stat-value { font-size: 26px; }

    .table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* AI-Chat volle Breite */
    #ai-chat {
        width: calc(100vw - 32px) !important;
        right: -8px !important;
        max-height: 65vh;
    }
    #ai-widget { right: 16px; bottom: 16px; }

    /* Login Card */
    .login-card { width: calc(100% - 32px); padding: 28px 20px; }

    /* Buttons in Formular-Footer stapeln */
    .card > form > [style*="display:flex"],
    .card [style*="justify-content:flex-end"] {
        flex-wrap: wrap;
    }
}

/* ── Small Mobile (≤480px) ─────────────────────────────────── */
@media (max-width: 480px) {
    .stats-grid   { grid-template-columns: 1fr; }
    .stat-value   { font-size: 22px; }
    .main-content { padding: 12px 12px 20px; padding-top: 64px; }
    .card         { padding: 14px; }
    .page-header h1 { font-size: 16px; }
    table { font-size: 12px; }
    th, td { padding: 8px 10px; }
}
