/* ============================================================
   Justizministerium NRW – Dokumentenverwaltung
   assets/style.css
   ============================================================ */

:root {
    --nrw-green:       #1a5c2a;
    --nrw-green-light: #2a7a3a;
    --nrw-green-pale:  #e8f5ec;
    --nrw-red:         #8b1a1a;
    --nrw-gold:        #c8a84b;
    --accent:          #1a5c2a;

    /* Dark theme – Midnight Blue */
    --bg:          #080c18;
    --bg2:         #0d1221;
    --bg3:         #111827;
    --surface:     #0f1629;
    --surface2:    #141e35;
    --border:      #1e2d4a;
    --text:        #e8eeff;
    --text-muted:  #7a90c0;
    --text-head:   #c8a84b;
    --input-bg:    #090e1c;
    --input-border:#1e2d4a;
    --btn-bg:      #1a3a6e;
    --btn-hover:   #1e4480;
    --danger:      #7a1a1a;
    --warning:     #7a6010;
    --info:        #1a3a5c;
    --shadow:      rgba(0,0,0,0.7);
}

[data-theme="light"] {
    --bg:          #f0f4ee;
    --bg2:         #e8ede5;
    --bg3:         #dde4d9;
    --surface:     #ffffff;
    --surface2:    #f5f8f3;
    --border:      #c8d8c0;
    --text:        #1a2018;
    --text-muted:  #4a6440;
    --text-head:   #1a5c2a;
    --input-bg:    #ffffff;
    --input-border:#b0c8a8;
    --btn-bg:      #1a5c2a;
    --btn-hover:   #246636;
    --danger:      #c0392b;
    --warning:     #e6ac00;
    --info:        #1a5c8b;
    --shadow:      rgba(0,0,0,0.15);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    font-size: 1rem; /* 11pt Basis */
}

/* ---- HEADER ---- */
.site-header {
    background: linear-gradient(135deg, #0d1a3a 0%, #060c1a 100%);
    border-bottom: 3px solid var(--nrw-gold);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 20px var(--shadow);
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.6rem 1.5rem;
    max-width: 1600px;
    margin: 0 auto;
}

.header-logo {
    height: 54px;
    width: auto;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
}

.header-title h1 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.header-title p {
    font-size: 0.72rem;
    color: rgba(255,255,255,0.7);
}

.header-nav {
    margin-left: auto;
    display: flex;
    gap: 0.4rem;
    align-items: center;
    flex-wrap: wrap;
}

.nav-link {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    padding: 0.35rem 0.8rem;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 500;
    transition: background 0.2s;
    white-space: nowrap;
}

.nav-link:hover, .nav-link.active {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

.theme-btn {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    padding: 0.35rem 0.7rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s;
}
.theme-btn:hover { background: rgba(255,255,255,0.25); }

/* ---- LAYOUT ---- */
.main-wrapper {
    max-width: 1600px;
    margin: 0 auto;
    padding: 1.5rem;
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 1.5rem;
    align-items: start;
}

.main-wrapper.full { grid-template-columns: 1fr; }

/* ---- SIDEBAR ---- */
.sidebar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    position: sticky;
    top: 90px;
}

.sidebar-section {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-section:last-child { border-bottom: none; }

.sidebar-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 0.6rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.6rem;
    border-radius: 6px;
    color: var(--text);
    text-decoration: none;
    font-size: 0.85rem;
    transition: background 0.15s;
    margin-bottom: 0.1rem;
}

.sidebar-link:hover, .sidebar-link.active {
    background: var(--bg3);
    color: var(--text-head);
}

/* ---- CONTENT ---- */
.content { min-width: 0; }

.page-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-head);
    margin-bottom: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

/* ---- CARDS ---- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.2rem;
    margin-bottom: 1rem;
}

.card-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-head);
    margin-bottom: 0.8rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

/* ---- DOC TYPE GRID ---- */
.doc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.8rem;
    margin-bottom: 1.2rem;
}

.doc-type-card {
    background: var(--surface2);
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    color: var(--text);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    text-align: center;
}

.doc-type-card:hover, .doc-type-card.selected {
    border-color: var(--nrw-green);
    background: var(--nrw-green-pale);
    color: var(--nrw-green);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow);
}

[data-theme="light"] .doc-type-card:hover, [data-theme="light"] .doc-type-card.selected {
    background: #e8f5ec;
}

.doc-type-icon { font-size: 2rem; }
.doc-type-name { font-size: 0.82rem; font-weight: 600; }

/* ---- FORMS ---- */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.8rem;
}

.form-group { display: flex; flex-direction: column; gap: 0.3rem; }
.form-group.full { grid-column: 1 / -1; }

label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

input, select, textarea {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 6px;
    padding: 0.5rem 0.7rem;
    color: var(--text);
    font-size: 0.88rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    width: 100%;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--nrw-green);
    box-shadow: 0 0 0 3px rgba(26,92,42,0.15);
}

textarea { resize: vertical; min-height: 80px; }

