/**
 * app.css
 *
 * @description Stylesheet des DNS Panel (gleiche Optik wie das Admin-Dashboard-Projekt,
 *              eigenständig, whitelabel-fähig).
 */

:root {
    --bg: #f4f6f9;
    --sidebar: #343a40;
    --sidebar-active: #007bff;
    --sidebar-text: #c2c7d0;
    --topbar: #ffffff;
    --card: #ffffff;
    --border: #dee2e6;
    --text: #212529;
    --muted: #6c757d;
    --primary: #007bff;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --radius: 6px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Layout ---- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
    width: 250px;
    background: var(--sidebar);
    color: var(--sidebar-text);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}
.brand {
    padding: 16px 20px;
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,.1);
    letter-spacing: .3px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.brand-logo { max-width: 32px; max-height: 32px; border-radius: 4px; flex-shrink: 0; }
.menu { padding: 10px 0; }
.menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 20px;
    color: var(--sidebar-text);
    border-left: 3px solid transparent;
}
.menu a:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.menu a.active { background: rgba(0,0,0,.2); color: #fff; border-left-color: var(--sidebar-active); }
.menu a .ico { width: 20px; text-align: center; font-size: 15px; }
.menu-sep {
    padding: 14px 20px 6px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: #7a828a;
}
.menu-group {
    padding: 8px 20px 4px;
    font-size: 12px;
    font-weight: 600;
    color: #9aa0a6;
}
.menu a.sub { padding-left: 34px; font-size: 13px; }
.menu-toggle {
    display: flex; align-items: center; justify-content: space-between;
    width: 100%; background: none; border: none; cursor: pointer;
    font-family: inherit; text-align: left;
}
.menu-toggle:hover { color: #fff; }
.menu-toggle .chev { transition: transform .15s; font-size: 10px; }
.menu-toggle[aria-expanded="false"] .chev { transform: rotate(-90deg); }
.menu-section.collapsed { display: none; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
    background: var(--topbar);
    border-bottom: 1px solid var(--border);
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
}
.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar-title { font-size: 18px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-user { display: flex; align-items: center; gap: 14px; color: var(--muted); }
.hamburger {
    display: inline-flex;
    align-items: center; justify-content: center;
    width: 40px; height: 40px; flex-shrink: 0;
    background: none; border: none; cursor: pointer;
    font-size: 22px; line-height: 1; color: var(--text);
}
.sidebar-overlay { display: none; }
@media (min-width: 769px) {
    html.sidebar-collapsed .sidebar { display: none; }
}
.content { padding: 22px; flex: 1; }
.footer { padding: 12px 22px; color: var(--muted); border-top: 1px solid var(--border); font-size: 13px; }

/* ---- Impersonation-Banner ---- */
.impersonate-banner {
    background: #fff3cd; color: #856404; border-bottom: 1px solid #ffeeba;
    padding: 8px 20px; display: flex; align-items: center; justify-content: space-between;
    gap: 12px; font-size: 13px; flex-wrap: wrap;
}

/* ---- Karten ---- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 18px;
}
.card h2, .card h3 { margin-top: 0; }
.card-link { display: block; color: var(--text); }
.card-link:hover { text-decoration: none; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.card-link .ico { font-size: 26px; }
.card-title { font-weight: 600; margin: 8px 0 4px; }
.card-desc { color: var(--muted); font-size: 13px; }

/* ---- Tabellen ---- */
.table { width: 100%; border-collapse: collapse; background: var(--card); }
.table th, .table td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.table th { background: #f8f9fa; font-weight: 600; font-size: 13px; }
.table tr:hover td { background: #fafbfc; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---- Buttons ---- */
.btn {
    display: inline-block;
    padding: 8px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--primary);
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.2;
}
.btn:hover { filter: brightness(.94); text-decoration: none; color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-secondary { background: #6c757d; border-color: #6c757d; }
.btn-danger { background: var(--danger); border-color: var(--danger); }
.btn-success { background: var(--success); border-color: var(--success); }
.btn-outline { background: transparent; color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.iconbtn {
    background: none; border: none; cursor: pointer;
    color: var(--primary); font-size: 16px; padding: 2px 4px;
    line-height: 1; vertical-align: middle;
}
.iconbtn:hover { filter: brightness(.8); }

/* ---- Formulare ---- */
.form-group { margin-bottom: 14px; max-width: 520px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: 600; font-size: 13px; }
.form-control {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(0,123,255,.15); }
.form-hint { color: var(--muted); font-size: 12px; margin-top: 4px; }
.form-check { display: flex; align-items: center; gap: 8px; }
.form-check input { width: auto; }
.repeat-row { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.repeat-row input { flex: 1 1 auto; }

/* ---- Badges & Alerts ---- */
.badge { display: inline-block; padding: 3px 9px; border-radius: 12px; font-size: 12px; font-weight: 600; color: #fff; }
.badge-online { background: var(--success); }
.badge-offline { background: var(--danger); }
.badge-muted { background: #adb5bd; }
.badge-warn { background: #ffc107; color: #5c4700; }

.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; border: 1px solid transparent; }
.alert-success { background: #d4edda; color: #155724; border-color: #c3e6cb; }
.alert-danger  { background: #f8d7da; color: #721c24; border-color: #f5c6cb; }
.alert-info    { background: #d1ecf1; color: #0c5460; border-color: #bee5eb; }
.alert-warning { background: #fff3cd; color: #856404; border-color: #ffeeba; }

.page-actions { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.text-muted { color: var(--muted); }
.mono { font-family: Consolas, "Courier New", monospace; font-size: 13px; }

/* ---- Listen: Pagination/Suche (Domainliste, Nameserverliste) ---- */
.lv-toolbar { display: flex; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 10px; flex-wrap: wrap; }
.lv-pager { display: flex; gap: 6px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.lv-per { width: auto; font-size: 12px; padding: 2px 6px; }
.lv-pnav { display: inline-flex; gap: 3px; align-items: center; }
.lv-pdis { opacity: .4; cursor: default; }

/* ---- Aktions-Dropdown (Domainliste) ---- */
.action-dd { position: relative; display: inline-block; }
.action-dd .dd-menu {
    display: none; position: absolute; right: 0; top: calc(100% + 2px); z-index: 50;
    background: #fff; border: 1px solid var(--border); border-radius: 6px;
    min-width: 160px; box-shadow: 0 6px 18px rgba(0,0,0,.12); overflow: hidden;
}
.action-dd .dd-menu.show { display: block; }
.action-dd .dd-menu a { display: block; padding: 8px 12px; color: var(--text); font-size: 13px; }
.action-dd .dd-menu a:hover { background: #f0f4f8; text-decoration: none; }

/* ---- Nameserver-Records: Inline-Edit ---- */
tr.rec-row .rec-edit { display: none; }
tr.rec-row.editing .rec-view { display: none; }
tr.rec-row.editing .rec-edit { display: block; }
.rec-edit input.form-control, .rec-edit select.form-control { padding: 4px 6px; font-size: 13px; margin: 0; max-width: none; }
td.rec-actions form { display: inline-block; margin: 0; }

/* ---- Login ---- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--sidebar); }
.login-box { background: #fff; padding: 32px; border-radius: 8px; width: 340px; box-shadow: 0 8px 30px rgba(0,0,0,.25); }
.login-box h1 { margin: 0 0 4px; font-size: 22px; text-align: center; }
.login-box .login-logo { display: block; max-width: 120px; max-height: 80px; margin: 0 auto 12px; }
.login-box .sub { text-align: center; color: var(--muted); margin-bottom: 22px; font-size: 13px; }

@media (max-width: 768px) {
    .hamburger { display: inline-flex; }
    .sidebar {
        position: fixed; top: 0; left: 0; bottom: 0; z-index: 1000;
        width: 250px; max-width: 82vw;
        transform: translateX(-100%);
        transition: transform .25s ease;
        box-shadow: 2px 0 14px rgba(0, 0, 0, .35);
        overflow-y: auto;
    }
    body.sidebar-open .sidebar { transform: translateX(0); }
    .sidebar-overlay {
        display: block;
        position: fixed; inset: 0; z-index: 999;
        background: rgba(0, 0, 0, .45);
        opacity: 0; visibility: hidden; transition: opacity .25s ease;
    }
    body.sidebar-open .sidebar-overlay { opacity: 1; visibility: visible; }
    body.sidebar-open { overflow: hidden; }

    .topbar { padding: 0 12px; }
    .topbar-user span { display: none; }
    .content { padding: 16px 14px; }
    .cards { grid-template-columns: 1fr; }
    .card { overflow-x: auto; }
}
