/**
 * Octoserv Dokumentation - Stylesheet
 * Farben aus dem Octoserv Produktiv-CSS
 */

/* ===== CSS Variables ===== */
:root {
    --primary: #006899;
    --primary-dark: #003450;
    --primary-light: #e8f4fa;
    --accent: #e09000;
    --accent-dark: #c27a00;
    --accent-light: #fef3dc;
    --sidebar-bg: #1f2937;
    --sidebar-text: #f9fafb;
    --sidebar-hover: #374151;
    --sidebar-active: #111827;
    --page-bg: #f3f4f6;
    --card-bg: #ffffff;
    --heading: #111827;
    --text: #374151;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --border-light: #f3f4f6;
    --success: #047857;
    --success-bg: #ecfdf5;
    --error: #dc2626;
    --error-bg: #fef2f2;
    --sidebar-width: 280px;
    --header-height: 64px;
    --toc-width: 220px;
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-height) + 24px);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 15px;
    line-height: 1.7;
    color: var(--text);
    background: var(--page-bg);
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
}

/* ===== Header ===== */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    z-index: 1000;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    flex-shrink: 0;
}

.header-logo img {
    height: 36px;
    width: auto;
}

.header-logo .logo-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
    border-left: 1px solid var(--border);
    padding-left: 12px;
    white-space: nowrap;
}

.header-spacer {
    flex: 1;
}

/* Search */
.header-search {
    position: relative;
    width: 320px;
    flex-shrink: 0;
}

.header-search input {
    width: 100%;
    padding: 8px 16px 8px 40px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text);
    background: var(--page-bg);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.header-search input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 104, 153, 0.1);
    background: var(--card-bg);
}

.header-search input::placeholder {
    color: var(--text-muted);
}

.header-search .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.header-search .search-shortcut {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    color: var(--text-muted);
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 6px;
    pointer-events: none;
}

/* Search Results Dropdown */
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    max-height: 400px;
    overflow-y: auto;
    display: none;
    z-index: 1001;
}

.search-results.active {
    display: block;
}

.search-result-item {
    display: block;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-light);
    transition: background 0.15s;
    cursor: pointer;
    text-decoration: none;
    color: var(--text);
}

.search-result-item:hover,
.search-result-item.active {
    background: var(--primary-light);
    text-decoration: none;
    color: var(--text);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-chapter {
    font-size: 11px;
    color: var(--primary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.search-result-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--heading);
    margin-top: 2px;
}

.search-no-results {
    padding: 24px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

/* Mobile menu toggle */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--text);
    margin-right: 8px;
}

.menu-toggle svg {
    width: 24px;
    height: 24px;
}

/* ===== Sidebar ===== */
.sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    overflow-y: auto;
    z-index: 900;
    padding: 16px 0;
    transition: transform 0.3s ease;
}

.sidebar-nav-group {
    margin-bottom: 4px;
}

.sidebar-nav-group-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #9ca3af;
    cursor: pointer;
    user-select: none;
    transition: color 0.2s;
}

.sidebar-nav-group-title:hover {
    color: var(--sidebar-text);
}

.sidebar-nav-group-title .chevron {
    width: 16px;
    height: 16px;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.sidebar-nav-group.collapsed .chevron {
    transform: rotate(-90deg);
}

.sidebar-nav-group.collapsed .sidebar-nav-links {
    display: none;
}

.sidebar-nav-links {
    list-style: none;
}

.sidebar-nav-link {
    display: block;
    padding: 7px 20px 7px 28px;
    color: #d1d5db;
    font-size: 14px;
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: all 0.15s;
}

.sidebar-nav-link:hover {
    color: var(--sidebar-text);
    background: var(--sidebar-hover);
    text-decoration: none;
}

.sidebar-nav-link.active {
    color: var(--accent);
    border-left-color: var(--accent);
    background: rgba(224, 144, 0, 0.08);
    font-weight: 600;
}

/* ===== Main Content ===== */
.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--header-height);
    min-height: calc(100vh - var(--header-height));
    padding: 32px 40px;
    max-width: 1200px;
}

