/* ========================================
   ARTIKEL-CONTENT STYLES

   Styles für dynamisches HTML aus dem TipTap-Editor.
   Diese Styles werden auf MarkupString-Content angewendet,
   der direkt aus der Datenbank kommt.
   ======================================== */

.article-content {
    font-family: "Noto Sans", sans-serif;
    font-size: 1rem;
    line-height: 1.75;
    color: var(--text-colors-general-text-default, #1a1a1a);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Überschriften */
.article-content h1 {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.3;
    margin: 2rem 0 1rem;
}

.article-content h2 {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.35;
    margin: 3rem 0 1.25rem;
    padding-bottom: 0.5rem;
    border-bottom: 3px solid var(--surface-colors-border-accent, #0066cc);
    position: relative;
    scroll-margin-top: 2rem;
    color: var(--text-colors-general-text-default, #1a1a1a);
}

.article-content h2:first-child {
    margin-top: 1rem;
}

/* Anker-Symbol neben H2-Überschriften */
.article-content h2 .heading-anchor {
    position: absolute;
    left: -1.75rem;
    opacity: 0;
    transition: opacity 0.2s ease;
    font-size: 1rem;
    cursor: pointer;
    user-select: none;
    text-decoration: none;
}

.article-content h2:hover .heading-anchor {
    opacity: 0.5;
}

.article-content h2 .heading-anchor:hover {
    opacity: 1;
}

.article-content h3 {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.4;
    margin: 2.5rem 0 1rem;
    color: var(--text-colors-general-text-emphasis, #2c3e50);
    padding-left: 0.75rem;
    border-left: 4px solid var(--surface-colors-border-subtle, #ddd);
}

.article-content h4 {
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.4;
    margin: 2rem 0 0.75rem;
    color: var(--text-colors-general-text-emphasis, #2c3e50);
}

.article-content h5,
.article-content h6 {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
    margin: 1.5rem 0 0.5rem;
    color: var(--text-colors-general-text-default, #4a5568);
}

/* Text & Listen */
.article-content p {
    margin: 0 0 1.25rem;
}

.article-content strong {
    font-weight: 700;
    color: var(--text-colors-general-text-emphasis, #1a1a1a);
}

.article-content ul,
.article-content ol {
    margin: 1rem 0 1.5rem;
    padding-left: 2rem;
    line-height: 1.6;
}

.article-content li {
    margin-bottom: 0.15rem;
    padding-left: 0.25rem;
}

.article-content li:last-child {
    margin-bottom: 0;
}

/* Absätze innerhalb von Listen: Abstand reduzieren */
.article-content li > p {
    margin-bottom: 0.25rem;
}

.article-content li > p:last-child {
    margin-bottom: 0;
}

.article-content ul ul,
.article-content ol ol,
.article-content ul ol,
.article-content ol ul {
    margin-top: 0.25rem;
    margin-bottom: 0.25rem;
}

/* Geschachtelte Listen */
.article-content li > ul,
.article-content li > ol {
    margin-top: 0.35rem;
}

/* Links */
.article-content a {
    color: var(--text-colors-general-text-link, #0066cc);
    text-decoration: underline;
}

.article-content a:hover {
    text-decoration: none;
}

/* Bilder & Figures */
.article-content figure {
    margin: 2rem 0;
    max-width: 100%;
    text-align: left;
}

.article-content figure img {
    max-width: 100%;
    max-height: 600px;
    height: auto;
    display: block;
    margin: 0;
    border-radius: 8px;
    object-fit: contain;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    cursor: zoom-in;
}

/* Bildgrößen */
.article-content figure.image-size-small {
    max-width: 40%;
}

.article-content figure.image-size-medium {
    max-width: 60%;
}

.article-content figure.image-size-large {
    max-width: 80%;
}

.article-content figure.image-size-full {
    max-width: 100%;
}

.article-content figcaption {
    margin-top: 0.75rem;
    font-size: 0.875rem;
    color: var(--text-colors-general-text-subtle, #666);
    font-style: italic;
    text-align: left;
    line-height: 1.4;
}

/* Legacy Bilder ohne figure */
.article-content img:not(figure img) {
    max-width: 100%;
    max-height: 600px;
    height: auto;
    display: block;
    margin: 1.5rem 0;
    border-radius: 8px;
    object-fit: contain;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    cursor: zoom-in;
}

/* Tabellen */
.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.925rem;
}

.article-content th,
.article-content td {
    border: 1px solid var(--surface-colors-border-default, #ddd);
    padding: 0.5rem 0.75rem;
    text-align: left;
}

.article-content th {
    background: var(--surface-colors-background-subtle, #f5f5f5);
    font-weight: 600;
}

/* Code */
.article-content pre {
    background: var(--surface-colors-background-subtle, #f5f5f5);
    border-radius: 6px;
    padding: 1rem;
    overflow-x: auto;
    font-size: 0.875rem;
    line-height: 1.5;
    margin: 1rem 0;
}

.article-content code {
    font-family: "Fira Code", "Consolas", monospace;
    font-size: 0.875em;
    background: var(--surface-colors-background-subtle, #f0f0f0);
    padding: 0.15rem 0.35rem;
    border-radius: 3px;
}

.article-content pre code {
    background: none;
    padding: 0;
}

/* Blockquotes */
.article-content blockquote {
    border-left: 4px solid var(--surface-colors-border-default, #ccc);
    margin: 1.5rem 0;
    padding: 1rem 1.25rem;
    background: var(--surface-colors-background-subtle, #f5f5f5);
    border-radius: 4px;
    color: var(--text-colors-general-text-default, #333);
}

/* Info-Box (Hinweis) - Blau */
.article-content blockquote.info,
.article-content .info-box {
    background: #e7f3ff;
    border-left-color: #0066cc;
    color: #003d7a;
}

/* Warning-Box (Warnung) - Gelb/Orange */
.article-content blockquote.warning,
.article-content .warning-box {
    background: #fff4e5;
    border-left-color: #ff9800;
    color: #663c00;
}

/* Success-Box (Erfolg) - Grün */
.article-content blockquote.success,
.article-content .success-box {
    background: #e8f5e9;
    border-left-color: #4caf50;
    color: #1b5e20;
}

/* Danger-Box (Gefahr/Fehler) - Rot */
.article-content blockquote.danger,
.article-content .danger-box {
    background: #ffebee;
    border-left-color: #f44336;
    color: #b71c1c;
}

/* Paragraphen in Boxen: kein übermäßiger Abstand */
.article-content blockquote p:last-child {
    margin-bottom: 0;
}

.article-content blockquote strong {
    font-weight: 700;
}

/* Trennlinien */
.article-content hr {
    border: none;
    border-top: 1px solid var(--surface-colors-border-default, #e0e0e0);
    margin: 2rem 0;
}

/* ========================================
   ARTIKEL-LINKS
   ======================================== */

.article-content .article-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    margin: 0.5rem 0;
    background: var(--surface-colors-background-subtle, #f8f9fa);
    border: 1px solid var(--surface-colors-border-default, #e0e0e0);
    border-left: 3px solid var(--surface-colors-border-accent, #0066cc);
    border-radius: 4px;
    text-decoration: none;
    transition: all 0.2s ease;
    color: var(--text-colors-general-text-default, #1a1a1a);
}

.article-content .article-link:hover {
    background: var(--surface-colors-background-default, #fff);
    border-color: var(--surface-colors-border-accent, #0066cc);
    box-shadow: 0 2px 8px rgba(0, 102, 204, 0.15);
    transform: translateY(-1px);
}

.article-content .article-link__icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.article-content .article-link__content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.article-content .article-link__title {
    font-weight: 600;
    color: var(--text-colors-general-text-primary, #0066cc);
}

.article-content .article-link__ic {
    font-size: 0.75rem;
    padding: 0.125rem 0.5rem;
    background: var(--surface-colors-background-primary, #e3f2fd);
    color: var(--text-colors-general-text-primary, #1976d2);
    border-radius: 0.25rem;
    font-weight: 600;
}

.article-content .article-link-error {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: #ffebee;
    color: #b71c1c;
    border-radius: 4px;
    font-size: 0.875rem;
}

/* ========================================
   RESPONSIVE
   ======================================== */

/* Tablet */
@media screen and (min-width: 768px) and (max-width: 1023px) {
    .article-content {
        font-size: 0.9375rem;
    }
}

/* Mobile */
@media screen and (max-width: 767px) {
    .article-content {
        font-size: 0.875rem;
        line-height: 1.65;
    }

    /* Anker-Symbol auf Mobile verstecken */
    .article-content h2 .heading-anchor {
        display: none;
    }

    .article-content h1 {
        font-size: 1.4rem;
    }

    .article-content h2 {
        font-size: 1.2rem;
    }

    .article-content h3 {
        font-size: 1.05rem;
    }
}

/* Tabellen - Horizontal Scroll für Tablet und Mobile */
@media (max-width: 1023px) {
    .article-content figure img,
    .article-content img:not(figure img) {
        max-height: 400px;
    }

    .article-content figure.image-size-small,
    .article-content figure.image-size-medium,
    .article-content figure.image-size-large {
        max-width: 100%;
    }

    /* Tabellen - Horizontal Scroll */
    .article-content table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }

    .article-content thead,
    .article-content tbody,
    .article-content tr {
        display: table;
        width: 100%;
        table-layout: fixed;
    }

    .article-content th,
    .article-content td {
        min-width: 120px;
        white-space: normal;
        word-wrap: break-word;
    }
}

/* ========================================
   VIDEO-PLAYER STYLES
   ======================================== */

/* Video-Container */
.article-content .video-container {
    margin: 2rem 0;
    max-width: 100%;
    width: 100%;
}

.article-content .video-container video {
    width: 100%;
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    background: #000;
    display: block;
}

.article-content .video-container .video-title {
    margin: 0.5rem 0 0 0;
    font-size: 0.875rem;
    color: var(--text-colors-general-text-subtle, #666);
    font-style: italic;
}

/* Responsive Video-Player */
@media screen and (max-width: 767px) {
    .article-content .video-container {
        margin: 1.5rem 0;
    }

    .article-content .video-container video {
        border-radius: 4px;
    }
}

/* ========================================
   DARK MODE
   ======================================== */

html[etask-color-mode="dark"] .article-content {
    color: var(--text-colors-general-text-default, #e0e0e0);
}

html[etask-color-mode="dark"] .article-content a {
    color: var(--text-colors-general-text-link, #4a9eff);
}

html[etask-color-mode="dark"] .article-content h2 {
    color: #e0e0e0;
    border-bottom-color: var(--surface-colors-border-accent, #4a9eff);
}

html[etask-color-mode="dark"] .article-content h3 {
    color: #d0d0d0;
    border-left-color: var(--surface-colors-border-subtle, #505050);
}

html[etask-color-mode="dark"] .article-content h4,
html[etask-color-mode="dark"] .article-content h5,
html[etask-color-mode="dark"] .article-content h6 {
    color: #c0c0c0;
}

html[etask-color-mode="dark"] .article-content strong,
html[etask-color-mode="dark"] .article-content b {
    color: #f0f0f0 !important;
}

html[etask-color-mode="dark"] .article-content em {
    color: var(--text-colors-general-text-default, #e0e0e0);
}

html[etask-color-mode="dark"] .article-content figcaption {
    color: var(--text-colors-general-text-subtle, #b0b0b0);
}

html[etask-color-mode="dark"] .article-content th,
html[etask-color-mode="dark"] .article-content td {
    border-color: var(--surface-colors-border-default, #404040);
}

html[etask-color-mode="dark"] .article-content th {
    background: var(--surface-colors-background-subtle, #2a2a2a);
}

html[etask-color-mode="dark"] .article-content pre {
    background: var(--surface-colors-background-subtle, #1a1a1a);
    border: 1px solid var(--surface-colors-border-default, #404040);
}

html[etask-color-mode="dark"] .article-content code {
    background: var(--surface-colors-background-subtle, #2a2a2a);
    color: var(--text-colors-general-text-default, #e0e0e0);
}

html[etask-color-mode="dark"] .article-content pre code {
    background: none;
}

html[etask-color-mode="dark"] .article-content blockquote {
    border-left-color: var(--surface-colors-border-default, #505050);
    color: var(--text-colors-general-text-subtle, #b0b0b0);
}

html[etask-color-mode="dark"] .article-content hr {
    border-top-color: var(--surface-colors-border-default, #404040);
}

/* Bilder: Dunklerer Schatten */
html[etask-color-mode="dark"] .article-content figure img,
html[etask-color-mode="dark"] .article-content img:not(figure img) {
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}
