/**
 * TheStore - Rich Text Editor Styles
 */

.rich-editor {
    border: 1px solid var(--gray-300, #d1d5db);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.rich-editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 8px;
    background: var(--gray-50, #f9fafb);
    border-bottom: 1px solid var(--gray-200, #e5e7eb);
}

.rich-editor-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    color: var(--gray-600, #4b5563);
    transition: all 0.15s ease;
}

.rich-editor-btn:hover {
    background: var(--gray-200, #e5e7eb);
    color: var(--gray-900, #111827);
}

.rich-editor-btn:active {
    background: var(--gray-300, #d1d5db);
}

.rich-editor-btn.small-icon i {
    font-size: 0.75rem;
}

.rich-editor-separator {
    width: 1px;
    height: 24px;
    background: var(--gray-300, #d1d5db);
    margin: 4px 4px;
}

.rich-editor-content {
    padding: 16px;
    outline: none;
    overflow-y: auto;
    line-height: 1.6;
    font-size: 14px;
    color: var(--gray-800, #1f2937);
}

.rich-editor-content:empty:before {
    content: attr(data-placeholder);
    color: var(--gray-400, #9ca3af);
    pointer-events: none;
}

.rich-editor-content:focus {
    outline: none;
}

/* Content styles */
.rich-editor-content h1,
.rich-editor-content h2,
.rich-editor-content h3,
.rich-editor-content h4 {
    margin: 1em 0 0.5em 0;
    font-weight: 600;
    line-height: 1.3;
}

.rich-editor-content h1 { font-size: 1.75rem; }
.rich-editor-content h2 { font-size: 1.5rem; }
.rich-editor-content h3 { font-size: 1.25rem; }
.rich-editor-content h4 { font-size: 1.1rem; }

.rich-editor-content p {
    margin: 0 0 1em 0;
}

.rich-editor-content ul,
.rich-editor-content ol {
    margin: 0 0 1em 0;
    padding-left: 1.5em;
}

.rich-editor-content li {
    margin-bottom: 0.25em;
}

.rich-editor-content a {
    color: var(--primary, #6366f1);
    text-decoration: underline;
}

.rich-editor-content blockquote {
    margin: 1em 0;
    padding: 0.75em 1em;
    border-left: 4px solid var(--primary, #6366f1);
    background: var(--gray-50, #f9fafb);
    font-style: italic;
}

.rich-editor-content pre {
    margin: 1em 0;
    padding: 1em;
    background: var(--gray-900, #111827);
    color: #e5e7eb;
    border-radius: 6px;
    overflow-x: auto;
    font-family: 'Fira Code', 'Monaco', 'Consolas', monospace;
    font-size: 13px;
    line-height: 1.5;
}

.rich-editor-content code {
    padding: 0.15em 0.4em;
    background: var(--gray-100, #f3f4f6);
    border-radius: 4px;
    font-family: 'Fira Code', 'Monaco', 'Consolas', monospace;
    font-size: 0.9em;
}

.rich-editor-content pre code {
    padding: 0;
    background: transparent;
}

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

.rich-editor-content hr {
    margin: 1.5em 0;
    border: none;
    border-top: 2px solid var(--gray-200, #e5e7eb);
}

.rich-editor-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1em 0;
}

.rich-editor-content th,
.rich-editor-content td {
    padding: 0.5em;
    border: 1px solid var(--gray-300, #d1d5db);
    text-align: left;
}

.rich-editor-content th {
    background: var(--gray-50, #f9fafb);
    font-weight: 600;
}

/* Source view */
.rich-editor-source {
    width: 100%;
    padding: 16px;
    border: none;
    font-family: 'Fira Code', 'Monaco', 'Consolas', monospace;
    font-size: 13px;
    line-height: 1.5;
    resize: vertical;
    background: var(--gray-900, #111827);
    color: #e5e7eb;
}

.rich-editor-source:focus {
    outline: none;
}

/* Fullscreen mode */
.rich-editor.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    border-radius: 0;
    display: flex;
    flex-direction: column;
}

.rich-editor.fullscreen .rich-editor-content,
.rich-editor.fullscreen .rich-editor-source {
    flex: 1;
    max-height: none;
}

/* Responsive toolbar */
@media (max-width: 768px) {
    .rich-editor-toolbar {
        padding: 6px;
    }

    .rich-editor-btn {
        width: 28px;
        height: 28px;
    }

    .rich-editor-btn i {
        font-size: 0.85rem;
    }

    .rich-editor-separator {
        display: none;
    }
}

/* Drag and drop styles */
.rich-editor-content.drag-over {
    background: var(--gray-100, #f3f4f6);
    border: 2px dashed var(--primary, #6366f1);
}

/* Image uploading indicator */
.image-uploading {
    display: inline-block;
    padding: 8px 16px;
    background: var(--gray-100, #f3f4f6);
    border-radius: 4px;
    color: var(--gray-600, #4b5563);
    font-size: 13px;
    margin: 4px 0;
}

.image-uploading i {
    margin-right: 6px;
    color: var(--primary, #6366f1);
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .rich-editor {
        border-color: #374151;
        background: #1f2937;
    }

    .rich-editor-toolbar {
        background: #111827;
        border-bottom-color: #374151;
    }

    .rich-editor-btn {
        color: #d1d5db;
    }

    .rich-editor-btn:hover {
        background: #374151;
        color: #f9fafb;
    }

    .rich-editor-content {
        color: #f3f4f6;
    }

    .rich-editor-content blockquote {
        background: #374151;
    }

    .rich-editor-content code {
        background: #374151;
    }
}
