/**
 * RichTextEditor Component Styles
 * 
 * Styles for the Quill.js-based rich text editor component.
 * Ensures clean appearance and proper integration with RAG rating colors.
 */

.rich-text-editor {
    width: 100%;
    margin: 8px 0;
}

.rich-text-editor .editor-container {
    background: white;
    border-radius: 4px;
    overflow: hidden;
}

/* Quill toolbar styling */
.rich-text-editor .ql-toolbar {
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-bottom: none;
    border-radius: 4px 4px 0 0;
    padding: 8px;
}

.rich-text-editor .ql-toolbar button {
    width: 28px;
    height: 28px;
    padding: 3px 5px;
    margin-right: 4px;
}

.rich-text-editor .ql-toolbar button:hover {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 3px;
}

.rich-text-editor .ql-toolbar button.ql-active {
    background: rgba(102, 126, 234, 0.1);
    border-radius: 3px;
}

/* Color picker styling */
.rich-text-editor .ql-toolbar .ql-color-picker {
    width: 28px;
    height: 28px;
}

.rich-text-editor .ql-toolbar .ql-color-picker .ql-picker-label {
    padding: 2px 4px;
}

.rich-text-editor .ql-toolbar .ql-color-picker .ql-picker-options {
    padding: 5px;
    width: 152px;
}

.rich-text-editor .ql-toolbar .ql-color-picker .ql-picker-item {
    width: 16px;
    height: 16px;
    border: 1px solid #ddd;
    border-radius: 2px;
    margin: 2px;
}

.rich-text-editor .ql-toolbar .ql-color-picker .ql-picker-item:hover {
    border-color: #ec5f59;
}

/* Quill editor content area */
.rich-text-editor .ql-container {
    border: 1px solid #ddd;
    border-radius: 0 0 4px 4px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    min-height: 150px;
}

.rich-text-editor .ql-editor {
    min-height: 150px;
    padding: 12px 15px;
    line-height: 1.6;
    transition: background-color 0.3s ease;
}

/* Placeholder styling */
.rich-text-editor .ql-editor.ql-blank::before {
    color: #999;
    font-style: italic;
    left: 15px;
    right: 15px;
}

/* Content styling */
.rich-text-editor .ql-editor p {
    margin: 0 0 8px 0;
}

.rich-text-editor .ql-editor p:last-child {
    margin-bottom: 0;
}

.rich-text-editor .ql-editor strong,
.rich-text-editor .ql-editor b {
    font-weight: 600;
}

.rich-text-editor .ql-editor em,
.rich-text-editor .ql-editor i {
    font-style: italic;
}

.rich-text-editor .ql-editor u {
    text-decoration: underline;
}

/* List styling - Quill 2.0 compatible */
/* Let Quill's own CSS handle list rendering via ::before pseudo-elements */
.rich-text-editor .ql-editor ul,
.rich-text-editor .ql-editor ol {
    margin: 8px 0;
    padding-left: 1.5em;
}

.rich-text-editor .ql-editor li {
    margin: 4px 0;
    list-style-type: none !important;
    padding-left: 1.5em;
}

/* Hide native browser list markers - Quill uses ::before pseudo-elements instead */
.rich-text-editor .ql-editor ol li,
.rich-text-editor .ql-editor ul li {
    list-style: none !important;
}

/* Focus state */
.rich-text-editor .ql-container.ql-snow:focus-within {
    border-color: #ec5f59;
    box-shadow: 0 0 0 2px rgba(232, 114, 106, 0.1);
}

/* RAG rating background colors - ensure text remains readable */
.rich-text-editor .ql-editor[style*="background-color: rgb(255, 204, 204)"],
.rich-text-editor .ql-editor[style*="background-color: #ffcccc"] {
    /* Light red background */
    color: #333;
}

.rich-text-editor .ql-editor[style*="background-color: rgb(255, 230, 204)"],
.rich-text-editor .ql-editor[style*="background-color: #ffe6cc"] {
    /* Light amber background */
    color: #333;
}

.rich-text-editor .ql-editor[style*="background-color: rgb(204, 255, 204)"],
.rich-text-editor .ql-editor[style*="background-color: #ccffcc"] {
    /* Light green background */
    color: #333;
}

/* Compact variant for smaller spaces */
.rich-text-editor.compact .ql-container {
    min-height: 100px;
}

.rich-text-editor.compact .ql-editor {
    min-height: 100px;
    padding: 8px 12px;
}

/* Error state */
.rich-text-editor.error .ql-container {
    border-color: #feb2b2;
}

.rich-text-editor.error .ql-container.ql-snow:focus-within {
    border-color: #feb2b2;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.1);
}

/* Disabled state */
.rich-text-editor.disabled .ql-toolbar,
.rich-text-editor.disabled .ql-container {
    opacity: 0.6;
    pointer-events: none;
    background: #f5f5f5;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .rich-text-editor .ql-toolbar button {
        width: 24px;
        height: 24px;
        margin-right: 2px;
    }
    
    .rich-text-editor .ql-editor {
        font-size: 13px;
        padding: 10px 12px;
    }
}


/* Quill 2.0 handles list styling via its own CSS - remove conflicting overrides */
