/* Lokaltinget dashboard — stylesheet
 * Bevidst konservativ — funktion frem for flair.
 */

:root {
    --bg:       #f7f7f8;
    --surface:  #ffffff;
    --border:   #e4e4e7;
    --text:     #18181b;
    --text-muted:#71717a;
    --primary:  #0f766e;
    --primary-fg:#ffffff;
    --success:  #16a34a;
    --warn:     #d97706;
    --error:    #dc2626;
    --info:     #2563eb;
    --radius:   6px;
    --shadow:   0 1px 2px rgba(0,0,0,0.04);
    --font:     -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --mono:     ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body {
    margin: 0; padding: 0;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

code, pre { font-family: var(--mono); font-size: 0.9em; }
code { background: #f4f4f5; padding: 1px 5px; border-radius: 4px; }

h1 { font-size: 24px; margin: 0 0 20px; font-weight: 600; }
h2 { font-size: 18px; margin: 32px 0 12px; font-weight: 600; }

.muted { color: var(--text-muted); font-size: 0.92em; }

/* ---------- Top bar ---------- */
.topbar {
    display: flex; align-items: center; gap: 24px;
    padding: 0 24px; height: 56px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 10;
}
.topbar__brand a {
    color: var(--text); font-weight: 600; font-size: 16px;
    display: flex; align-items: center; gap: 8px;
}
.topbar__brand a:hover { text-decoration: none; }
.topbar__brand .mark { color: var(--primary); }
.topbar__env {
    font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px;
    padding: 2px 6px; margin-left: 8px;
    background: #f4f4f5; border-radius: 3px; color: var(--text-muted);
}
.topbar__nav { flex: 1; overflow: visible; }
.topbar__user { display: flex; align-items: center; gap: 12px; }

/* ---------- Primary nav (grouped dropdowns) ---------- */
.nav--primary {
    display: flex; list-style: none; margin: 0; padding: 0; gap: 2px;
}
.nav__item > a,
.nav__dropdown-toggle {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 14px; color: var(--text-muted);
    border-radius: var(--radius); font-weight: 500;
    background: none; border: none; cursor: pointer;
    font-size: inherit; font-family: inherit;
    white-space: nowrap;
}
.nav__item > a:hover,
.nav__dropdown-toggle:hover { background: #f4f4f5; color: var(--text); text-decoration: none; }
.nav__item.is-active > a,
.nav__item--dropdown.is-active > .nav__dropdown-toggle { background: #e4e4e7; color: var(--text); }

.nav__arrow { margin-left: 2px; transition: transform 0.15s; }
.nav__item--dropdown.is-open .nav__arrow { transform: rotate(180deg); }

/* Dropdown menu — ren CSS, hover-baseret, ingen JS */
.nav__item--dropdown { position: relative; }
.nav__dropdown {
    display: none;
    position: absolute; top: 100%; left: 0;
    background: #fff; border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    list-style: none; margin: 0; padding: 4px 0;
    min-width: 180px; z-index: 100;
}
.nav__item--dropdown:hover .nav__dropdown,
.nav__item--dropdown:focus-within .nav__dropdown { display: block; }
.nav__dropdown li a {
    display: block; padding: 8px 16px; color: var(--text-muted);
    font-weight: 400; white-space: nowrap;
}
.nav__dropdown li a:hover { background: #f4f4f5; color: var(--text); text-decoration: none; }
.nav__dropdown li.is-active a { color: var(--primary); font-weight: 600; }

.subnav {
    display: flex; gap: 2px; margin: -8px 0 24px;
    border-bottom: 1px solid var(--border);
}
.subnav a {
    padding: 8px 16px; color: var(--text-muted);
    border-bottom: 2px solid transparent;
    font-weight: 500;
}
.subnav a:hover { color: var(--text); text-decoration: none; }
.subnav a.is-active { color: var(--primary); border-bottom-color: var(--primary); }

/* ---------- Main layout ---------- */
.app-main { padding: 32px 24px; min-height: calc(100vh - 112px); }
.container { max-width: 1280px; margin: 0 auto; }

.app-footer {
    padding: 16px 24px; text-align: center;
    color: var(--text-muted); font-size: 12px;
    border-top: 1px solid var(--border); background: var(--surface);
}

/* ---------- Cards ---------- */
.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px; margin-bottom: 20px;
    box-shadow: var(--shadow);
}
.card h2 { margin-top: 0; }
.card-warn { border-left: 3px solid var(--warn); }
.card-error { border-left: 3px solid var(--error); }

/* ---------- Stats grid ---------- */
.stat-grid {
    display: grid; gap: 12px; margin-bottom: 28px;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.stat {
    background: var(--surface); padding: 16px 20px;
    border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.stat-link { transition: border-color 0.15s; display: block; color: var(--text); }
.stat-link:hover { border-color: var(--primary); text-decoration: none; }
.stat-num { font-size: 28px; font-weight: 600; line-height: 1.1; }
.stat-label { color: var(--text-muted); font-size: 12px; margin-top: 4px; }

/* ---------- Tables ---------- */
.data-table {
    width: 100%; border-collapse: collapse; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius);
    overflow: hidden; box-shadow: var(--shadow);
}
.data-table th, .data-table td {
    padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border);
    vertical-align: top;
}
.data-table th {
    background: #fafafa; font-weight: 600; font-size: 12px;
    text-transform: uppercase; letter-spacing: 0.3px; color: var(--text-muted);
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: #fafafa; }
.data-table tr.is-muted { opacity: 0.55; }

/* ---------- Badges ---------- */
.badge {
    display: inline-block; padding: 2px 8px; font-size: 11px; font-weight: 500;
    border-radius: 9999px; background: #f4f4f5; color: var(--text-muted);
    text-transform: lowercase; letter-spacing: 0.2px;
}
.badge-success { background: #dcfce7; color: #15803d; }
.badge-warn    { background: #fef3c7; color: #b45309; }
.badge-error   { background: #fee2e2; color: #b91c1c; }
.badge-info    { background: #dbeafe; color: #1d4ed8; }

/* ---------- Forms & buttons ---------- */
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], textarea, select {
    width: 100%; padding: 8px 10px; border: 1px solid var(--border);
    border-radius: var(--radius); font-family: inherit; font-size: inherit;
    background: var(--surface); color: var(--text);
}
input:focus, textarea:focus, select:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
}
label { display: block; margin-bottom: 12px; font-weight: 500; font-size: 13px; }
label input, label textarea, label select { margin-top: 4px; font-weight: normal; }

.btn {
    display: inline-block; padding: 8px 16px; border-radius: var(--radius);
    border: 1px solid var(--border); background: var(--surface); color: var(--text);
    font-family: inherit; font-size: 14px; font-weight: 500; cursor: pointer;
    text-decoration: none; transition: background 0.1s, border-color 0.1s;
}
.btn:hover { background: #f4f4f5; text-decoration: none; }
.btn-primary {
    background: var(--primary); border-color: var(--primary); color: var(--primary-fg);
}
.btn-primary:hover { background: #0d5f58; border-color: #0d5f58; }
.btn-ghost { border-color: transparent; background: transparent; }

.actions { margin: 16px 0; display: flex; gap: 8px; }

/* ---------- Alerts ---------- */
.alert {
    padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px;
    border: 1px solid var(--border);
}
.alert-success { background: #f0fdf4; border-color: #bbf7d0; color: #15803d; }
.alert-error   { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.alert-warn    { background: #fffbeb; border-color: #fde68a; color: #92400e; }

/* ---------- Login screen ---------- */
.login-screen {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: var(--bg);
}
.login-card {
    background: var(--surface); padding: 40px; border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.06); width: 380px; max-width: 90vw;
}
.login-card h1 {
    margin-top: 0; font-size: 22px; display: flex; align-items: center; gap: 8px;
}
.login-card .mark { color: var(--primary); }
.login-card .btn-primary { width: 100%; margin-top: 12px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .topbar { flex-wrap: wrap; height: auto; padding: 8px 16px; }
    .topbar__nav { width: 100%; order: 3; padding: 4px 0; }
    .data-table { font-size: 12px; }
    .data-table th, .data-table td { padding: 6px 8px; }
}

/* ---------- F002 users-modul: form-strukturer ---------- */
.form-fieldset {
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 16px;
    background: var(--surface, #fff);
}
.form-fieldset legend {
    font-weight: 600;
    padding: 0 8px;
    font-size: 14px;
    color: var(--text, #222);
}
.form-fieldset label.checkbox-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 6px;
    font-weight: normal;
}
.form-fieldset label.checkbox-row input[type="checkbox"] {
    margin-top: 0;
    flex-shrink: 0;
}
.form-error {
    color: #b00020;
    font-size: 13px;
    margin: -8px 0 12px 0;
}
.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    align-items: center;
}
.danger-zone {
    margin-top: 32px;
    padding: 16px 20px;
    border: 1px solid #f1c0c5;
    border-radius: 8px;
    background: #fff8f8;
}
.danger-zone h2 {
    margin-top: 0;
    font-size: 16px;
}
.row-highlight {
    background: #fff8d6;
}
dialog {
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 8px;
    padding: 24px;
    max-width: 480px;
    width: 90vw;
}
dialog::backdrop {
    background: rgba(0, 0, 0, 0.4);
}

/* ---------- F003 areas-modul: keyword-editor ---------- */
.keyword-editor {
    margin-top: 24px;
    padding: 16px 20px;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 8px;
    background: var(--surface, #fff);
}
.keyword-editor h2 {
    margin-top: 0;
    font-size: 16px;
}
.keyword-editor h3 {
    margin-top: 24px;
    font-size: 14px;
}
.data-table--compact th,
.data-table--compact td {
    padding: 6px 8px;
    font-size: 13px;
}
.data-table--compact input[type="text"],
.data-table--compact input[type="number"] {
    margin: 0;
    width: 100%;
}
.keyword-add-form {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 12px 16px;
    align-items: end;
}
.keyword-add-form .form-actions {
    grid-column: 1 / -1;
    margin-top: 8px;
}