/* Breadcrumb */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.breadcrumb a {
    color: var(--text-muted);
    text-decoration: none;
}

.breadcrumb a:hover {
    color: var(--primary);
    text-decoration: underline;
}

.breadcrumb .separator {
    color: #d1d5db;
}

.breadcrumb .current {
    color: var(--text);
    font-weight: 500;
}

/* Article Content */
.article-content {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 40px 48px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.article-content h1 {
    font-size: 32px;
    font-weight: 700;
    color: var(--heading);
    margin-bottom: 8px;
    line-height: 1.3;
}

.article-subtitle {
    font-size: 16px;
    color: var(--text-muted);
    margin-bottom: 32px;
    line-height: 1.5;
}

.article-content h2 {
    font-size: 22px;
    font-weight: 600;
    color: var(--heading);
    margin-top: 40px;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border-light);
}

.article-content h3 {
    font-size: 17px;
    font-weight: 600;
    color: var(--heading);
    margin-top: 28px;
    margin-bottom: 12px;
}

.article-content h4 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin-top: 20px;
    margin-bottom: 8px;
}

.article-content p {
    margin-bottom: 16px;
}

.article-content ul,
.article-content ol {
    margin-bottom: 16px;
    padding-left: 24px;
}

.article-content li {
    margin-bottom: 6px;
}

.article-content strong {
    font-weight: 600;
    color: var(--heading);
}

.article-content code {
    background: var(--page-bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 13px;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    color: var(--primary-dark);
}

.article-content pre {
    background: var(--sidebar-bg);
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 16px;
    overflow-x: auto;
}

.article-content pre code {
    background: none;
    border: none;
    padding: 0;
    color: #e5e7eb;
    font-size: 13px;
}

.article-content blockquote {
    border-left: 4px solid var(--accent);
    background: var(--accent-light);
    padding: 12px 20px;
    margin-bottom: 16px;
    border-radius: 0 8px 8px 0;
    color: var(--text);
}

.article-content blockquote p:last-child {
    margin-bottom: 0;
}

.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
    font-size: 14px;
}

.article-content th {
    background: var(--page-bg);
    font-weight: 600;
    text-align: left;
    padding: 10px 14px;
    border: 1px solid var(--border);
    color: var(--heading);
}

.article-content td {
    padding: 10px 14px;
    border: 1px solid var(--border);
}

.article-content hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 32px 0;
}

/* In-page TOC */
.page-toc {
    background: var(--primary-light);
    border: 1px solid #cce4f0;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 32px;
}

.page-toc-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--primary);
    margin-bottom: 8px;
}

.page-toc ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.page-toc li {
    margin-bottom: 4px;
}

.page-toc a {
    font-size: 14px;
    color: var(--primary-dark);
    text-decoration: none;
    display: block;
    padding: 3px 0;
}

.page-toc a:hover {
    color: var(--accent);
    text-decoration: none;
}

.page-toc .toc-h3 {
    padding-left: 16px;
    font-size: 13px;
    color: var(--text-muted);
}

.page-toc .toc-h3:hover {
    color: var(--accent);
}

/* ===== Screenshot Placeholder ===== */
.screenshot-placeholder {
    background: var(--page-bg);
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 40px 24px;
    text-align: center;
    margin: 24px 0;
    color: var(--text-muted);
}

.screenshot-placeholder svg {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.screenshot-placeholder .placeholder-label {
    font-size: 14px;
    font-weight: 500;
}

.screenshot-placeholder .placeholder-desc {
    font-size: 12px;
    margin-top: 4px;
}

/* ===== Prev/Next Navigation ===== */
.prev-next-nav {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.prev-next-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.2s, box-shadow 0.2s;
    flex: 1;
    max-width: 48%;
}

.prev-next-link:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(0, 104, 153, 0.08);
    text-decoration: none;
    color: var(--text);
}

.prev-next-link.next {
    text-align: right;
    justify-content: flex-end;
    margin-left: auto;
}

