/**
 * Quill Editor Custom Styling
 *
 * Anpassungen für den Quill WYSIWYG-Editor
 */

/* Editor Container */
.quill-editor-container {
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    background: #fff;
    min-height: 300px;
}

.quill-editor-container.focus {
    border-color: #86b7fe;
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Toolbar Styling */
.quill-editor-container .ql-toolbar {
    border: none;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
    border-radius: 0.375rem 0.375rem 0 0;
    padding: 8px;
}

.quill-editor-container .ql-toolbar button {
    margin: 0 2px;
}

.quill-editor-container .ql-toolbar button:hover {
    color: #0d6efd;
}

.quill-editor-container .ql-toolbar button.ql-active {
    color: #0d6efd;
}

/* Editor Content Area */
.quill-editor-container .ql-container {
    border: none;
    font-family: inherit;
    font-size: inherit;
}

.quill-editor-container .ql-editor {
    min-height: 250px;
    padding: 15px;
    line-height: 1.6;
}

.quill-editor-container .ql-editor.ql-blank::before {
    color: #6c757d;
    font-style: italic;
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .quill-editor-container {
        background: #2b3035;
        border-color: #495057;
    }

    .quill-editor-container .ql-toolbar {
        background: #212529;
        border-bottom-color: #495057;
    }

    .quill-editor-container .ql-editor {
        color: #e9ecef;
    }

    .quill-editor-container .ql-editor.ql-blank::before {
        color: #adb5bd;
    }

    .quill-editor-container .ql-stroke {
        stroke: #e9ecef;
    }

    .quill-editor-container .ql-fill {
        fill: #e9ecef;
    }
}

/* Error State */
.is-invalid + .quill-editor-container {
    border-color: #dc3545;
}

.is-invalid + .quill-editor-container:focus-within {
    box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.25);
}

/* Valid State */
.is-valid + .quill-editor-container {
    border-color: #198754;
}

.is-valid + .quill-editor-container:focus-within {
    box-shadow: 0 0 0 0.25rem rgba(25, 135, 84, 0.25);
}

/* Fix excessive spacing from Quill-generated paragraphs */
.quill-content p {
    margin-top: 0;
    margin-bottom: 0.5rem;
}

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

/* Reduce spacing for paragraphs containing only <br> (fallback for older browsers) */
.quill-content p br {
    display: block;
    content: "";
    margin-top: 0;
}

/* Modern browsers: reduce spacing for <p><br></p> */
@supports selector(:has(br:only-child)) {
    .quill-content p:has(br:only-child) {
        margin-bottom: 0.25rem;
        line-height: 1.2;
    }
}
