/**
 * QWiki Input – Frontend Styles
 *
 * Enthält Styles für Standard-HTML sowie für die aus QWiki
 * konvertierten Elemente (Accordions, Rollen, Links, etc.)
 */

/* =========================================================================
   Container
   ========================================================================= */

.qwiki-content {
    margin: 1em 0;
    padding: 1em;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    background: #fafafa;
    overflow-x: auto;
    line-height: 1.6;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #1a1a1a;
}

/* =========================================================================
   Überschriften
   ========================================================================= */

.qwiki-content h1,
.qwiki-content h2,
.qwiki-content h3,
.qwiki-content h4,
.qwiki-content h5,
.qwiki-content h6 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
}

.qwiki-content h1 {
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 0.5rem;
}

.qwiki-content h2 {
    color: #374151;
}

/* =========================================================================
   Tabellen
   ========================================================================= */

.qwiki-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 1em 0;
}

.qwiki-content th,
.qwiki-content td {
    border: 1px solid #d1d5db;
    padding: 0.5rem;
    text-align: left;
}

.qwiki-content th {
    background: #f3f4f6;
    font-weight: 600;
}

.qwiki-content tr:nth-child(even) {
    background: #f9f9f9;
}

/* =========================================================================
   Bilder
   ========================================================================= */

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

/* =========================================================================
   Code
   ========================================================================= */

.qwiki-content pre,
.qwiki-content code {
    background: #f4f4f4;
    border: 1px solid #e0e0e0;
    border-radius: 3px;
    padding: 2px 6px;
    font-size: 0.9em;
}

.qwiki-content pre {
    padding: 1em;
    overflow-x: auto;
}

.qwiki-content pre code {
    border: none;
    padding: 0;
    background: transparent;
}

/* =========================================================================
   Links
   ========================================================================= */

.qwiki-content a {
    color: #0073aa;
    text-decoration: underline;
}

.qwiki-content a:hover {
    color: #005177;
}

.qwiki-content a.qwiki-link {
    color: #2563eb;
}

.qwiki-content a.qwiki-link:hover {
    color: #1d4ed8;
}

/* =========================================================================
   Listen
   ========================================================================= */

.qwiki-content ul,
.qwiki-content ol {
    margin: 0.5em 0;
    padding-left: 2em;
}

/* =========================================================================
   Zitate
   ========================================================================= */

.qwiki-content blockquote {
    margin: 1em 0;
    padding: 0.5em 1em;
    border-left: 4px solid #0073aa;
    background: #f0f7fc;
}

/* =========================================================================
   QWiki Accordion (klappbare Absätze)
   → konvertiert aus <qwiki-accordion> zu <details>/<summary>
   ========================================================================= */

.qwiki-content .qwiki-accordion {
    border: 1px solid #d1d5db;
    border-radius: 4px;
    margin: 0.5rem 0;
    overflow: hidden;
}

.qwiki-content .qwiki-accordion summary {
    padding: 0.75rem 1rem;
    cursor: pointer;
    font-weight: 600;
    background: #f9fafb;
    border-bottom: 1px solid transparent;
    transition: background-color 0.15s ease;
    list-style: none;
}

.qwiki-content .qwiki-accordion summary::-webkit-details-marker {
    display: none;
}

.qwiki-content .qwiki-accordion summary::before {
    content: '\25B6';
    display: inline-block;
    margin-right: 0.5rem;
    font-size: 0.75em;
    transition: transform 0.2s ease;
}

.qwiki-content .qwiki-accordion[open] summary::before {
    transform: rotate(90deg);
}

.qwiki-content .qwiki-accordion summary:hover {
    background: #f3f4f6;
}

.qwiki-content .qwiki-accordion[open] summary {
    border-bottom-color: #d1d5db;
}

.qwiki-content .qwiki-accordion .accordion-content {
    padding: 0.75rem 1rem;
}

/* =========================================================================
   QWiki Rollen
   → konvertiert aus <qwiki-role> zu <span class="qwiki-role">
   ========================================================================= */

.qwiki-content .qwiki-role {
    background: #dbeafe;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-size: 0.9em;
    white-space: nowrap;
}

/* =========================================================================
   PDF-Viewer (Dateiseiten)
   ========================================================================= */

.qwiki-pdf-viewer {
    width: 100%;
    height: 85vh;
    min-height: 600px;
    max-height: 1200px;
    margin-bottom: 0.75rem;
}

.qwiki-pdf-viewer iframe {
    width: 100%;
    height: 100%;
    border: 1px solid #d1d5db;
    border-radius: 4px;
}

.qwiki-file-page {
    padding: 0.5em;
    background: transparent;
    border: none;
}

/* =========================================================================
   Excel-Viewer (Dateiseiten)
   ========================================================================= */

.qwiki-excel-viewer {
    width: 100%;
    height: 85vh;
    min-height: 400px;
    max-height: 1000px;
    margin-bottom: 0.75rem;
}

.qwiki-excel-viewer iframe {
    width: 100%;
    height: 100%;
    border: 1px solid #d1d5db;
    border-radius: 4px;
}

/* =========================================================================
   Word-Viewer (Dateiseiten)
   ========================================================================= */

.qwiki-word-viewer {
    width: 100%;
    height: 85vh;
    min-height: 500px;
    max-height: 1200px;
    margin-bottom: 0.75rem;
}

.qwiki-word-viewer iframe {
    width: 100%;
    height: 100%;
    border: 1px solid #d1d5db;
    border-radius: 4px;
}

/* =========================================================================
   Download-Links (PDF, Excel, Word, Dateien)
   ========================================================================= */

.qwiki-pdf-download,
.qwiki-excel-download,
.qwiki-word-download,
.qwiki-file-download {
    margin: 0.5rem 0;
    text-align: center;
}

.qwiki-pdf-download a,
.qwiki-excel-download a,
.qwiki-word-download a,
.qwiki-file-download a {
    display: inline-block;
    padding: 0.5rem 1.25rem;
    background: #0073aa;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 500;
    transition: background-color 0.15s ease;
}

.qwiki-pdf-download a:hover,
.qwiki-excel-download a:hover,
.qwiki-word-download a:hover,
.qwiki-file-download a:hover {
    background: #005177;
    color: #fff;
}

/* =========================================================================
   Fehlermeldungen (nur für eingeloggte Admins/Editoren sichtbar)
   ========================================================================= */

.qwiki-error {
    margin: 1em 0;
    padding: 12px 16px;
    border: 1px solid #d63638;
    border-left-width: 4px;
    border-radius: 4px;
    background: #fcf0f1;
    color: #8a1116;
    font-size: 0.9em;
}

.qwiki-error a {
    color: #0073aa;
}

/* =========================================================================
   Print
   ========================================================================= */

@media print {
    .qwiki-content {
        border: none;
        background: none;
        padding: 0;
        margin: 0;
    }

    .qwiki-content img {
        page-break-inside: avoid;
    }

    .qwiki-content h2 {
        page-break-after: avoid;
    }

    .qwiki-content .qwiki-accordion {
        page-break-inside: avoid;
    }

    .qwiki-content .qwiki-accordion[open] summary {
        border-bottom: none;
    }

    .qwiki-pdf-viewer,
    .qwiki-excel-viewer,
    .qwiki-word-viewer {
        display: none;
    }

    .qwiki-pdf-download a::after,
    .qwiki-excel-download a::after,
    .qwiki-word-download a::after {
        content: ' (' attr(href) ')';
        font-size: 0.8em;
    }
}
