/* =============================================================
   Mr-Money Schnittstellen v2 ? Stylesheet
   Design: Premium Documentation (Big-Tech Style)
   ============================================================= */

/* --- Inter Font (lokal) --- */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/inter-400.woff2') format('woff2');
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('fonts/inter-500.woff2') format('woff2');
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('fonts/inter-600.woff2') format('woff2');
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('fonts/inter-700.woff2') format('woff2');
}

/* --- Custom Properties --- */
:root {
    --sidebar-width: 272px;

    /* Sidebar ? Light */
    --sidebar-bg:            #ffffff;
    --sidebar-border:        #e2e8f0;
    --sidebar-text:          #475569;
    --sidebar-text-hover:    #0f172a;
    --sidebar-group-color:   #2563eb;
    --sidebar-active-bg:     #eff6ff;
    --sidebar-active-text:   #1d4ed8;
    --sidebar-active-accent: #2563eb;
    --sidebar-hover-bg:      #f1f5f9;

    /* Content */
    --color-bg:           #f8fafc;
    --color-white:        #ffffff;
    --color-text:         #0f172a;
    --color-muted:        #64748b;
    --color-border:       #e2e8f0;

    /* Accent (Blue) */
    --color-accent:       #2563eb;
    --color-accent-hover: #1d4ed8;
    --color-accent-light: #eff6ff;

    /* Status */
    --color-danger:           #ef4444;
    --color-warning-bg:       #fffbeb;
    --color-warning-border:   #f59e0b;
    --color-info-bg:          #eff6ff;
    --color-info-border:      #3b82f6;
    --color-success-bg:       #f0fdf4;
    --color-success-border:   #22c55e;

    /* Code */
    --color-code-bg:          #f1f5f9;
    --color-code-dark:        #f8fafc;
    --color-code-dark-border: #e2e8f0;
    --color-code-dark-header: #f1f5f9;

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    --font-mono: ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

    /* Shape */
    --radius:    8px;
    --radius-sm: 5px;
    --radius-lg: 12px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0,0,0,.06), 0 1px 3px rgba(0,0,0,.1);
    --shadow:    0 4px 6px -1px rgba(0,0,0,.08), 0 2px 4px -2px rgba(0,0,0,.06);
    --shadow-lg: 0 20px 25px -5px rgba(0,0,0,.1), 0 8px 10px -6px rgba(0,0,0,.05);
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
    font-family: var(--font-sans);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Layout: Sidebar + Content --- */
.layout {
    display: flex;
    min-height: 100vh;
}

/* --- Sidebar (Dark) --- */
.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    border-right: 1px solid var(--sidebar-border);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 2px; }

.sidebar-brand {
    padding: 22px 18px 16px;
    border-bottom: 1px solid var(--sidebar-border);
    text-decoration: none;
    display: block;
}
.sidebar-brand .brand-logo {
    display: block;
    max-width: 100%;
    height: auto;
    max-height: 44px;
    object-fit: contain;
}

/* --- Sidebar Search --- */
.sidebar-search {
    padding: 10px 12px;
    border-bottom: 1px solid var(--sidebar-border);
}
.sidebar-search input[type="search"] {
    width: 100%;
    padding: 7px 10px;
    font-size: 12.5px;
    font-family: var(--font-sans);
    border: 1px solid var(--sidebar-border);
    border-radius: var(--radius-sm);
    background: var(--color-bg);
    color: var(--color-text);
    transition: border-color .15s, box-shadow .15s;
    /* Override globaler input-Styles */
    box-shadow: none;
}
.sidebar-search input[type="search"]:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
/* Webkit-Such-Cancel-Button dezent halten */
.sidebar-search input[type="search"]::-webkit-search-cancel-button {
    opacity: .5;
    cursor: pointer;
}

/* --- Suchergebnisliste (search.php) --- */
.search-results {
    list-style: none;
    padding: 0;
    margin: 0;
}
.search-results li {
    border-bottom: 1px solid var(--color-border);
}
.search-results li:last-child {
    border-bottom: none;
}
.search-results li a {
    display: block;
    padding: 12px 4px;
    font-size: 14.5px;
    font-weight: 500;
    color: var(--color-accent);
    text-decoration: none;
    transition: color .12s, background .12s;
    border-radius: var(--radius-sm);
}
.search-results li a:hover {
    color: var(--color-accent-hover);
    background: var(--color-accent-light);
    padding-left: 10px;
}

.sidebar-nav {
    flex: 1;
    padding: 8px 0 24px;
}

