/* --- Variables & Tokens (Aus Prompt übernommen) --- */
:root[data-theme="light"] {
    --bg: #e6e6e6;
    --bg-l3: #dddddd;
    --text-main: #000000;
    --text-muted: hsl(0, 0%, 30%); /* Leicht angepasst für Lesbarkeit */
    --card-bg: rgba(255, 255, 255, 0.45); /* Etwas transparenter für Glas */
    --card-border: rgba(255, 255, 255, 0.6);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
    --dropdown-bg: #ffffff;
    --sb-thumb-color: hsl(0, 0%, 75%);
    --sb-thumb-hover: hsl(0, 0%, 65%);
}

:root[data-theme="dark"] {
    --bg: #0f172a;
    --bg-l3: #334155;
    --text-main: #ffffff;
    --text-muted: hsl(0, 0%, 70%);
    --card-bg: rgba(15, 23, 42, 0.65);
    --card-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
    --dropdown-bg: #1e293b;
    --sb-thumb-color: hsl(0, 0%, 40%);
    --sb-thumb-hover: hsl(0, 0%, 50%);
}

:root {
    --sb-width: 8px;
    --sb-track-color: transparent;
    --brand: #cc33cc;
    --brand-gradient: linear-gradient(135deg, #cc33cc 0%, #ed1c65 100%);
    --error-color: #ff4b4b;
    --success-color: #10b981;
    --container-width: 1400px;
    --header-height: 80px;
    --font-family: 'Inter', sans-serif;
    --radius: 16px;
}

/* --- Global Reset & Body --- */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font-family);
    background-color: var(--bg);
    color: var(--text-main);
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
    position: relative;
}

/* Hintergrund Blobs für Glass Effekt */
.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    z-index: -1;
    opacity: 0.6;
}
.blob-1 { top: -10%; left: -10%; width: 50vw; height: 50vw; background: #cc33cc; }
.blob-2 { bottom: -10%; right: -10%; width: 40vw; height: 40vw; background: #4b6cb7; }

/* --- Layout --- */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.layout-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 900px) {
    .layout-grid { grid-template-columns: 1fr; }
}

/* --- Glass Components --- */
.glass-panel {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    box-shadow: var(--glass-shadow);
    border-radius: var(--radius);
}

.card { padding: 30px; margin-bottom: 20px; }
.header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 20px 30px; 
}

/* --- Typography --- */
h1 { font-weight: 600; font-size: 1.8rem; margin-bottom: 0.5rem; }
h2 { font-size: 1.4rem; margin-bottom: 1rem; color: var(--text-main); }
p { line-height: 1.6; color: var(--text-muted); margin-bottom: 1rem; }
.text-muted { font-size: 0.9rem; }
.link { color: var(--brand); text-decoration: none; font-weight: 500; }

/* --- Forms --- */
.form-group { margin-bottom: 1.5rem; }
label { display: block; margin-bottom: 0.5rem; font-weight: 500; font-size: 0.9rem; }

input, textarea {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05); /* Sehr transparent */
    border: 1px solid var(--card-border);
    border-radius: 8px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.2s ease;
}

input:focus, textarea:focus {
    outline: none;
    border-color: var(--brand);
    background: var(--dropdown-bg);
    box-shadow: 0 0 0 3px rgba(204, 51, 204, 0.1);
}

/* --- Contract Preview --- */
.contract-container {
    height: calc(100vh - 140px);
    min-height: 600px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.contract-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--card-border);
    background: rgba(0,0,0,0.02);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.badge {
    background: var(--brand);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: bold;
}

.doc-title { font-size: 0.9rem; font-family: monospace; opacity: 0.7; }

.scroll-area {
    padding: 40px;
    overflow-y: auto;
    flex-grow: 1;
    background: var(--dropdown-bg); /* Papier-ähnlicher Hintergrund */
    opacity: 0.95;
}

/* Scrollbar Customization */
.scroll-area::-webkit-scrollbar { width: var(--sb-width); }
.scroll-area::-webkit-scrollbar-track { background: var(--sb-track-color); }
.scroll-area::-webkit-scrollbar-thumb {
    background: var(--sb-thumb-color);
    border-radius: 10px;
}
.scroll-area::-webkit-scrollbar-thumb:hover { background: var(--sb-thumb-hover); }

/* Contract Content Styling */
.contract-text { font-size: 0.95rem; color: var(--text-main); max-width: 100%; }
.contract-text h4 { margin-top: 1.5rem; margin-bottom: 0.5rem; color: var(--brand); }
.contract-text ul, .contract-text ol { margin-left: 20px; margin-bottom: 1rem; color: var(--text-muted); }
.contract-text li { margin-bottom: 0.3rem; }
.dynamic-field { color: var(--brand); font-weight: bold; border-bottom: 1px dashed var(--brand); }

/* Table in Contract */
.sub-processors {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.9rem;
}
.sub-processors th, .sub-processors td {
    border: 1px solid var(--card-border);
    padding: 8px;
    text-align: left;
}
.sub-processors th { background: rgba(125,125,125,0.1); }

/* --- Actions & Buttons --- */
.checkbox-wrapper {
    display: flex;
    align-items: flex-start;
    margin-bottom: 1rem;
    cursor: pointer;
    user-select: none;
}
.checkbox-wrapper input { display: none; }
.checkmark {
    min-width: 20px;
    height: 20px;
    border: 2px solid var(--sb-thumb-color);
    border-radius: 4px;
    margin-right: 10px;
    margin-top: 3px;
    display: grid;
    place-items: center;
    transition: 0.2s;
}
.checkbox-wrapper input:checked + .checkmark {
    background: var(--brand);
    border-color: var(--brand);
}
.checkmark::after {
    content: '✓';
    color: white;
    font-size: 12px;
    display: none;
}
.checkbox-wrapper input:checked + .checkmark::after { display: block; }
.label-text { font-size: 0.9rem; line-height: 1.4; color: var(--text-main); }

.btn-primary {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 8px;
    background: var(--brand-gradient);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s;
    margin-top: 10px;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 20px rgba(204, 51, 204, 0.3); }
.btn-primary:active { transform: translateY(0); }

.meta-info {
    text-align: center;
    margin-top: 15px;
    font-size: 0.8rem;
    opacity: 0.6;
}

/* Theme Toggle */
.icon-btn {
    background: transparent;
    border: 1px solid var(--card-border);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--text-main);
    transition: 0.2s;
}
.icon-btn:hover { background: var(--dropdown-hover); }

/* Logic for Icons */
[data-theme="light"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: none; }