/* ---- BUTTONS ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border-radius: 7px;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-primary { background: var(--nrw-green); color: #fff; }
.btn-primary:hover { background: var(--nrw-green-light); transform: translateY(-1px); }

.btn-secondary { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: 0.85; }

.btn-success { background: #1a7a3a; color: #fff; }
.btn-success:hover { background: #1e8a42; }

.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.78rem; }
.btn-lg { padding: 0.7rem 1.4rem; font-size: 0.95rem; }

.btn-row {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 1rem;
}

/* ---- TABLE ---- */
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th {
    background: var(--bg3);
    padding: 0.6rem 0.8rem;
    text-align: left;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
}
td {
    padding: 0.6rem 0.8rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}
tr:hover td { background: var(--bg2); }

/* ---- BADGES ---- */
.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 700;
}
.badge-green  { background: rgba(26,92,42,0.2); color: #2a8a3a; }
.badge-red    { background: rgba(139,26,26,0.2); color: #c04040; }
.badge-gray   { background: var(--bg3); color: var(--text-muted); }
.badge-gold   { background: rgba(200,168,75,0.2); color: var(--nrw-gold); }
.badge-blue   { background: rgba(26,80,160,0.2); color: #4a90d9; }
.badge-orange { background: rgba(180,80,0,0.2);  color: #d4770a; }
.badge-purple { background: rgba(90,26,120,0.2); color: #9b59b6; }

/* Neon-Badges für Zahlungsstatus */
.badge-neon-green {
    background: rgba(0,255,80,0.12);
    color: #00ff50;
    border: 1px solid rgba(0,255,80,0.4);
    box-shadow: 0 0 6px rgba(0,255,80,0.5), 0 0 12px rgba(0,255,80,0.2);
    text-shadow: 0 0 6px rgba(0,255,80,0.8);
}
.badge-neon-red {
    background: rgba(255,30,30,0.12);
    color: #ff2020;
    border: 1px solid rgba(255,30,30,0.4);
    box-shadow: 0 0 6px rgba(255,30,30,0.5), 0 0 12px rgba(255,30,30,0.2);
    text-shadow: 0 0 6px rgba(255,30,30,0.8);
    animation: neon-blink 1.2s ease-in-out infinite;
}
@keyframes neon-blink {
    0%, 100% { opacity: 1;   box-shadow: 0 0 6px rgba(255,30,30,0.6), 0 0 14px rgba(255,30,30,0.3); }
    50%       { opacity: 0.4; box-shadow: 0 0 2px rgba(255,30,30,0.2); }
}

/* ---- FLASH MESSAGES ---- */
.flash {
    padding: 0.7rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.88rem;
    font-weight: 600;
}
.flash-success { background: rgba(26,92,42,0.2); border: 1px solid #1a5c2a; color: #3aaa5a; }
.flash-error   { background: rgba(139,26,26,0.2); border: 1px solid #8b1a1a; color: #e06060; }
.flash-info    { background: rgba(26,58,92,0.2); border: 1px solid #1a3a5c; color: #6090e0; }

/* ---- DOCUMENT PREVIEW AREA ---- */
.doc-preview-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.doc-preview-toolbar {
    background: var(--bg3);
    border-bottom: 1px solid var(--border);
    padding: 0.6rem 1rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.toolbar-group {
    display: flex;
    gap: 0.2rem;
    align-items: center;
    padding-right: 0.6rem;
    border-right: 1px solid var(--border);
}
.toolbar-group:last-child { border-right: none; padding-right: 0; }

.toolbar-btn {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    padding: 0.25rem 0.45rem;
    cursor: pointer;
    color: var(--text);
    font-size: 0.85rem;
    transition: all 0.15s;
}
.toolbar-btn:hover { background: var(--border); }
.toolbar-btn.active { background: var(--nrw-green); color: #fff; }

.doc-editor {
    min-height: 500px;
    padding: 1.2rem;
    outline: none;
    font-family: 'Times New Roman', serif;
    line-height: 1.6;
    color: var(--text);
}

/* ---- THE ACTUAL DOCUMENT ---- */
.document-output {
    font-family: 'Times New Roman', Georgia, serif;
    font-size: 13pt;
    line-height: 1.4;
    color: #111;
    background: #fff;
    padding: 2.5cm 2.5cm 3cm;
    min-height: 29.7cm;
    width: 21cm;
    margin: 0 auto;
    box-shadow: 0 4px 30px rgba(0,0,0,0.3);
    position: relative;
}

.doc-header {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    border-bottom: 2px solid #1a5c2a;
    padding-bottom: 0.8rem;
    margin-bottom: 1.2rem;
}

.doc-header-logo { height: 80px; width: auto; }

.doc-header-text h1 {
    font-size: 14pt;
    font-weight: 700;
    color: #1a5c2a;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.doc-header-text p {
    font-size: 9.5pt;
    color: #555;
    line-height: 1.3;
}

.doc-title {
    text-align: center;
    font-size: 15pt;
    font-weight: 700;
    text-decoration: underline;
    margin: 1.5rem 0 1rem;
    color: #1a5c2a;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.doc-az {
    text-align: right;
    font-size: 10pt;
    color: #555;
    margin-bottom: 0.8rem;
}

.doc-date-place {
    text-align: right;
    font-size: 10pt;
    color: #333;
    margin-bottom: 1.5rem;
}

.doc-body { font-size: 11pt; }
.doc-body p { margin-bottom: 0.8rem; }

.doc-label {
    font-size: 9pt;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
}

.doc-value {
    font-size: 11pt;
    color: #111;
    border-bottom: 1px solid #ccc;
    padding-bottom: 2px;
    margin-bottom: 0.8rem;
}

.doc-section-title {
    font-size: 12pt;
    font-weight: 700;
    color: #1a5c2a;
    margin: 1.2rem 0 0.5rem;
    border-left: 3px solid #1a5c2a;
    padding-left: 0.5rem;
}

.doc-signature-area {
    margin-top: 2.5rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.doc-signature-block {
    text-align: center;
    min-width: 200px;
}

.doc-signature-block img {
    max-height: 60px;
    margin-bottom: 5px;
}

.doc-signature-line {
    border-top: 1px solid #333;
    padding-top: 4px;
    font-size: 9.5pt;
    color: #555;
}

.doc-stamp {
    font-size: 9pt;
    color: #555;
    text-align: center;
    margin-top: 2rem;
    border-top: 1px solid #ddd;
    padding-top: 0.6rem;
}

/* Output wrapper (scrollable A4 preview) */
.output-wrapper {
    background: #888;
    padding: 2rem;
    overflow-x: auto;
}

/* ---- PENALTY CALCULATOR ---- */
.calc-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
.calc-result-box {
    background: var(--bg3);
    border: 2px solid var(--nrw-green);
    border-radius: 10px;
    padding: 1.2rem;
}
.calc-total {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-head);
    text-align: center;
}
.calc-total span { font-size: 1rem; color: var(--text-muted); }

.law-tag {
    display: inline-block;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.15rem 0.4rem;
    font-size: 0.75rem;
    margin: 0.1rem;
    color: var(--text-muted);
}

/* ---- RESPONSIVE ---- */
@media (max-width: 900px) {
    .main-wrapper { grid-template-columns: 1fr; }
    .sidebar { position: static; }
    .calc-wrap { grid-template-columns: 1fr; }
    .document-output { width: 100%; padding: 1.5rem; }
    .output-wrapper { padding: 0.5rem; }
}

@media (max-width: 600px) {
    .header-inner { padding: 0.5rem 1rem; }
    .header-logo { height: 40px; }
    .doc-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---- MISC ---- */
.divider { border: none; border-top: 1px solid var(--border); margin: 1.2rem 0; }
.text-muted { color: var(--text-muted); font-size: 0.82rem; }
.text-right { text-align: right; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 0.5rem; }

/* Copy feedback */
.copy-success {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: #1a7a3a;
    color: #fff;
    padding: 0.8rem 1.4rem;
    border-radius: 8px;
    font-weight: 700;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    animation: fadeUp 0.3s ease;
    z-index: 9999;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.spinner { animation: spin 1s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Sections in penalty calc */
.penalty-list { list-style: none; }
.penalty-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border);
}
.penalty-item:last-child { border-bottom: none; }
.penalty-he-badge {
    background: var(--nrw-green);
    color: #fff;
    border-radius: 4px;
    padding: 0.1rem 0.4rem;
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
}

[data-theme="dark"] .page-title { color: #c8a84b; }
[data-theme="dark"] .card-title { color: #c8a84b; }
[data-theme="dark"] h1, [data-theme="dark"] h2, [data-theme="dark"] h3 { color: #c8a84b; }
[data-theme="dark"] .badge-green { background: rgba(26,58,110,0.3); color: #7aa0e0; }
[data-theme="dark"] .btn-primary { background: #1a3a6e; }
[data-theme="dark"] .btn-primary:hover { background: #1e4480; }
[data-theme="dark"] .site-header { border-bottom-color: #c8a84b; }
[data-theme="dark"] .calc-result-box { border-color: #c8a84b; }
[data-theme="dark"] code { color: #c8a84b; }

/* ---- ZOOM CONTROLS ---- */
.zoom-controls {
    display: flex;
    align-items: center;
    gap: .2rem;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 6px;
    padding: .1rem .3rem;
}
.zoom-btn {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    padding: .1rem .35rem;
    border-radius: 4px;
    line-height: 1;
    transition: background .15s;
}
.zoom-btn:hover { background: rgba(255,255,255,0.2); }
.zoom-level {
    font-size: .75rem;
    color: rgba(255,255,255,0.8);
    min-width: 32px;
    text-align: center;
}

/* ---- ZOOM / SCHRIFTGRÖSSE ---- */
.zoom-controls {
    display: flex;
    align-items: center;
    gap: .2rem;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    padding: .1rem .3rem;
}
.zoom-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    padding: .1rem .4rem;
    border-radius: 4px;
    line-height: 1;
    transition: background .15s;
}
.zoom-btn:hover { background: rgba(255,255,255,0.2); }
.zoom-level {
    color: rgba(255,255,255,0.7);
    font-size: .75rem;
    min-width: 28px;
    text-align: center;
}