/* Gruppen */
.nav-group {
    border: none;
    margin: 2px 0;
}
.nav-group summary,
.nav-group-title {
    list-style: none;
    padding: 16px 18px 5px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--sidebar-group-color);
    cursor: default;
    user-select: none;
    opacity: .85;
}
.nav-group summary::-webkit-details-marker { display: none; }

.nav-group a {
    display: block;
    padding: 7px 12px 7px 22px;
    margin: 1px 8px;
    font-size: 13.5px;
    font-weight: 400;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: background .12s, color .12s;
    line-height: 1.45;
    position: relative;
}
.nav-group a:hover {
    background: var(--sidebar-hover-bg);
    color: var(--sidebar-text-hover);
}
.nav-group a.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
    font-weight: 500;
}
.nav-group a.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 4px;
    bottom: 4px;
    width: 2px;
    background: var(--sidebar-active-accent);
    border-radius: 2px;
}

/* --- Main Content --- */
.content {
    flex: 1;
    min-width: 0;
    padding: 52px 64px 88px;
    max-width: 900px;
    background: var(--color-white);
}

/* --- Page Header --- */
.page-header {
    margin-bottom: 40px;
    padding-bottom: 28px;
    border-bottom: 1px solid var(--color-border);
}
.page-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.2;
    letter-spacing: -.025em;
}
.page-header .subtitle {
    margin-top: 10px;
    color: var(--color-muted);
    font-size: 15px;
    line-height: 1.65;
}

/* --- Sections --- */
.section {
    margin-bottom: 52px;
}
.section h2 {
    font-size: 19px;
    font-weight: 700;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text);
    letter-spacing: -.02em;
}
.section h3 {
    font-size: 15px;
    font-weight: 600;
    margin: 24px 0 10px;
    color: var(--color-text);
    letter-spacing: -.01em;
}
.section p {
    margin-bottom: 12px;
    line-height: 1.75;
    color: #1e293b;
}
.section ul, .section ol {
    padding-left: 22px;
    margin-bottom: 12px;
}
.section li {
    margin-bottom: 5px;
    line-height: 1.7;
}

/* --- Inline Code --- */
code {
    font-family: var(--font-mono);
    font-size: .82em;
    background: rgba(100,116,139,.1);
    color: #dc2626;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(100,116,139,.12);
}

/* --- Dark Code Blocks (.code-example) --- */
.code-example {
    margin: 22px 0;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--color-code-dark-border);
    box-shadow: var(--shadow-sm);
}
.code-example .code-label {
    background: var(--color-code-dark-header);
    color: #64748b;
    font-size: 11px;
    font-family: var(--font-mono);
    padding: 7px 16px;
    letter-spacing: .06em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--color-code-dark-border);
}
.code-example pre {
    margin: 0;
    background: var(--color-code-dark);
}
.code-example pre code {
    background: transparent;
    color: #1e293b;
    padding: 18px 20px;
    display: block;
    font-size: 13px;
    line-height: 1.7;
    overflow-x: auto;
    border: none;
}

/* Plain pre/code fallback (ohne .code-example wrapper) */
pre:not(.code-example pre) {
    background: var(--color-code-bg);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-left: 3px solid #94a3b8;
    padding: 16px 18px;
    border-radius: var(--radius);
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.7;
    margin: 14px 0;
}
pre:not(.code-example pre) code {
    background: transparent;
    color: inherit;
    padding: 0;
    font-size: inherit;
    border: none;
}

