/* ── Base ───────────────────────────────────────────────────────────── */

body {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
    font-size: 0.9rem;
}

/* ── Header & Nav ───────────────────────────────────────────────────── */

header {
    padding: 0.75rem 0 0;
    border-bottom: 1px solid #333;
    margin-bottom: 0;
}

header h1 {
    font-size: 1.4rem;
    margin: 0 0 0.5rem;
    white-space: nowrap;
    color: #ccc;
}

nav {
    margin-bottom: -1px;
}

nav ul {
    display: flex;
    gap: 0.25rem;
    list-style: none;
    margin: 0;
    padding: 0;
    align-items: center;
}

nav ul li a {
    display: block;
    padding: 0.35rem 0.75rem;
    border-radius: 4px;
    font-size: 0.9rem;
    text-decoration: none;
    color: #aaa;
}

nav ul li a:hover,
nav ul li a.active {
    background: #1a1a2e;
    color: #fff;
}

main {
    padding: 1.5rem 0;
}

/* ── Components ─────────────────────────────────────────────────────── */

.card {
    border: 1px solid #333;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}

.card-centered {
    max-width: 680px;
    margin: 0 auto;
}

.card-narrow {
    max-width: 560px;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 0.75rem;
}

.card-header h3 {
    margin: 0;
}

/* ── Buttons ────────────────────────────────────────────────────────── */

.btn-sm   { padding: 3px 10px; font-size: 0.85em; margin-bottom: 0; }
.btn-icon { padding: 4px 7px; line-height: 1; border-radius: 4px; cursor: pointer; margin: 0 !important; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-muted); display: inline-flex; align-items: center; }
.btn-danger { background: #c0392b; color: white; border: none; cursor: pointer; border-radius: 4px; }
.btn-stop   { color: #e67e22; }

/* ── Layout utilities ───────────────────────────────────────────────── */

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.grid-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem 2rem;
    margin-top: 0.5rem;
}

.flex-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.flex-col {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.flex-col form {
    margin: 0;
}

.actions-col {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 200px;
}

.actions-col form {
    margin: 0;
}

.actions-col button {
    width: 100%;
}

.backup-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
}

.backup-actions form {
    margin: 0;
}

/* ── Spacing ────────────────────────────────────────────────────────── */

.mb-0  { margin-bottom: 0; }
.mb-sm { margin-bottom: 0.35rem; }
.mb-md { margin-bottom: 0.75rem; }
.mt-0  { margin-top: 0; }
.mt-sm { margin-top: 0.5rem; }
.mt-md { margin-top: 0.75rem; }
.mt-lg { margin-top: 1rem; }
.mt-xl { margin-top: 1.5rem; }

/* ── Text utilities ─────────────────────────────────────────────────── */

.text-muted   { color: #aaa; }
.text-dim     { color: #555; }
.text-sm      { font-size: 0.85em; }
.text-xs      { font-size: 0.8em; }
.text-tiny    { font-size: 0.72em; }
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.text-mono    { font-family: monospace; font-size: 0.9em; }
.text-bold    { font-weight: bold; }
.text-nowrap  { white-space: nowrap; }

/* ── Status / Color ─────────────────────────────────────────────────── */

.status-ok   { color: green; font-weight: bold; }
.text-ok     { color: green; }
.text-warn   { color: #e67e22; }
.text-error  { color: #c0392b; }
.text-yellow { color: #f1c40f; }

.dot-ok      { color: green; }
.dot-stopped { color: #999; }
.dot-unknown { color: #555; }
.dot-error   { color: #c0392b; }

.mt-xs { margin-top: 0.35rem; }

.badge {
    display: inline-block;
    font-size: 0.75rem;
    padding: 0.1rem 0.45rem;
    border-radius: 4px;
    font-weight: 600;
}
.badge-ok    { background: #1a4a2a; color: #5fd97a; }
.badge-error { background: #4a1a1a; color: #f08080; }
.badge-warn  { background: #4a3a00; color: #f0c040; }
.badge-muted { background: #333;    color: #aaa; }

.test-log {
    font-size: 0.72rem;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 300px;
    overflow-y: auto;
    margin: 0.5rem 0 0;
    padding: 0.5rem;
    background: var(--pico-code-background, #111);
    border-radius: 4px;
}

.status-pill {
    display: inline-block;
    font-size: 0.75rem;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    font-weight: 500;
    white-space: nowrap;
}
.status-pill--entwicklung { background: #2d4a6e; color: #7bb3f0; }
.status-pill--beta        { background: #4a3a00; color: #f0c040; }
.status-pill--produktiv   { background: #1a4a2a; color: #5fd97a; }
.status-pill--archiviert  { background: #333;    color: #888; }

/* ── Page header ────────────────────────────────────────────────────── */

.back-link {
    margin-bottom: 1rem;
}

.back-link a {
    font-size: 0.85em;
    color: #aaa;
}

.page-title {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.page-title h2 {
    margin: 0;
}

.section-count {
    font-size: 0.8rem;
    font-weight: normal;
    color: #aaa;
    margin-left: 8px;
}

/* ── Tables ─────────────────────────────────────────────────────────── */

.table-sm  { font-size: 0.9em; }
.table-xs  { font-size: 0.85em; width: 100%; }
.table-xxs { font-size: 0.82em; margin-top: 0.5rem; width: 100%; }

td.label {
    color: #aaa;
    padding-right: 1.5rem;
}

/* ── Links ──────────────────────────────────────────────────────────── */

.heading-link {
    text-decoration: none;
    color: inherit;
}

/* ── Forms ──────────────────────────────────────────────────────────── */

.form-wide   { width: 400px; }
.form-options { margin-top: 1rem; }

/* ── Dashboard: project list ────────────────────────────────────────── */

.project-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0.35rem;
}

.project-row a {
    font-size: 0.9em;
}

.project-type {
    font-size: 0.8em;
    color: #555;
}

/* ── Dashboard: monitoring card ─────────────────────────────────────── */

.mon-row {
    display: flex;
    align-items: center;
    margin-bottom: 0.3rem;
    font-size: 0.85em;
}

.mon-dot {
    width: 14px;
    flex-shrink: 0;
}

.mon-name {
    flex: 1;
    color: #aaa;
    padding-left: 6px;
}

.mon-ms {
    min-width: 70px;
    text-align: right;
}

.mon-footer {
    margin-top: 0.5rem;
    font-size: 0.72em;
    color: #555;
    text-align: center;
}

.ms-ok     { color: #555; }
.ms-warn   { color: #f1c40f; }
.ms-orange { color: #e67e22; }
.ms-error  { color: #c0392b; }

/* ── Dashboard: backup card ─────────────────────────────────────────── */

.backup-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0.4rem;
    font-size: 0.85em;
}

.backup-name {
    color: #aaa;
    min-width: 120px;
}

/* ── Monitoring: history dots ───────────────────────────────────────── */

.history-dots {
    letter-spacing: -1px;
    margin-bottom: 0.4rem;
}

/* ── Sizing / Spacing helpers ────────────────────────────────────────── */

.w-full { width: 100%; }
.ml-xs  { margin-left: 4px; }
.p-0    { padding: 0; }
.va-mid { vertical-align: middle; }
.col-actions-narrow { display: flex; flex-direction: column; gap: 0.5rem; width: 80px; }
.col-actions-narrow form { margin: 0; }
.col-actions-narrow button { width: 100%; }

.row-actions { display: flex; gap: 0.25rem; align-items: center; }
.row-actions form { margin: 0; }
.action-slot { display: inline-flex; width: 30px; justify-content: center; }

.table-projects td, .table-projects th { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-projects td:first-child { max-width: 160px; }
.table-projects td:nth-child(4) { max-width: 180px; }

.text-truncate-link { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; }

.btn-ok { color: var(--ok); }
.link-plain { text-decoration: none; color: inherit; }

/* ── Footer ──────────────────────────────────────────────────────────── */

footer {
    padding: 0.75rem 0;
    border-top: 1px solid #333;
    margin-top: 2rem;
}

/* ── Progress pages ─────────────────────────────────────────────────── */

.progress-bar {
    width: 100%;
    height: 8px;
}

.progress-log {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
    font-family: monospace;
    font-size: 0.9em;
}

@keyframes log-repeat-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

.log-repeat {
    animation: log-repeat-blink 0.6s ease-in-out;
}

.hidden {
    display: none;
}

.headline-ok    { color: green; }
.headline-error { color: #c0392b; }

/* ── Projekt-Module-Navigation ──────────────────────────────────────── */

.module-nav {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #333;
    margin-bottom: 1.5rem;
}

.module-tab {
    padding: 0.4rem 1.1rem;
    text-decoration: none;
    color: #888;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    font-size: 0.9rem;
    transition: color 0.15s;
}

.module-tab:hover {
    color: #ccc;
}

.module-tab.active {
    color: #5b9bd5;
    border-bottom-color: #5b9bd5;
    font-weight: 500;
}

/* ── Dateimanager ───────────────────────────────────────────────────── */

.breadcrumb {
    font-size: 0.88em;
    color: #888;
    margin-bottom: 0.75rem;
}

.breadcrumb a {
    color: #888;
    text-decoration: none;
}

.breadcrumb a:hover {
    color: #ccc;
}

.file-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    justify-content: flex-end;
}

.file-actions form {
    margin: 0;
}

/* ── Alert-Banner ───────────────────────────────────────────────────── */

.alert-banner {
    background: #1a2a1a;
    border: 1px solid #2d5a27;
    color: #6fcf6f;
    border-radius: 6px;
    padding: 0.5rem 1rem;
    font-size: 0.88em;
    margin-bottom: 1rem;
}

.alert-banner.alert-error {
    background: #2a1a1a;
    border-color: #5a2727;
    color: #cf6f6f;
}

/* ── Modals (dialog) ────────────────────────────────────────────────── */

dialog {
    background: #1a1a2e;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 0;
    max-width: 420px;
    width: 100%;
    color: #ccc;
}

dialog::backdrop {
    background: rgba(0, 0, 0, 0.6);
}

.modal-card {
    padding: 1.25rem;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

/* ── Loading cursor ─────────────────────────────────────────────────── */

body.wait,
body.wait * {
    cursor: wait !important;
}

/* ── Artefakte (Plugins / Themes) ───────────────────────────────────── */

.artifact-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #333;
}

.artifact-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2px 0;
}

.artifact-row form {
    margin: 0;
    display: flex;
    align-items: center;
}

.artifact-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.artifact-actions form {
    margin: 0;
    display: flex;
    align-items: center;
}

.artifact-delete-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.artifact-delete-row label {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    white-space: nowrap;
    color: #555;
    font-size: 0.78em;
}

.artifact-delete-row input[type="checkbox"] {
    width: 11px;
    height: 11px;
    margin: 0;
    cursor: pointer;
    accent-color: #888;
}

.artifact-options {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.artifact-options label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    color: #aaa;
}

/* ── Code-Editor ─────────────────────────────────────────────────────── */

.editor-toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.45rem 0.75rem;
    background: #12121f;
    border: 1px solid #333;
    border-radius: 6px 6px 0 0;
    margin-top: 0.5rem;
}

.editor-filename {
    flex: 1;
    font-size: 0.82rem;
    color: #888;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.editor-btn-group {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}

.editor-status-label {
    font-size: 0.8rem;
    color: #555;
    white-space: nowrap;
    flex-shrink: 0;
}

.editor-status-label.dirty {
    color: #e67e22;
}

#editor-container {
    height: 72vh;
    border: 1px solid #333;
    border-top: none;
    border-radius: 0 0 6px 6px;
}

#editor-save-form textarea {
    display: none;
}

.deploy-target {
    display: inline-block;
    background: var(--surface-2);
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 0.78em;
    margin-right: 4px;
}

.font-mono {
    font-family: monospace;
}

/* Dashboard Metriken */
.metrics-grid {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.metric-item {
    display: grid;
    grid-template-columns: 3rem 1fr auto;
    align-items: center;
    gap: 0.5rem;
}

.metric-label {
    font-size: 0.78em;
    color: var(--text-muted);
}

.metric-bar-wrap {
    height: 6px;
    background: var(--surface-2);
    border-radius: 3px;
    overflow: hidden;
}

.metric-bar {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.3s;
}

.metric-bar.metric-bar-warn {
    background: #e67e22;
}

.metric-value {
    font-size: 0.75em;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Releases */
.card-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.version-bump-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 0.25rem;
}

.bump-option {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    font-size: 0.85em;
}

.input-inline {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    padding: 2px 6px;
    font-size: 0.85em;
    width: 6rem;
}

.textarea-sm {
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    padding: 0.5rem;
    font-family: monospace;
    font-size: 0.82em;
    resize: vertical;
}

.release-form .label-sm {
    font-size: 0.8em;
    color: var(--text-muted);
    display: block;
    margin-bottom: 0.25rem;
}

/* ── Theme Toggle Switch ── */
.theme-toggle-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.theme-switch {
    position: relative;
    width: 48px;
    height: 26px;
    border-radius: 13px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    cursor: pointer;
    padding: 0;
    margin: 0;
    flex-shrink: 0;
    transition: background 0.2s;
}

.theme-switch[data-active="true"] {
    background: var(--primary);
    border-color: var(--primary);
}

.theme-switch-knob {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.2s;
    display: block;
}

.theme-switch[data-active="true"] .theme-switch-knob {
    transform: translateX(22px);
}

/* ── Hilfe-System ── */
.help-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1rem;
    align-items: start;
}
@media (max-width: 800px) {
    .help-layout { grid-template-columns: 1fr; }
}

.help-body h1 { font-size: 1.4rem; margin-top: 0; }
.help-body h2 { font-size: 1.1rem; margin-top: 1.5rem; }
.help-body h3 { font-size: 1rem; margin-top: 1.2rem; }
.help-body table { width: 100%; border-collapse: collapse; font-size: 0.88em; margin: 0.75rem 0; }
.help-body th, .help-body td { border: 1px solid var(--border); padding: 0.4rem 0.6rem; text-align: left; }
.help-body th { background: var(--surface-2); }
.help-body code { background: var(--surface-2); padding: 1px 4px; border-radius: 3px; font-size: 0.87em; }
.help-body pre { background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; padding: 0.75rem; overflow-x: auto; }
.help-body pre code { background: none; padding: 0; }
.help-body ul, .help-body ol { padding-left: 1.4rem; }
.help-body li { margin-bottom: 0.2rem; }

.help-result { border-left: 2px solid var(--border); padding-left: 0.6rem; }

/* ── Git-Modul ── */
.git-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 1rem;
    align-items: start;
}
@media (max-width: 960px) {
    .git-layout { grid-template-columns: 1fr; }
}

.diff-viewer {
    font-family: monospace;
    font-size: 0.78em;
    line-height: 1.5;
    overflow-x: auto;
    white-space: pre;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.75rem;
    max-height: 70vh;
    overflow-y: auto;
    margin: 0;
}
.diff-add  { background: rgba(40,167,69,0.18); color: #4caf50; display: block; }
.diff-del  { background: rgba(220,53,69,0.18); color: #ef5350; display: block; }
.diff-hunk { color: #7ecfff; display: block; }
.diff-file { color: var(--text-muted); font-weight: bold; display: block; }

.commit-list { display: flex; flex-direction: column; gap: 0.5rem; }
.commit-item {
    border-left: 2px solid var(--border);
    padding: 0.25rem 0.6rem;
}
.commit-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.1rem;
}
.commit-short {
    font-size: 0.8em;
    color: var(--primary);
    background: var(--surface-2);
    padding: 1px 4px;
    border-radius: 3px;
}
.commit-msg  { margin: 0.1rem 0; }
.commit-author { margin-top: 0.1rem; }

/* KI-Diagnose-Bereich */
.ai-analysis-text {
    white-space: pre-wrap;
    font-size: 12px;
    line-height: 1.6;
    padding: var(--spacing-sm);
    background: var(--card-bg, rgba(255,255,255,0.03));
    border-left: 3px solid var(--primary, #0d6efd);
    border-radius: 0 var(--radius, 4px) var(--radius, 4px) 0;
}
