/**
 * Rich Text Editor Styles
 * 
 * Clean, modern styling for the RTE component
 * Follows jsgui3-html design patterns
 */

/* Container */
.rich-text-editor {
    display: flex;
    flex-direction: column;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    overflow: hidden;
    transition: border-color 0.2s;
}

.rich-text-editor:focus-within {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Toolbar */
.rte-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px;
    background: #f8f8f8;
    border-bottom: 1px solid #e0e0e0;
    flex-wrap: wrap;
}

.rte-toolbar.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.rte-toolbar-button {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 4px 8px;
    background: white;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    color: #333;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.rte-toolbar-button:hover {
    background: #f0f0f0;
    border-color: #667eea;
}

.rte-toolbar-button:active {
    background: #e8e8e8;
    transform: translateY(1px);
}

.rte-toolbar-button.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.rte-toolbar-button strong,
.rte-toolbar-button em,
.rte-toolbar-button u {
    font-size: 14px;
}

.rte-toolbar-separator {
    width: 1px;
    height: 24px;
    background: #d0d0d0;
    margin: 0 4px;
}

/* Editor Container */
.rte-editor-container {
    flex: 1;
    overflow: auto;
    background: white;
}

/* Editor Area */
.rte-editor {
    padding: 16px;
    outline: none;
    font-size: 15px;
    line-height: 1.6;
    color: #333;
    overflow-y: auto;
}

.rte-markdown {
    width: 100%;
    padding: 16px;
    border: none;
    outline: none;
    font-family: "Courier New", monospace;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    resize: vertical;
}

.rte-editor.is-hidden,
.rte-markdown.is-hidden {
    display: none;
}

/* Placeholder */
.rte-editor:empty::before {
    content: attr(data-placeholder);
    color: #999;
    pointer-events: none;
}

/* Content Formatting */
.rte-editor p {
    margin: 0 0 12px 0;
}

.rte-editor p:last-child {
    margin-bottom: 0;
}

.rte-editor strong,
.rte-editor b {
    font-weight: 700;
}

.rte-editor em,
.rte-editor i {
    font-style: italic;
}

.rte-editor u {
    text-decoration: underline;
}

.rte-editor a {
    color: #667eea;
    text-decoration: underline;
    cursor: pointer;
}

.rte-editor a:hover {
    color: #764ba2;
}

.rte-editor ul,
.rte-editor ol {
    margin: 0 0 12px 0;
    padding-left: 24px;
}

.rte-editor li {
    margin-bottom: 4px;
}

.rte-editor h1,
.rte-editor h2,
.rte-editor h3,
.rte-editor h4,
.rte-editor h5,
.rte-editor h6 {
    margin: 16px 0 8px 0;
    font-weight: 700;
    line-height: 1.3;
}

.rte-editor h1 { font-size: 32px; }
.rte-editor h2 { font-size: 28px; }
.rte-editor h3 { font-size: 24px; }
.rte-editor h4 { font-size: 20px; }
.rte-editor h5 { font-size: 18px; }
.rte-editor h6 { font-size: 16px; }

.rte-editor blockquote {
    margin: 12px 0;
    padding: 8px 16px;
    border-left: 4px solid #667eea;
    background: #f8f9ff;
    color: #555;
}

.rte-editor code {
    padding: 2px 6px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
}

.rte-editor pre {
    margin: 12px 0;
    padding: 12px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    overflow-x: auto;
}

.rte-editor pre code {
    padding: 0;
    background: none;
    border: none;
}

.rte-editor img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.rte-editor table {
    border-collapse: collapse;
    width: 100%;
    margin: 12px 0;
}

.rte-editor th,
.rte-editor td {
    border: 1px solid #e0e0e0;
    padding: 8px;
    text-align: left;
}

.rte-editor th {
    background: #f8f8f8;
    font-weight: 600;
}

/* Read-only mode */
.rich-text-editor.read-only .rte-editor {
    background: #fafafa;
    cursor: default;
}

/* Focus styles */
.rte-editor:focus {
    outline: none;
}

/* Selection */
.rte-editor ::selection {
    background: rgba(102, 126, 234, 0.3);
}

/* Scrollbar */
.rte-editor::-webkit-scrollbar {
    width: 8px;
}

.rte-editor::-webkit-scrollbar-track {
    background: #f0f0f0;
}

.rte-editor::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.rte-editor::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .rte-toolbar {
        padding: 6px;
        gap: 2px;
    }
    
    .rte-toolbar-button {
        min-width: 28px;
        height: 28px;
        padding: 4px 6px;
        font-size: 13px;
    }
    
    .rte-editor {
        padding: 12px;
        font-size: 14px;
    }
}