/* highlight.js ? GitHub Light Override fuer .code-example */
.code-example .hljs                          { background: transparent; color: #24292f; }
.code-example .hljs-comment,
.code-example .hljs-quote                    { color: #6e7781; font-style: italic; }
.code-example .hljs-keyword,
.code-example .hljs-selector-tag,
.code-example .hljs-subst                   { color: #cf222e; }
.code-example .hljs-number,
.code-example .hljs-literal,
.code-example .hljs-type                     { color: #0550ae; }
.code-example .hljs-string,
.code-example .hljs-doctag,
.code-example .hljs-regexp                   { color: #0a3069; }
.code-example .hljs-title,
.code-example .hljs-section,
.code-example .hljs-selector-id,
.code-example .hljs-class .hljs-title        { color: #8250df; }
.code-example .hljs-template-variable,
.code-example .hljs-variable                 { color: #953800; }
.code-example .hljs-built_in,
.code-example .hljs-builtin-name             { color: #953800; }
.code-example .hljs-attr,
.code-example .hljs-attribute                { color: #0550ae; }
.code-example .hljs-addition                 { color: #116329; background: #dafbe1; }
.code-example .hljs-deletion                 { color: #82071e; background: #ffebe9; }
.code-example .hljs-meta                     { color: #735c0f; }
.code-example .hljs-emphasis                 { font-style: italic; }
.code-example .hljs-strong                   { font-weight: bold; }

/* --- Alert Boxes --- */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius);
    border: 1px solid;
    margin: 20px 0;
    font-size: 14px;
    line-height: 1.7;
}
.alert-warning { background: var(--color-warning-bg);  border-color: #fde68a; border-left: 4px solid var(--color-warning-border); }
.alert-info    { background: var(--color-info-bg);     border-color: #bfdbfe; border-left: 4px solid var(--color-info-border); }
.alert-success { background: var(--color-success-bg);  border-color: #bbf7d0; border-left: 4px solid var(--color-success-border); }
.alert-danger  { background: #fff1f2;                  border-color: #fecaca; border-left: 4px solid var(--color-danger); }

/* --- Tables --- */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    margin: 16px 0;
}
table th {
    background: #f8fafc;
    font-weight: 600;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--color-muted);
    padding: 10px 14px;
    text-align: left;
    border: 1px solid var(--color-border);
}
table td {
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    vertical-align: top;
    line-height: 1.6;
}
table tr:nth-child(even) td { background: #fafafa; }
table tr { transition: background .1s; }
table tr:hover td { background: #f1f5f9 !important; }

/* --- Parameter Tabellen --- */
.param-table code { font-size: 12px; }
.param-table td:first-child { font-weight: 600; white-space: nowrap; }
.param-required { color: var(--color-danger); font-weight: 700; font-size: 11px; text-transform: uppercase; }

/* Warn-Zeile */
.warn-row td { background: #fff7ed !important; }
.warn-row td:first-child { border-left: 3px solid var(--color-warning-border); }

/* Mapping-Vergleichsraster */
.mapping-compare {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    margin-top: 8px;
    font-size: 12px;
    font-family: var(--font-mono);
    border: 1px solid #fde68a;
    border-radius: var(--radius);
    overflow: hidden;
}
.mapping-compare div { padding: 4px 8px; border-bottom: 1px solid #fde68a; }
.mapping-compare div:last-child,
.mapping-compare div:nth-last-child(2) { border-bottom: none; }
.mapping-compare .mc-head {
    background: #fef3c7;
    font-weight: 700;
    font-family: var(--font-sans);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #92400e;
}
.mapping-compare .mc-this  { background: #fff7ed; }
.mapping-compare .mc-other { background: #fffbeb; border-left: 1px solid #fde68a; }

/* --- URL Display --- */
.url-block {
    background: #f8fafc;
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--color-accent);
    border-radius: var(--radius);
    padding: 12px 16px;
    font-family: var(--font-mono);
    font-size: 12.5px;
    word-break: break-all;
    margin: 12px 0;
    color: var(--color-accent);
}

/* --- Sparten Grid --- */
.sparten-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin: 18px 0;
}
.sparte-card {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 14px 16px;
    font-size: 13.5px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow .2s, transform .2s, border-color .2s;
}
.sparte-card:hover {
    box-shadow: var(--shadow);
    border-color: var(--color-accent);
    transform: translateY(-2px);
}
.sparte-card .sparte-key {
    display: block;
    font-weight: 700;
    color: var(--color-accent);
    font-family: var(--font-mono);
    font-size: 12px;
    margin-bottom: 4px;
}

/* --- Content Links --- */
.content a {
    color: var(--color-accent);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
}
.content a:hover {
    color: var(--color-accent-hover);
}

/* --- Tabs (flows.php) --- */
.tab-bar {
    display: flex;
    gap: 0;
    margin-bottom: 28px;
    background: var(--color-code-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 4px;
}
.tab-btn {
    flex: 1;
    padding: 9px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-muted);
    background: transparent;
    border: none;
    border-radius: calc(var(--radius) - 2px);
    cursor: pointer;
    transition: color .15s, background .15s, box-shadow .15s;
    font-family: var(--font-sans);
    white-space: nowrap;
}
.tab-btn:hover {
    color: var(--color-text);
    background: rgba(255,255,255,.7);
}
.tab-btn.active {
    background: var(--color-white);
    color: var(--color-accent);
    box-shadow: var(--shadow-sm);
    font-weight: 600;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* --- In-Page-TOC --- */
.page-toc {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 2px;
    background: var(--color-code-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 10px 14px;
    margin-bottom: 28px;
    font-size: 13px;
}
.page-toc strong {
    margin-right: 6px;
    color: var(--color-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .08em;
}
.page-toc a {
    color: var(--color-accent);
    text-decoration: none;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
}
.page-toc a:hover {
    background: var(--color-accent-light);
    text-decoration: none;
}

/* --- Sparten-Tab-Bar (info.php) --- */
.sparten-tab-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 4px 0 20px;
}
.sparten-tab-bar a {
    display: inline-block;
    padding: 5px 12px;
    font-size: 12.5px;
    font-weight: 600;
    font-family: var(--font-mono);
    color: var(--color-muted);
    background: var(--color-code-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    text-decoration: none;
    transition: background .15s, color .15s, border-color .15s;
}
.sparten-tab-bar a:hover {
    background: #e2e8f0;
    color: var(--color-text);
    text-decoration: none;
}
.sparten-tab-bar a.active {
    background: var(--color-accent-light);
    border-color: var(--color-accent);
    color: var(--color-accent);
}

/* --- Copy Button (auf dunklen Code-Bloecken) --- */
.copy-btn {
    position: absolute;
    top: 0;
    right: 0;
    padding: 5px 14px;
    font-size: 11px;
    font-family: var(--font-sans);
    font-weight: 500;
    color: #64748b;
    background: rgba(0,0,0,.04);
    border: none;
    border-bottom-left-radius: var(--radius);
    cursor: pointer;
    transition: color .15s, background .15s;
    z-index: 2;
    letter-spacing: .02em;
}
.copy-btn:hover  { background: rgba(0,0,0,.08); color: #0f172a; }
.copy-btn.copied { color: #166534; background: rgba(22,163,74,.12); }

/* --- Back-to-Top Button --- */
.back-to-top {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--color-accent);
    color: #fff;
    border: none;
    font-size: 16px;
    line-height: 42px;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(37,99,235,.4);
    opacity: 0;
    transform: translateY(12px) scale(.9);
    transition: opacity .25s, transform .25s, background .15s, box-shadow .15s;
    pointer-events: none;
    z-index: 999;
}
.back-to-top.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}
.back-to-top:hover {
    background: var(--color-accent-hover);
    box-shadow: 0 6px 20px rgba(37,99,235,.5);
    transform: translateY(-2px) scale(1.05);
}

/* --- Mobile Hamburger Toggle --- */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 1100;
    width: 38px;
    height: 38px;
    padding: 8px 6px;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    cursor: pointer;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    box-shadow: var(--shadow-sm);
}
.mobile-menu-toggle span {
    display: block;
    height: 2px;
    background: var(--color-text);
    border-radius: 1px;
    transition: transform .2s, opacity .2s;
}
.mobile-menu-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.mobile-menu-toggle.open span:nth-child(2) { opacity: 0; }
.mobile-menu-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 1000;
    backdrop-filter: blur(4px);
}
.sidebar-overlay.open { display: block; }

/* --- Transitions --- */
.alert { transition: box-shadow .15s; }
.alert:hover { box-shadow: var(--shadow-sm); }

/* --- Hilfsklassen --- */
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.mt-sm   { margin-top: 8px; }
.mt-md   { margin-top: 16px; }

/* --- Formular-Gruppen-Header (demo.php) --- */
.form-group-header { background: #fee2e2; font-weight: 700; padding: 6px 8px; color: #991b1b; }
.form-group-header a { color: #991b1b; }

/* --- Verbesserte Form-Inputs (Demo) --- */
input[type="text"], select, textarea {
    font-family: var(--font-sans);
    font-size: 13.5px;
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-white);
    color: var(--color-text);
    transition: border-color .15s, box-shadow .15s;
}
input[type="text"]:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
input[type="submit"] {
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    background: var(--color-accent);
    border: none;
    border-radius: var(--radius);
    padding: 10px 24px;
    cursor: pointer;
    transition: background .15s, box-shadow .15s;
    letter-spacing: -.01em;
}
input[type="submit"]:hover {
    background: var(--color-accent-hover);
    box-shadow: 0 4px 12px rgba(37,99,235,.3);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .mobile-menu-toggle { display: flex; }
    .sidebar {
        position: fixed;
        left: 0; top: 0;
        z-index: 1050;
        transform: translateX(-100%);
        transition: transform .25s ease;
    }
    .sidebar.open { transform: translateX(0); }
    .content {
        padding: 60px 20px 48px;
    }
}

