/* UDM Handout Styles — Gemeinsame Styles fuer alle Anleitungen */

:root {
    --primary: #2563eb;
    --primary-light: #eff6ff;
    --border: #e2e8f0;
    --text: #1e293b;
    --text-muted: #64748b;
    --bg: #ffffff;
    --bg-code: #f8fafc;
    --success: #16a34a;
    --warning: #d97706;
    --info: #0284c7;
}

/* === Default chapter colors (blue fallback) === */
.page {
    --ch-color: #2563eb;
    --ch-color-light: rgba(37, 99, 235, 0.12);
    --ch-color-lighter: rgba(37, 99, 235, 0.05);
    --ch-color-dark: #1e3a5f;
    --ch-nav: #2563eb;
    --ch-border: #e8eaf0;
}

/* === Chapter-specific colors === */
.page.ch-1 { --ch-color: #0d9488; --ch-color-light: rgba(13,148,136,0.12); --ch-color-lighter: rgba(13,148,136,0.05); --ch-color-dark: #134e4a; --ch-nav: #14b8a6; --ch-border: #e4f0ee; }
.page.ch-2 { --ch-color: #1e40af; --ch-color-light: rgba(30,64,175,0.12); --ch-color-lighter: rgba(30,64,175,0.05); --ch-color-dark: #1e3a5f; --ch-nav: #2563eb; --ch-border: #e8eaf0; }
.page.ch-3 { --ch-color: #7c3aed; --ch-color-light: rgba(124,58,237,0.12); --ch-color-lighter: rgba(124,58,237,0.05); --ch-color-dark: #4c1d95; --ch-nav: #8b5cf6; --ch-border: #eeeaf3; }
.page.ch-4 { --ch-color: #059669; --ch-color-light: rgba(5,150,105,0.12); --ch-color-lighter: rgba(5,150,105,0.05); --ch-color-dark: #064e3b; --ch-nav: #10b981; --ch-border: #e4f0ea; }
.page.ch-5 { --ch-color: #0284c7; --ch-color-light: rgba(2,132,199,0.12); --ch-color-lighter: rgba(2,132,199,0.05); --ch-color-dark: #0c4a6e; --ch-nav: #0ea5e9; --ch-border: #e4eef5; }
.page.ch-6 { --ch-color: #d97706; --ch-color-light: rgba(217,119,6,0.12); --ch-color-lighter: rgba(217,119,6,0.05); --ch-color-dark: #78350f; --ch-nav: #f59e0b; --ch-border: #f0ece4; }
.page.ch-7 { --ch-color: #dc2626; --ch-color-light: rgba(220,38,38,0.12); --ch-color-lighter: rgba(220,38,38,0.05); --ch-color-dark: #7f1d1d; --ch-nav: #ef4444; --ch-border: #f0e4e4; }
.page.ch-8 { --ch-color: #0891b2; --ch-color-light: rgba(8,145,178,0.12); --ch-color-lighter: rgba(8,145,178,0.05); --ch-color-dark: #164e63; --ch-nav: #06b6d4; --ch-border: #e4eef0; }
.page.ch-9 { --ch-color: #7c3aed; --ch-color-light: rgba(124,58,237,0.12); --ch-color-lighter: rgba(124,58,237,0.05); --ch-color-dark: #4c1d95; --ch-nav: #8b5cf6; --ch-border: #eeeaf3; }
.page.ch-10 { --ch-color: #475569; --ch-color-light: rgba(71,85,105,0.12); --ch-color-lighter: rgba(71,85,105,0.05); --ch-color-dark: #1e293b; --ch-nav: #64748b; --ch-border: #e8eaed; }

/* === Base layout === */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    color: var(--text);
    background: #f1f5f9;
    line-height: 1.6;
}

.page {
    max-width: 900px;
    margin: 2rem auto;
    background: var(--bg);
    border-radius: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* === Navigation Bar (sticky, top) === */
.nav-bar {
    background: var(--ch-nav);
    padding: 0.35rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.82rem;
    position: sticky;
    top: 0;
    z-index: 200;
    border-radius: 0;
}

.nav-bar a {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    white-space: nowrap;
    font-weight: 500;
}

.nav-bar a:hover {
    color: white;
    text-decoration: underline;
}

.nav-bar .nav-group {
    flex: 1;
    text-align: center;
    overflow: hidden;
    min-width: 0;
    line-height: 1.3;
}

.nav-bar .nav-title {
    display: block;
    color: rgba(255,255,255,0.6);
    font-size: 0.7rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-bar .nav-chapter {
    display: block;
    color: white;
    font-weight: 600;
    font-size: 0.82rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* === Header === */
.header {
    background: linear-gradient(135deg, var(--ch-color-light), var(--ch-color-lighter));
    color: var(--text);
    padding: 2rem 2.5rem 1.75rem;
    border-bottom: 1px solid var(--ch-border);
    display: flex;
    align-items: center;
    gap: 2rem;
}

.page > .header:first-child {
    border-radius: 0;
}

.header-text { flex: 1; }

.header-illustration { flex: 0 0 auto; position: relative; }
.header-illustration img { width: 120px; height: 120px; opacity: 0.7; filter: grayscale(1); }
.header-illustration::after { content: ''; position: absolute; inset: 0; background: var(--ch-color); mix-blend-mode: color; pointer-events: none; }

.header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
    color: var(--ch-color-dark);
}

.header p {
    opacity: 1;
    font-size: 0.92rem;
    color: var(--text-muted);
    margin-top: 0.4rem;
}

/* === Content === */
.content {
    padding: 2rem 2.5rem 2.5rem;
}

/* === h2 with chapter-colored left border + gradient === */
h2 {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 2rem 0 1rem;
    padding: 0.45rem 0.85rem;
    border-bottom: none;
    border-left: 4px solid var(--ch-color);
    border-radius: 0;
    background: linear-gradient(135deg, var(--ch-color-light), var(--ch-color-lighter));
    color: var(--ch-color-dark);
}

h2:first-child { margin-top: 0; }

h3 {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 1.5rem 0 0.75rem;
}

p, li { font-size: 0.95rem; }
p { margin-bottom: 0.75rem; }

ol, ul {
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

li { margin-bottom: 0.4rem; }

/* === Step-List (numbered steps with chapter-colored circles) === */
.step-list {
    list-style: none;
    padding-left: 0;
    counter-reset: step;
}

.step-list > li {
    counter-increment: step;
    position: relative;
    padding-left: 3rem;
    margin-bottom: 1.5rem;
}

.step-list > li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: 0;
    width: 2rem;
    height: 2rem;
    background: var(--ch-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.step-list > li > strong {
    display: block;
    font-size: 1rem;
    margin-bottom: 0.3rem;
}

/* === Info-Boxes (unified neutral design) === */
.info-box {
    display: block;
    background: #f5f5f5;
    border: 1px solid #cbd5e1;
    border-radius: 0;
    padding: 0.5rem 1rem;
    margin: 0.75rem 0 0.75rem 1.5rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.info-box.tip,
.info-box.warning,
.info-box.info {
    background: #f5f5f5;
    border-left: 1px solid #cbd5e1;
}

.info-box strong {
    display: inline;
    font-size: 0.82rem;
    color: var(--text);
    margin-bottom: 0;
}

.info-box strong::after {
    content: none;
}

.info-box .hint-text {
    display: block;
    margin-top: 0.3rem;
    padding-top: 0.3rem;
    border-top: 1px solid #cbd5e1;
    font-style: italic;
}

/* === Scenario-Box (unified neutral design) === */
.scenario-box {
    display: block;
    background: #f5f5f5;
    border: 1px solid #cbd5e1;
    border-radius: 0;
    padding: 0.5rem 1rem;
    margin: 0.75rem 0 0.75rem 1.5rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.scenario-box .scenario-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.03em;
    display: inline;
}

.scenario-box .scenario-label::before {
    content: "\1F3AF ";
}

.scenario-box .scenario-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
    display: inline;
    margin-left: 0.3rem;
}

.scenario-box p {
    display: block;
    margin-top: 0.3rem;
    padding-top: 0.3rem;
    border-top: 1px solid #cbd5e1;
    font-size: 0.82rem;
    font-style: italic;
    color: var(--text-muted);
    margin-bottom: 0;
}

/* === Tables === */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.9rem;
}

th, td {
    text-align: left;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
}

th {
    background: #f8fafc;
    font-weight: 600;
}

code {
    background: var(--bg-code);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.15rem 0.4rem;
    font-family: "Cascadia Code", "Fira Code", "Consolas", monospace;
    font-size: 0.85rem;
}

.field-table td:first-child {
    white-space: nowrap;
    font-weight: 600;
    width: 220px;
}

/* Tags */
.tag {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}

.tag-required { background: #fee2e2; color: #b91c1c; }
.tag-optional { background: #e0f2fe; color: #0369a1; }

/* === Screenshots === */
.screenshot {
    margin: 1.25rem 0;
    text-align: center;
}

.screenshot img {
    max-width: 100%;
    border: 2px solid var(--border);
    border-radius: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}


.screenshot-caption {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    font-style: italic;
}

/* === Footer (inside page) === */
.footer {
    background: #f8fafc;
    border-top: 1px solid var(--border);
    padding: 1.25rem 2.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
}

/* === Common-Footer (sticky, bottom, per JS injected) === */
.common-footer {
    background: var(--ch-nav);
    padding: 0.45rem 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    font-size: 0.8rem;
    position: sticky;
    bottom: 0;
    z-index: 100;
    border-radius: 0;
}

.common-footer a {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
}

.common-footer a:hover {
    color: white;
    text-decoration: underline;
}

.common-footer .nav-sep {
    color: rgba(255,255,255,0.4);
}

.common-footer .nav-current {
    color: rgba(255,255,255,0.5);
}

/* === TOC-Styles (index.html) === */
.toc-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin: 1.5rem 0;
    align-items: start;
}

.toc-card {
    border: 1px solid var(--border);
    border-radius: 0;
    overflow: hidden;
}

.toc-card-header {
    padding: 0.75rem 1rem;
    color: white;
    font-weight: 700;
    font-size: 0.95rem;
}

.toc-card-body {
    padding: 0.75rem 1rem;
}

.toc-card-body a {
    display: block;
    padding: 0.35rem 0;
    color: var(--primary);
    text-decoration: none;
    font-size: 0.9rem;
}

.toc-card-body a:hover {
    text-decoration: underline;
}

.toc-card-body .toc-desc {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-left: 0.5rem;
}

/* === Funktionsindex-Styles === */
.index-section {
    margin-bottom: 2rem;
}

.index-section h3 {
    margin-bottom: 0.5rem;
}

.index-list {
    list-style: none;
    padding-left: 0;
    columns: 2;
    column-gap: 2rem;
}

.index-list li {
    break-inside: avoid;
    padding: 0.2rem 0;
    font-size: 0.88rem;
    border-bottom: 1px dotted var(--border);
    margin-bottom: 0.15rem;
}

.index-list li strong {
    color: var(--text);
}

.index-list li span {
    color: var(--text-muted);
    font-size: 0.82rem;
}

/* === Responsive === */
@media (max-width: 700px) {
    .toc-grid { grid-template-columns: 1fr; }
    .index-list { columns: 1; }
}

/* === Print === */
@media print {
    body { background: white; }
    .page { margin: 0; box-shadow: none; border-radius: 0; }
    .header { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .info-box { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .scenario-box { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .screenshot-placeholder { display: none; }
    .toc-card-header { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .nav-bar { display: none; }
    .common-footer { display: none; }
    h2 { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .step-list > li::before { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