.prev-next-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.prev-next-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--primary);
    margin-top: 2px;
}

.prev-next-arrow {
    color: var(--primary);
    flex-shrink: 0;
}

/* ===== Footer ===== */
.site-footer {
    margin-left: var(--sidebar-width);
    padding: 24px 40px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    border-top: 1px solid var(--border);
}

/* ===== Index Page / Hero ===== */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border-radius: 12px;
    padding: 48px;
    margin-bottom: 32px;
    text-align: center;
}

.hero img {
    height: 48px;
    margin-bottom: 16px;
    filter: brightness(0) invert(1);
}

.hero h1 {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 12px;
}

.hero p {
    font-size: 17px;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
}

/* Feature Cards Grid */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 24px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(0, 104, 153, 0.08);
}

.card a {
    text-decoration: none;
}

.card-icon {
    width: 40px;
    height: 40px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    font-size: 20px;
}

.card h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--heading);
    margin-bottom: 6px;
}

.card p {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
}

.card-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 500;
    color: var(--primary);
    margin-top: 10px;
}

.card-link:hover {
    color: var(--accent);
    text-decoration: none;
}

/* Section titles on index */
.section-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--heading);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--accent);
    display: inline-block;
}

.section-wrap {
    margin-bottom: 40px;
}

/* ===== Info/Tip/Warning Boxes ===== */
.info-box {
    border-radius: 8px;
    padding: 14px 18px;
    margin-bottom: 16px;
    font-size: 14px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.info-box.tip {
    background: var(--success-bg);
    border: 1px solid #a7f3d0;
    color: var(--success);
}

.info-box.warning {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
}

.info-box.info {
    background: var(--primary-light);
    border: 1px solid #bae6fd;
    color: var(--primary-dark);
}

.info-box-icon {
    flex-shrink: 0;
    font-size: 18px;
    line-height: 1;
}

/* ===== Sidebar overlay for mobile ===== */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 899;
}

.sidebar-overlay.active {
    display: block;
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .menu-toggle {
        display: block;
    }

    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 24px 20px;
    }

    .site-footer {
        margin-left: 0;
    }

    .header-search {
        width: 200px;
    }

    .header-logo .logo-subtitle {
        display: none;
    }
}

@media (max-width: 768px) {
    .header-search {
        width: 160px;
    }

    .header-search .search-shortcut {
        display: none;
    }

    .article-content {
        padding: 24px 20px;
    }

    .article-content h1 {
        font-size: 26px;
    }

    .hero {
        padding: 32px 20px;
    }

    .hero h1 {
        font-size: 28px;
    }

    .prev-next-nav {
        flex-direction: column;
    }

    .prev-next-link {
        max-width: 100%;
    }

    .card-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .header-search {
        width: 120px;
    }

    .main-content {
        padding: 16px 12px;
    }

    .article-content {
        padding: 20px 16px;
        border-radius: 8px;
    }
}

/* ===== Print ===== */
@media print {
    .site-header,
    .sidebar,
    .sidebar-overlay,
    .header-search,
    .menu-toggle,
    .prev-next-nav,
    .page-toc,
    .site-footer {
        display: none !important;
    }

    .main-content {
        margin: 0;
        padding: 0;
        max-width: 100%;
    }

    .article-content {
        border: none;
        box-shadow: none;
        padding: 0;
    }

    .article-content h2 {
        page-break-before: always;
    }

    .article-content h2:first-of-type {
        page-break-before: avoid;
    }

    body {
        font-size: 12pt;
        color: #000;
        background: #fff;
    }

    a {
        color: #000;
        text-decoration: underline;
    }

    .screenshot-placeholder {
        border-style: solid;
    }
}

/* ===== Utility Classes ===== */
.text-accent {
    color: var(--accent);
}

.text-primary {
    color: var(--primary);
}

.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mb-sm { margin-bottom: 8px; }
.mb-md { margin-bottom: 16px; }
.mb-lg { margin-bottom: 32px; }
