/**
 * Chedito - Django Admin Styles
 */

/* Admin Widget Overrides */
.chedito-admin-widget .chedito-editor {
    border-color: #ccc;
}

.chedito-admin-widget .chedito-editor .ql-toolbar {
    background-color: #f5f5f5;
    border-bottom-color: #ddd;
}

.chedito-admin-widget .chedito-editor .ql-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.chedito-admin-widget .chedito-editor .ql-editor {
    min-height: 250px;
}

/* Match Django Admin Field Width */
.form-row .chedito-widget-container {
    width: 100%;
}

/* Admin Inline Styling */
.inline-related .chedito-widget-container {
    margin-top: 0.5rem;
}

.inline-related .chedito-editor .ql-editor {
    min-height: 150px;
}

/* Tabular Inline */
.tabular .chedito-widget-container {
    min-width: 300px;
}

/* Stacked Inline */
.stacked .chedito-widget-container {
    max-width: 100%;
}

/* Admin Error Styling */
.errors + .chedito-widget-container .chedito-editor,
.errorlist + .chedito-widget-container .chedito-editor {
    border-color: #ba2121;
}

/* Admin Focus */
.chedito-admin-widget .chedito-editor .ql-container:focus-within {
    border-color: #79aec8;
    box-shadow: none;
}

/* Admin Toolbar */
.chedito-admin-widget .chedito-editor .ql-toolbar button:hover {
    color: #417690;
}

.chedito-admin-widget .chedito-editor .ql-toolbar button.ql-active {
    color: #417690;
}

.chedito-admin-widget .chedito-editor .ql-toolbar button:hover .ql-stroke,
.chedito-admin-widget .chedito-editor .ql-toolbar button.ql-active .ql-stroke {
    stroke: #417690;
}

.chedito-admin-widget .chedito-editor .ql-toolbar button:hover .ql-fill,
.chedito-admin-widget .chedito-editor .ql-toolbar button.ql-active .ql-fill {
    fill: #417690;
}

/* Readonly in Admin */
.readonly .chedito-widget-container .ql-toolbar {
    display: none;
}

.readonly .chedito-widget-container .ql-editor {
    background-color: #f8f8f8;
}

/* Dark Mode Support (Django 3.2+) */
@media (prefers-color-scheme: dark) {
    html[data-theme="dark"] .chedito-admin-widget .chedito-editor {
        background-color: #1e1e1e;
        border-color: #444;
    }

    html[data-theme="dark"] .chedito-admin-widget .chedito-editor .ql-toolbar {
        background-color: #2d2d2d;
        border-color: #444;
    }

    html[data-theme="dark"] .chedito-admin-widget .chedito-editor .ql-editor {
        color: #e0e0e0;
    }

    html[data-theme="dark"] .chedito-admin-widget .chedito-editor .ql-toolbar .ql-stroke {
        stroke: #e0e0e0;
    }

    html[data-theme="dark"] .chedito-admin-widget .chedito-editor .ql-toolbar .ql-fill {
        fill: #e0e0e0;
    }

    html[data-theme="dark"] .chedito-admin-widget .chedito-editor .ql-toolbar .ql-picker {
        color: #e0e0e0;
    }
}
