/* Simple Editor Styles */
.simple-editor {
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    margin-bottom: 15px;
}

.editor-toolbar {
    background: #f8f9fa;
    border-bottom: 1px solid #ddd;
    padding: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
}

.toolbar-group {
    display: flex;
    gap: 2px;
}

.toolbar-separator {
    width: 1px;
    height: 24px;
    background: #ddd;
    margin: 0 5px;
}

.toolbar-btn {
    background: white;
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 6px 10px;
    cursor: pointer;
    transition: all 0.2s;
    color: #333;
    font-size: 14px;
}

.toolbar-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.toolbar-btn:active,
.toolbar-btn.active {
    background: #dee2e6;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.toolbar-select {
    background: white;
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 5px 8px;
    cursor: pointer;
    font-size: 14px;
    min-width: 120px;
    color: #333;
}

.toolbar-select option {
    background: white;
    color: #333;
}

.toolbar-select:focus {
    outline: none;
    border-color: #0d6efd;
}

/* Color picker in toolbar */
.toolbar-color {
    width: 34px;
    height: 28px;
    padding: 0;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    cursor: pointer;
}

[data-theme="dark"] .toolbar-color {
    background: #495057;
    border-color: #6c757d;
}

/* Indicator shown when the selected color was adjusted for readability in dark mode */
.color-adjusted-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    vertical-align: middle;
    margin-left: 6px;
    visibility: hidden;
}

/* Panel pour choisir séparément couleur claire / sombre */
.theme-color-panel {
    position: absolute;
    z-index: 60;
    background: #fff;
    border: 1px solid #ddd;
    box-shadow: 0 6px 18px rgba(0,0,0,0.12);
    padding: 8px;
    border-radius: 6px;
    min-width: 220px;
}

.theme-color-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.theme-color-row label { display:flex; align-items:center; gap:8px; }
.theme-color-row input[type="color"] { width:36px; height:28px; padding:0; border:0; }
.theme-color-apply { padding:6px 8px; border-radius:4px; border:1px solid #ddd; background:#f8f9fa; cursor:pointer }
.theme-color-apply:hover { background:#e9ecef }

[data-theme="dark"] .theme-color-panel { background:#2b2f33; border-color:#444; color:#f3f3f3 }
[data-theme="dark"] .theme-color-apply { background:#3a3f43; border-color:#555; color:#f3f3f3 }

/* Live preview inside the theme panel */
.theme-color-preview {
    display: flex;
    gap: 8px;
    margin-top: 6px;
}
.theme-preview-box {
    flex: 1 1 50%;
    padding: 8px;
    border-radius: 6px;
    border: 1px solid #e9ecef;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
}
.theme-preview-box.light { background: #fff; color: #111; }
.theme-preview-box.dark { background: #222; color: #f6f6f6; }
.theme-preview-sample { padding: 4px 8px; border-radius: 4px; }

[data-theme="dark"] .theme-preview-box { border-color: #444 }

.editor-content {
    padding: 15px;
    min-height: 200px;
    max-height: 600px;
    overflow-y: auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: #212529;
}

.editor-content:focus {
    outline: none;
}

.editor-content p {
    margin: 0 0 1em 0;
}

.editor-content h1 {
    font-size: 2em;
    margin: 0.67em 0;
    font-weight: bold;
}

.editor-content h2 {
    font-size: 1.5em;
    margin: 0.75em 0;
    font-weight: bold;
}

.editor-content h3 {
    font-size: 1.17em;
    margin: 0.83em 0;
    font-weight: bold;
}

.editor-content h4 {
    font-size: 1em;
    margin: 1em 0;
    font-weight: bold;
}

.editor-content ul,
.editor-content ol {
    margin: 1em 0;
    padding-left: 40px;
}

.editor-content li {
    margin: 0.5em 0;
}

.editor-content a {
    color: #0d6efd;
    text-decoration: underline;
}

.editor-content a:hover {
    color: #0a58ca;
}

.editor-content img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 10px 0;
}

.editor-content pre {
    background: #f4f4f4;
    padding: 10px;
    border-radius: 4px;
    overflow-x: auto;
    margin: 1em 0;
}

.editor-content code {
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
}

.editor-content blockquote {
    border-left: 4px solid #0d6efd;
    padding-left: 15px;
    margin: 1em 0;
    color: #666;
    font-style: italic;
}

/* Mode sombre */
[data-theme="dark"] .simple-editor {
    border-color: #495057;
    background: #212529;
}

[data-theme="dark"] .editor-toolbar {
    background: #343a40;
    border-bottom-color: #495057;
}

[data-theme="dark"] .toolbar-btn {
    background: #495057;
    border-color: #6c757d;
    color: #f8f9fa;
}

[data-theme="dark"] .toolbar-btn:hover {
    background: #5a6268;
    border-color: #7f8691;
}

[data-theme="dark"] .toolbar-select {
    background: #495057 !important;
    border-color: #6c757d !important;
    color: #f8f9fa !important;
}

[data-theme="dark"] .toolbar-select option {
    background: #495057 !important;
    color: #f8f9fa !important;
}

[data-theme="dark"] .toolbar-select option:hover {
    background: #5a6268 !important;
}

[data-theme="dark"] .toolbar-separator {
    background: #6c757d;
}

[data-theme="dark"] .editor-content {
    background: #212529;
    color: #f8f9fa;
}

[data-theme="dark"] .editor-content pre {
    background: #343a40;
    color: #f8f9fa;
}

[data-theme="dark"] .editor-content a {
    color: #6ea8fe;
}

[data-theme="dark"] .editor-content a:hover {
    color: #9ec5fe;
}

/* Responsive */
@media (max-width: 768px) {
    .editor-toolbar {
        padding: 5px;
        gap: 3px;
    }
    
    .toolbar-btn {
        padding: 5px 8px;
        font-size: 12px;
    }
    
    .toolbar-select {
        font-size: 12px;
        min-width: 100px;
        padding: 4px 6px;
    }
    
    .editor-content {
        padding: 10px;
        font-size: 14px;
    }
}
