/* Plus Marketing Solutions — HTML Mail Composer
   Dark UI: #121115 Hintergrund, #ffd700 Gold, Georgia für Überschriften */

:root {
    --bg: #121115;
    --bg-panel: #1a191e;
    --bg-input: #201f25;
    --gold: #ffd700;
    --gold-dim: rgba(255, 215, 0, 0.25);
    --text: #f8fafc;
    --text-dim: rgba(248, 250, 252, 0.65);
    --text-faint: rgba(248, 250, 252, 0.4);
    --border: rgba(255, 215, 0, 0.15);
    --error: #ef4444;
    --ok: #22c55e;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

h1, h2, h3 {
    font-family: Georgia, 'Times New Roman', serif;
    color: var(--text);
    margin: 0 0 14px;
}
h1 { font-size: 24px; }
h1::first-letter { color: var(--gold); }
h2 { font-size: 17px; margin-top: 26px; }
h3 { font-size: 15px; }

a { color: var(--gold); }
code { color: var(--gold); background: var(--bg-input); padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--text-dim); }

/* ---------- Top-Navigation ---------- */
.topnav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 24px;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}
.topnav-brand {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 16px;
    font-weight: bold;
}
.topnav-brand small { color: var(--text-dim); font-family: Arial, sans-serif; font-weight: normal; margin-left: 6px; }
.brand-dot { color: var(--gold); }
.topnav nav { display: flex; gap: 4px; flex-wrap: wrap; }
.topnav nav a {
    color: var(--text-dim);
    text-decoration: none;
    padding: 7px 13px;
    border-radius: 6px;
    font-size: 13px;
}
.topnav nav a:hover { color: var(--text); background: rgba(255, 215, 0, 0.06); }
.topnav nav a.active { color: var(--gold); background: rgba(255, 215, 0, 0.1); }
.topnav nav a.nav-logout { color: var(--text-faint); }

/* ---------- Layout ---------- */
.page { padding: 24px; max-width: 1600px; margin: 0 auto; }
.panel {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
}
.panel-wide { max-width: 900px; margin: 0 auto; }
.compose-grid, .ai-grid {
    display: grid;
    grid-template-columns: minmax(380px, 1fr) minmax(420px, 1.2fr);
    gap: 20px;
    align-items: start;
}
@media (max-width: 1000px) {
    .compose-grid, .ai-grid { grid-template-columns: 1fr; }
}

/* ---------- Formulare ---------- */
label {
    display: block;
    margin-bottom: 14px;
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: var(--text-dim);
}
label small { text-transform: none; font-weight: normal; color: var(--text-faint); }
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
select, textarea {
    display: block;
    width: 100%;
    margin-top: 5px;
    padding: 9px 11px;
    background: var(--bg-input);
    border: 1px solid rgba(248, 250, 252, 0.12);
    border-radius: 7px;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--gold-dim);
    box-shadow: 0 0 0 2px rgba(255, 215, 0, 0.08);
}
input[disabled] { opacity: 0.5; }
textarea { resize: vertical; }
.mono, .editor-html { font-family: 'Courier New', Courier, monospace; font-size: 13px; }
.field-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .field-row-2 { grid-template-columns: 1fr; } }

