/* --- Reset und Basis --- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; font-family: Arial, sans-serif; background: #121212; color: #fff; }

/* === ADMIN GRID LAYOUT === */
.admin-grid {
    display: grid;
    grid-template-areas:
        "header header"
        "sidebar content"
        "footer footer";
    grid-template-columns: 250px 1fr;
    grid-template-rows: 64px 1fr auto;
    min-height: 100vh;
}

/* Bereiche platzieren */
.header  { grid-area: header; position: sticky; top: 0; z-index: 2000; }
.sidebar { grid-area: sidebar; }
.admin-content { grid-area: content; padding: 36px 32px 40px 32px; min-height: 0; }
.footer  { grid-area: footer; background: #333; color: #fff; text-align: center; padding: 10px 0; font-size: 1.1em; }

/* === SIDEBAR === */
.sidebar {
    background: #1e1e1e;
    padding: 22px 0 0 0;
    box-shadow: 1px 0 4px rgba(0,0,0,0.07);
    z-index: 1100;
    display: flex;
    flex-direction: column;
    height: 100%;
}
.sidebar h2 { color: #4CAF50; font-size: 1.4em; margin: 1em 0; text-align: center; }
.sidebar ul { list-style: none; margin: 0; padding: 0 0 0 20px; }
.sidebar ul li { margin-bottom: 16px; }
.sidebar ul li a { color: #8ED6FB; text-decoration: none; font-size: 1.12em; transition: color 0.2s; }
.sidebar ul li a:hover { color: #4CAF50; }
.sidebar-logo img { display: block; margin: 0 auto 1.5em auto; max-width: 120px; border-radius: 12px; box-shadow: 0 0 12px rgba(0,0,0,0.15); }

/* === HEADER (Grid-Innenstruktur!) === */
.header {
    grid-area: header;
    background: #222;
    display: grid;
    align-items: center;
    grid-template-columns: auto 1fr auto;
    height: 64px;
    box-sizing: border-box;
    padding: 0 24px;
    column-gap: 36px;
}
.header-left { display: flex; align-items: center; gap: 18px; }
.logo-text { font-size: 2rem; font-weight: bold; letter-spacing: 2px; }
.header-center { display: flex; justify-content: center; gap: 32px; }
.header-center a { color: white; text-decoration: none; font-size: 1.08em; transition: color 0.2s; }
.header-center a:hover { color: #4CAF50; }
.header-right { display: flex; align-items: center; gap: 18px; justify-self: end; }
.search-bar input {
    background: #333; color: #fff; border: none; padding: 8px; border-radius: 5px; font-size: 15px; width: 170px;
}
.logout-btn {
    background: #d9534f; color: #fff; border: none; padding: 10px 16px; border-radius: 6px;
    cursor: pointer; font-size: 16px; margin-left: 10px; text-decoration: none; display: inline-block;
}
.logout-btn:hover { background: #c9302c; }
.sidebar-toggle { 
    background: none; color: #fff; border: none; font-size: 2.2rem; cursor: pointer; display: inline-block; margin-right: 0;
}

/* === CARDS & CONTENT === */
.dashboard-content, .mitarbeiter_content, .vpn_wireguard, .passwort_reset_single {
    margin-top: 20px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}
.card {
    background: #222; padding: 20px; border-radius: 5px; box-shadow: 0 1px 7px #000a;
    display: flex; flex-direction: column; justify-content: flex-start; min-height: 170px; margin-bottom: 10px;
}
.card .btn { margin-top: auto; width: fit-content; }
.status-container { display: flex; justify-content: space-between; }
.btn { background-color: #4CAF50; color: white; border: none; padding: 10px 15px; cursor: pointer; border-radius: 5px; font-size: 1em; text-decoration: none; display: inline-block; }
.btn:hover { background-color: #45a049; }

/* === HAMBURGER-MENÜ (Sidebar) === */
@media (max-width: 900px) {
    .admin-grid {
        grid-template-areas:
            "header header"
            "sidebar content"
            "footer footer";
        grid-template-columns: 70px 1fr;
    }

    .sidebar {
        transform: translateX(-100%);               /* off-canvas per Default */
        transition: transform 0.3s cubic-bezier(.4,0,.2,1);
        min-width: 60px;
        padding: 10px 0 0 0;
        position: fixed;
        left: 0; top: 0;
        height: 100vh;
        z-index: 1200;
    }
    .sidebar.open {                                  /* FIX: Klasse, die JS toggelt */
        transform: translateX(0);
        box-shadow: 2px 0 20px #000b;
    }

    .sidebar-toggle { display: block; }

    .dashboard-content, .benutzerverwaltung_content, .vpn_wireguard, .passwort_reset_single {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    .header { padding: 0 10px; column-gap: 12px; }
}

@media (max-width: 600px) {
    .admin-grid {
        grid-template-areas:
            "header"
            "sidebar"
            "content"
            "footer";
        grid-template-columns: 1fr;
        grid-template-rows: 64px auto 1fr auto;
    }

    .sidebar {
        position: static;
        width: 100%;
        min-width: 0;
        box-shadow: none;
        padding: 10px 0;
        height: auto;

        transform: none !important; /* FIX: Off-canvas zurücksetzen im Stack-Layout */
    }
    .sidebar.open { transform: none !important; }    /* FIX: Sicherheit */

    .dashboard-content, .mitarbeiter_content, .vpn_wireguard, .passwort_reset_single {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .header {
        grid-template-columns: 1fr;
        row-gap: 14px;
        padding: 8px 4vw;
        height: auto;
    }
    .header-left, .header-center, .header-right {
        justify-content: center;
        margin-bottom: 4px;
    }
}

/* 404-Card */
.error-404-card {
    max-width: 520px;
    margin: 60px auto 0 auto;
    background: #191c20; color: #fff; padding: 42px 38px 36px 38px;
    border-radius: 18px; box-shadow: 0 4px 30px rgba(0,0,0,0.24);
    text-align: center; min-height: 320px;
}

.console-box {
    background-color: #1e1e1e; padding: 20px; border-radius: 10px; margin-top: 30px;
    color: #0f0; font-family: monospace; box-shadow: 0 0 10px rgba(0,255,0,0.2);
}

.console-placeholder {
    background-color: #000; color: #f55; padding: 40px; text-align: center;
    border-radius: 10px; font-family: monospace; font-size: 1.2em;
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.2);
}

.shell-iframe {
    width: 100%; height: 600px; border: none; border-radius: 8px;
    box-shadow: 0 0 8px rgba(0, 255, 0, 0.25); background-color: #000;
}

.pihole-wrapper { width: 100%; height: 100%; padding: 0; margin: 0; box-sizing: border-box; }
.pihole-iframe   { width: 100%; height: 80vh; border: none; border-radius: 8px; box-shadow: 0 0 10px rgba(0,255,255,0.2); }
