﻿html, body {
    font-family: 'Roboto', sans-serif;
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.mud-table-toolbar {
    height: auto !important;
}

/* ============================================
   E-Mail Beschreibung formatieren (bestehend)
   ============================================ */
.ticket-description {
    background: #f5f5f5;
    padding: 16px;
    border-radius: 4px;
    line-height: 1.6;
    max-width: 100%;
    overflow-x: auto;
}

    .ticket-description p {
        margin-bottom: 12px;
    }

    .ticket-description img {
        max-width: 100%;
        height: auto;
    }

    .ticket-description table {
        border-collapse: collapse;
        width: 100%;
        margin: 12px 0;
    }

        .ticket-description table td,
        .ticket-description table th {
            border: 1px solid #ddd;
            padding: 8px;
        }

    .ticket-description a {
        color: #1976d2;
        text-decoration: none;
    }

        .ticket-description a:hover {
            text-decoration: underline;
        }

    /* E-Mail Header entfernen falls vorhanden */
    .ticket-description style,
    .ticket-description script,
    .ticket-description meta {
        display: none;
    }

/* ============================================
   NEU: Email-Content Styles für Kommentare
   ============================================ */
.email-content {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    background: white;
    padding: 15px;
    border-radius: 4px;
}

    .email-content p {
        margin: 0 0 10px 0;
    }

        .email-content p:last-child {
            margin-bottom: 0;
        }

    .email-content a {
        color: #1976d2;
        text-decoration: none;
        word-break: break-word;
    }

        .email-content a:hover {
            text-decoration: underline;
        }

    .email-content img {
        max-width: 100%;
        height: auto;
        border-radius: 4px;
        margin: 10px 0;
    }

    .email-content blockquote {
        border-left: 4px solid #e0e0e0;
        padding-left: 15px;
        margin: 10px 0;
        color: #666;
        font-style: italic;
    }

    .email-content pre {
        background: #f5f5f5;
        padding: 10px;
        border-radius: 4px;
        overflow-x: auto;
        font-family: 'Courier New', monospace;
        font-size: 13px;
        line-height: 1.4;
    }

    .email-content code {
        background: #f5f5f5;
        padding: 2px 6px;
        border-radius: 3px;
        font-family: 'Courier New', monospace;
        font-size: 13px;
    }

    .email-content pre code {
        background: transparent;
        padding: 0;
    }

    /* Tabellen */
    .email-content table {
        border-collapse: collapse;
        width: 100%;
        margin: 10px 0;
    }

        .email-content table td,
        .email-content table th {
            border: 1px solid #e0e0e0;
            padding: 8px;
            text-align: left;
        }

        .email-content table th {
            background: #f5f5f5;
            font-weight: 600;
        }

    /* Listen */
    .email-content ul,
    .email-content ol {
        margin: 10px 0;
        padding-left: 25px;
    }

    .email-content li {
        margin: 5px 0;
    }

    /* Überschriften */
    .email-content h1,
    .email-content h2,
    .email-content h3,
    .email-content h4,
    .email-content h5,
    .email-content h6 {
        margin: 15px 0 10px 0;
        font-weight: 600;
        line-height: 1.3;
    }

    .email-content h1 {
        font-size: 24px;
    }

    .email-content h2 {
        font-size: 20px;
    }

    .email-content h3 {
        font-size: 18px;
    }

    .email-content h4 {
        font-size: 16px;
    }

    /* Horizontale Linien */
    .email-content hr {
        border: none;
        border-top: 1px solid #e0e0e0;
        margin: 15px 0;
    }

    /* Sicherheit: Verstecke gefährliche Elemente */
    .email-content script,
    .email-content style,
    .email-content iframe,
    .email-content object,
    .email-content embed,
    .email-content form {
        display: none !important;
    }

/* ============================================
   Kommentar-spezifische Styles
   ============================================ */

/* Kommentar-Box Styling (falls du MudPaper verwendest) */
.comment-box {
    transition: box-shadow 0.2s ease;
}

    .comment-box:hover {
        box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    }

/* Interne Notiz - warme Orange-Linie */
.comment-internal {
    border-left: 4px solid #fb8c00;
}

/* Kunden-Kommentar - blaue Linie */
.comment-customer {
    border-left: 4px solid #1976d2;
}

/* Highlight für Suche */
mark {
    background: #ffeb3b !important;
    padding: 2px 4px;
    border-radius: 2px;
    font-weight: 500;
}

/* Dark Mode Support (optional) */
@media (prefers-color-scheme: dark) {
    .email-content {
        background: #1e1e1e;
        color: #e0e0e0;
    }

        .email-content a {
            color: #64b5f6;
        }

        .email-content blockquote {
            border-left-color: #424242;
            color: #b0b0b0;
        }

        .email-content pre,
        .email-content code {
            background: #2d2d2d;
        }

        .email-content table td,
        .email-content table th {
            border-color: #424242;
        }

        .email-content table th {
            background: #2d2d2d;
        }

    .ticket-description {
        background: #1e1e1e;
        color: #e0e0e0;
    }

        .ticket-description table td,
        .ticket-description table th {
            border-color: #424242;
        }
}

/* ============================================
   Responsive Anpassungen
   ============================================ */
@media (max-width: 768px) {
    .email-content {
        padding: 10px;
        font-size: 13px;
    }

    .ticket-description {
        padding: 12px;
    }

        .ticket-description table {
            font-size: 12px;
        }


    .ticket-description {
        background: #f9f9f9;
        padding: 20px;
        border-radius: 8px;
        line-height: 1.8;
        max-width: 100%;
        overflow-x: auto;
        font-size: 14px;
        color: #333;
    }

        /* Absätze */
        .ticket-description p {
            margin: 0 0 16px 0;
        }

            .ticket-description p:last-child {
                margin-bottom: 0;
            }

        /* Überschriften */
        .ticket-description h1,
        .ticket-description h2,
        .ticket-description h3,
        .ticket-description h4,
        .ticket-description h5,
        .ticket-description h6 {
            margin: 24px 0 12px 0;
            color: #1976d2;
            font-weight: 600;
        }

        .ticket-description h1 {
            font-size: 24px;
        }

        .ticket-description h2 {
            font-size: 20px;
        }

        .ticket-description h3 {
            font-size: 18px;
        }

        .ticket-description h4 {
            font-size: 16px;
        }

        /* Listen */
        .ticket-description ul,
        .ticket-description ol {
            margin: 12px 0;
            padding-left: 30px;
        }

        .ticket-description li {
            margin-bottom: 8px;
        }

        /* Links */
        .ticket-description a {
            color: #1976d2;
            text-decoration: none;
            font-weight: 500;
        }

            .ticket-description a:hover {
                text-decoration: underline;
            }

        /* Bilder */
        .ticket-description img {
            max-width: 100%;
            height: auto;
            border-radius: 4px;
            margin: 12px 0;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        }

        /* Tabellen */
        .ticket-description table {
            border-collapse: collapse;
            width: 100%;
            margin: 16px 0;
            background: white;
            border-radius: 4px;
            overflow: hidden;
            box-shadow: 0 1px 3px rgba(0,0,0,0.1);
        }

            .ticket-description table td,
            .ticket-description table th {
                border: 1px solid #e0e0e0;
                padding: 12px;
                text-align: left;
            }

            .ticket-description table th {
                background: #f5f5f5;
                font-weight: 600;
                color: #555;
            }

            .ticket-description table tr:hover {
                background: #fafafa;
            }

        /* Zitate */
        .ticket-description blockquote {
            border-left: 4px solid #1976d2;
            padding-left: 16px;
            margin: 16px 0;
            color: #666;
            font-style: italic;
            background: #f5f5f5;
            padding: 12px 16px;
            border-radius: 4px;
        }

        /* Code-Blöcke */
        .ticket-description code {
            background: #f5f5f5;
            padding: 2px 6px;
            border-radius: 3px;
            font-family: 'Courier New', monospace;
            font-size: 13px;
            color: #d32f2f;
        }

        .ticket-description pre {
            background: #2d2d2d;
            color: #f8f8f2;
            padding: 16px;
            border-radius: 6px;
            overflow-x: auto;
            margin: 16px 0;
        }

            .ticket-description pre code {
                background: transparent;
                color: inherit;
                padding: 0;
            }

        /* Horizontale Linien */
        .ticket-description hr {
            border: none;
            border-top: 2px solid #e0e0e0;
            margin: 24px 0;
        }

        /* Starker Text */
        .ticket-description strong,
        .ticket-description b {
            font-weight: 600;
            color: #000;
        }

        /* Hervorgehobener Text */
        .ticket-description em,
        .ticket-description i {
            font-style: italic;
        }

        /* Entferne unnötige Email-Elemente */
        .ticket-description style,
        .ticket-description script,
        .ticket-description meta,
        .ticket-description link[rel="stylesheet"] {
            display: none !important;
        }

        /* Email-Signaturen dezenter darstellen */
        .ticket-description .signature,
        .ticket-description [class*="signature"],
        .ticket-description [id*="signature"] {
            border-top: 1px solid #e0e0e0;
            margin-top: 24px;
            padding-top: 16px;
            color: #999;
            font-size: 12px;
        }

        /* Outlook/Office spezifische Elemente bereinigen */
        .ticket-description .MsoNormal,
        .ticket-description .MsoNoSpacing {
            margin: 0 0 12px 0 !important;
        }

    /* Responsive */
    @media (max-width: 768px) {
        .ticket-description {
            padding: 16px;
            font-size: 13px;
        }

            .ticket-description table {
                font-size: 12px;
            }

                .ticket-description table td,
                .ticket-description table th {
                    padding: 8px;
                }
    }
    * Kommentar HTML-Styling */
    .comment-content {
        line-height: 1.6;
    }

    .comment-content p {
        margin: 0.5em 0;
    }

    .comment-content ul, .comment-content ol {
        margin: 0.5em 0;
        padding-left: 2em;
    }

    .comment-content strong {
        font-weight: 600;
    }

    .comment-content a {
        color: #1976d2;
        text-decoration: none;
    }

        .comment-content a:hover {
            text-decoration: underline;
        }

    /* ============================================
   Quill Rich Text Editor Styling
   ============================================ */

    /* Editor Container */
    .ql-container {
        font-family: 'Roboto', sans-serif;
        font-size: 14px;
        border-bottom-left-radius: 4px;
        border-bottom-right-radius: 4px;
    }

    /* Editor Toolbar */
    .ql-toolbar.ql-snow {
        border-top-left-radius: 4px;
        border-top-right-radius: 4px;
        border-color: #e0e0e0;
        background: #f5f5f5;
        padding: 8px;
    }

    .ql-editor {
        min-height: 150px;
        max-height: 500px;
        overflow-y: auto;
        padding: 12px 15px;
        line-height: 1.6;
    }

        /* Placeholder */
        .ql-editor.ql-blank::before {
            color: #999;
            font-style: italic;
        }

    /* Toolbar Buttons */
    .ql-toolbar button {
        width: 28px;
        height: 28px;
        margin: 2px;
    }

        .ql-toolbar button:hover {
            background: rgba(25, 118, 210, 0.1);
            border-radius: 3px;
        }

        .ql-toolbar button.ql-active {
            background: rgba(25, 118, 210, 0.2);
            border-radius: 3px;
        }

    /* Container Border */
    .ql-container.ql-snow {
        border-color: #e0e0e0;
    }

    /* Focus State */
    .ql-container:focus-within {
        border-color: #1976d2;
    }

    .ql-toolbar.ql-snow + .ql-container:focus-within {
        border-top-color: #e0e0e0;
    }

    /* Toolbar Dropdown */
    .ql-snow .ql-picker {
        color: #444;
    }

    .ql-snow .ql-picker-options {
        background: white;
        border: 1px solid #e0e0e0;
        border-radius: 4px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }

    /* Icons */
    .ql-snow .ql-stroke {
        stroke: #444;
    }

    .ql-snow .ql-fill {
        fill: #444;
    }

    /* Dark Mode Support für Editor */
    @media (prefers-color-scheme: dark) {
        .ql-toolbar.ql-snow {
            background: #2d2d2d;
            border-color: #424242;
        }

        .ql-container.ql-snow {
            border-color: #424242;
            background: #1e1e1e;
        }

        .ql-editor {
            color: #e0e0e0;
        }

            .ql-editor.ql-blank::before {
                color: #999;
            }

        .ql-toolbar button:hover {
            background: rgba(255, 255, 255, 0.1);
        }

        .ql-toolbar button.ql-active {
            background: rgba(255, 255, 255, 0.2);
        }

        .ql-snow .ql-stroke {
            stroke: #e0e0e0;
        }

        .ql-snow .ql-fill {
            fill: #e0e0e0;
        }

        .ql-snow .ql-picker {
            color: #e0e0e0;
        }

        .ql-snow .ql-picker-options {
            background: #2d2d2d;
            border-color: #424242;
        }
    }

    /* Responsive Editor */
    @media (max-width: 768px) {
        .ql-editor {
            font-size: 13px;
            padding: 10px;
            min-height: 120px;
        }

        .ql-toolbar button {
            width: 24px;
            height: 24px;
        }

        .ql-toolbar {
            padding: 6px;
        }
    }

    /* MudBlazor Integration */
    .mud-paper .ql-container,
    .mud-paper .ql-toolbar {
        border-radius: 4px;
    }
    /* Enhanced Ticket Images Styles - ticket-images.css */

    /* Basis-Styles für Ticket-Content */
    .ticket-content {
        line-height: 1.6;
        word-wrap: break-word;
        margin: 0;
        font-family: inherit;
    }

    .ticket-description {
        padding: 12px 0;
        border-left: 3px solid #e3f2fd;
        padding-left: 16px;
        background-color: #fafafa;
        border-radius: 4px;
        margin: 8px 0;
    }

    /* Embedded Image Containers */
    .embedded-image-container {
        margin: 16px 0;
        text-align: center;
        position: relative;
        display: inline-block;
        width: 100%;
    }

    .embedded-image {
        max-width: 100%;
        height: auto;
        border-radius: 8px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        transition: all 0.3s ease;
        cursor: pointer;
        display: block;
        margin: 0 auto;
    }

        .embedded-image:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
        }

        /* Verschiedene Bildgrößen */
        .embedded-image.small {
            max-width: 300px;
        }

        .embedded-image.medium {
            max-width: 600px;
        }

        .embedded-image.large {
            max-width: 800px;
        }

        /* Image Loading State */
        .embedded-image[src=""] {
            background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
            background-size: 200% 100%;
            animation: loading 1.5s infinite;
            min-height: 200px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

    @keyframes loading {
        0% {
            background-position: 200% 0;
        }

        100% {
            background-position: -200% 0;
        }
    }

    /* Image Error State */
    .embedded-image[alt="Bild nicht verfügbar"]::before {
        content: "🖼️ Bild konnte nicht geladen werden";
        display: block;
        padding: 20px;
        background-color: #ffebee;
        color: #c62828;
        border: 2px dashed #e57373;
        border-radius: 4px;
        font-size: 14px;
        text-align: center;
    }

    /* Image Overlay für zusätzliche Informationen */
    .embedded-image-container::after {
        content: "🔍 Zum Vergrößern klicken";
        position: absolute;
        bottom: 8px;
        right: 8px;
        background-color: rgba(0, 0, 0, 0.7);
        color: white;
        padding: 4px 8px;
        border-radius: 4px;
        font-size: 12px;
        opacity: 0;
        transition: opacity 0.3s ease;
        pointer-events: none;
    }

    .embedded-image-container:hover::after {
        opacity: 1;
    }

    /* Modal Styles für Bildvergrößerung */
    .image-modal {
        position: fixed;
        z-index: 10000;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.9);
        cursor: pointer;
        animation: modalFadeIn 0.3s ease;
    }

    @keyframes modalFadeIn {
        from {
            opacity: 0;
        }

        to {
            opacity: 1;
        }
    }

    .modal-content {
        position: relative;
        background-color: #ffffff;
        margin: auto;
        padding: 20px;
        border-radius: 12px;
        width: 90%;
        max-width: 1200px;
        max-height: 90%;
        overflow: auto;
        top: 50%;
        transform: translateY(-50%);
        cursor: auto;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
        animation: modalSlideIn 0.3s ease;
    }

    @keyframes modalSlideIn {
        from {
            opacity: 0;
            transform: translateY(-50%) scale(0.9);
        }

        to {
            opacity: 1;
            transform: translateY(-50%) scale(1);
        }
    }

    .close-modal {
        color: #666;
        float: right;
        font-size: 32px;
        font-weight: bold;
        cursor: pointer;
        position: absolute;
        right: 20px;
        top: 15px;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        transition: all 0.2s ease;
        background-color: #f5f5f5;
    }

        .close-modal:hover,
        .close-modal:focus {
            color: #fff;
            background-color: #f44336;
            transform: scale(1.1);
        }

    .modal-image {
        width: 100%;
        height: auto;
        max-height: 70vh;
        object-fit: contain;
        border-radius: 8px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }

    .modal-caption {
        text-align: center;
        color: #666;
        margin-top: 15px;
        font-style: italic;
        font-size: 14px;
        line-height: 1.4;
    }

    /* Comment-spezifische Styles */
    .comment-content.internal-comment {
        background-color: #fff8e1;
        border-left: 3px solid #ffc107;
        padding: 8px 12px;
        border-radius: 4px;
        margin: 4px 0;
    }

    .comment-content.customer-comment {
        background-color: #e8f5e8;
        border-left: 3px solid #4caf50;
        padding: 8px 12px;
        border-radius: 4px;
        margin: 4px 0;
    }

    /* Image Gallery für mehrere Bilder */
    .image-gallery {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 16px;
        margin: 16px 0;
    }

        .image-gallery .embedded-image {
            width: 100%;
            height: 200px;
            object-fit: cover;
        }

    /* Responsive Design */
    @media (max-width: 768px) {
        .modal-content {
            width: 95%;
            padding: 15px;
            margin: 5% auto;
        }

        .embedded-image {
            max-width: 100%;
        }

        .embedded-image-container::after {
            display: none; /* Hide overlay text on mobile */
        }

        .close-modal {
            font-size: 24px;
            right: 15px;
            top: 10px;
            width: 35px;
            height: 35px;
        }
    }

    @media (max-width: 480px) {
        .image-gallery {
            grid-template-columns: 1fr;
        }

        .modal-content {
            padding: 10px;
            border-radius: 8px;
        }

        .modal-image {
            max-height: 60vh;
        }
    }

    /* Dark Mode Support */
    @media (prefers-color-scheme: dark) {
        .ticket-description {
            background-color: #2d2d2d;
            border-left-color: #1976d2;
            color: #e0e0e0;
        }

        .comment-content.internal-comment {
            background-color: #3d3300;
            border-left-color: #ffc107;
            color: #fff9c4;
        }

        .comment-content.customer-comment {
            background-color: #1b4332;
            border-left-color: #4caf50;
            color: #c8e6c9;
        }

        .modal-content {
            background-color: #333;
            color: #fff;
        }

        .modal-caption {
            color: #bbb;
        }

        .close-modal {
            background-color: #555;
            color: #fff;
        }
    }

    /* Accessibility Improvements */
    .embedded-image:focus {
        outline: 3px solid #1976d2;
        outline-offset: 2px;
    }

    .image-modal:focus {
        outline: none;
    }

    .close-modal:focus {
        outline: 3px solid #fff;
        outline-offset: 2px;
    }

    /* Print Styles */
    @media print {
        .embedded-image-container::after,
        .close-modal,
        .image-modal {
            display: none !important;
        }

        .embedded-image {
            box-shadow: none;
            border: 1px solid #ddd;
            max-width: 400px;
            page-break-inside: avoid;
        }
    }

    /* Animation für bessere UX */
    .embedded-image-container {
        animation: fadeInUp 0.6s ease-out;
    }

    @keyframes fadeInUp {
        from {
            opacity: 0;
            transform: translateY(30px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

}