/* ---------- Buttons ---------- */
.btn {
    display: inline-block;
    padding: 9px 18px;
    background: var(--bg-input);
    color: var(--text);
    border: 1px solid rgba(248, 250, 252, 0.15);
    border-radius: 7px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { border-color: var(--gold-dim); }
.btn-gold {
    background: var(--gold);
    border-color: var(--gold);
    color: #121115;
}
.btn-gold:hover { filter: brightness(1.08); }
.btn-small { padding: 4px 10px; font-size: 12px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }

/* ---------- Alerts / Status ---------- */
.alert { padding: 10px 14px; border-radius: 7px; margin-bottom: 14px; font-size: 13px; }
.alert-error { background: rgba(239, 68, 68, 0.12); border: 1px solid rgba(239, 68, 68, 0.4); color: #fca5a5; }
.alert-ok { background: rgba(34, 197, 94, 0.1); border: 1px solid rgba(34, 197, 94, 0.35); color: #86efac; }
.status-line { min-height: 20px; margin-top: 10px; font-size: 13px; color: var(--text-dim); }
.status-line.err { color: #fca5a5; }
.status-line.ok { color: #86efac; }

/* ---------- Login ---------- */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-box {
    width: 100%;
    max-width: 380px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 32px;
}
.login-brand {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 19px;
    font-weight: bold;
    margin-bottom: 22px;
}
.login-brand small { display: block; font-family: Arial, sans-serif; font-size: 12px; font-weight: normal; color: var(--text-dim); margin-top: 4px; }

/* ---------- Compose: Editor & Preview ---------- */
.editor-head { display: flex; align-items: center; justify-content: space-between; margin: 18px 0 8px; }
.editor-title { font-size: 12px; font-weight: bold; letter-spacing: 0.4px; text-transform: uppercase; color: var(--text-dim); }
.tabs { display: flex; gap: 4px; }
.tab {
    padding: 5px 12px;
    font-size: 12px;
    background: var(--bg-input);
    color: var(--text-dim);
    border: 1px solid rgba(248, 250, 252, 0.12);
    border-radius: 6px;
    cursor: pointer;
}
.tab.active { color: var(--gold); border-color: var(--gold-dim); background: rgba(255, 215, 0, 0.08); }

.blocks-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin-bottom: 10px;
    padding: 8px;
    background: rgba(255, 215, 0, 0.04);
    border: 1px solid var(--border);
    border-radius: 8px;
}
.blocks-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-faint); margin-right: 4px; }
.blocks-toolbar .btn { padding: 4px 10px; font-size: 12px; }

.editor-visual {
    min-height: 260px;
    max-height: 480px;
    overflow-y: auto;
    padding: 14px;
    background: var(--bg-input);
    border: 1px solid rgba(248, 250, 252, 0.12);
    border-radius: 7px;
    color: var(--text);
}
.editor-visual:focus { outline: none; border-color: var(--gold-dim); }
.editor-html { width: 100%; min-height: 260px; max-height: 480px; margin-top: 0; }

.preview-panel iframe, #history-modal-frame {
    width: 100%;
    min-height: 640px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
}
#ai-preview { min-height: 420px; }

/* ---------- KI-Seite ---------- */
.ai-stream {
    white-space: pre-wrap;
    background: var(--bg-input);
    border: 1px solid rgba(248, 250, 252, 0.1);
    border-radius: 8px;
    padding: 14px;
    min-height: 120px;
    max-height: 300px;
    overflow-y: auto;
    font-size: 13px;
    color: var(--text-dim);
    margin-bottom: 14px;
}
.history-subhead { margin-top: 24px; }
.generation-list { list-style: none; margin: 0; padding: 0; }
.generation-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid rgba(248, 250, 252, 0.08);
    border-radius: 7px;
    margin-bottom: 6px;
    font-size: 12px;
}
.gen-meta { color: var(--text-faint); white-space: nowrap; }
.gen-preview { color: var(--text-dim); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Verlauf ---------- */
.history-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.history-table th {
    text-align: left;
    padding: 9px 10px;
    color: var(--text-faint);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}
.history-table td { padding: 10px; border-bottom: 1px solid rgba(248, 250, 252, 0.06); }
.history-row { cursor: pointer; }
.history-row:hover { background: rgba(255, 215, 0, 0.04); }
.badge { padding: 2px 9px; border-radius: 20px; font-size: 11px; background: rgba(255, 215, 0, 0.1); color: var(--gold); border: 1px solid var(--gold-dim); }
.badge-test { background: rgba(248, 250, 252, 0.08); color: var(--text-dim); border-color: rgba(248, 250, 252, 0.15); }

/* ---------- Modals ---------- */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
}
.modal-card {
    background: var(--bg-panel);
    border: 1px solid var(--gold-dim);
    border-radius: 12px;
    padding: 24px;
    width: 100%;
    max-width: 460px;
    max-height: 90vh;
    overflow-y: auto;
}
.modal-card-wide { max-width: 720px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.send-summary { font-size: 13px; color: var(--text-dim); }
.send-summary strong { color: var(--text); }
.send-summary ul { margin: 8px 0 0; padding-left: 18px; }

.hash-output {
    background: var(--bg-input);
    border: 1px solid var(--gold-dim);
    border-radius: 8px;
    padding: 14px;
    word-break: break-all;
    white-space: pre-wrap;
    color: var(--gold);
}
