/* Rich Text Editor Styles */

.rte-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.rte-wrapper textarea {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    transition: height 0.15s ease, padding 0.15s ease;
}

.rte-toolbar {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 6px 8px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-subtle);
    border-bottom: none;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    flex-wrap: wrap;
}

.rte-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 26px;
    padding: 0;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    color: var(--secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.12s ease;
    font-family: inherit;
}

.rte-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border-color: var(--border-subtle);
}

.rte-btn:active {
    background: rgba(255, 255, 255, 0.12);
}

.rte-btn.active {
    background: rgba(6, 182, 212, 0.2);
    color: var(--accent-cyan);
    border-color: var(--accent-cyan);
}

.rte-btn-bold {
    font-weight: 700;
}

.rte-btn-italic {
    font-style: italic;
}

.rte-btn-strike {
    text-decoration: line-through;
}

.rte-btn-code {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 11px;
}

.rte-btn-link {
    font-size: 14px;
}

.rte-btn-preview {
    margin-left: auto;
    font-size: 12px;
    padding: 0 8px;
    width: auto;
    font-weight: 500;
}

.rte-spacer {
    flex: 1;
}

/* Preview pane */
.rte-preview {
    min-height: 60px;
    max-height: 200px;
    overflow-y: auto;
    padding: 12px;
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-subtle);
    border-top: none;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
}

.rte-preview.hidden {
    display: none;
}

.rte-preview .preview-placeholder {
    color: var(--secondary);
    font-style: italic;
}

.rte-preview strong {
    font-weight: 700;
}

.rte-preview em {
    font-style: italic;
}

.rte-preview del {
    text-decoration: line-through;
    opacity: 0.7;
}

.rte-preview code {
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 13px;
}

.rte-preview a {
    color: var(--accent-cyan);
    text-decoration: underline;
}

/* Collapsible states */
.rte-collapsed textarea {
    resize: none;
}

.rte-collapsed .rte-toolbar {
    display: none;
}

.rte-expanded {
    transition: all 0.15s ease;
}

.rte-expanded .rte-toolbar {
    display: flex;
}

/* Compact mode for comments */
.rte-compact .rte-toolbar {
    padding: 4px 6px;
}

.rte-compact .rte-btn {
    width: 24px;
    height: 22px;
    font-size: 12px;
}

.rte-compact .rte-btn-code {
    font-size: 10px;
}

.rte-compact .rte-preview {
    min-height: 40px;
    max-height: 120px;
    padding: 8px;
    font-size: 13px;
}

/* Comment form with RTE - collapsible */
.comment-form-collapsible {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.comment-form-collapsible .comment-form-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
}

.comment-form-collapsible .comment-form-actions.hidden {
    display: none;
}

.comment-form-collapsible .btn-send {
    opacity: 1;
    transition: opacity 0.15s;
}

/* Reply form with RTE - inline */
.reply-form-collapsible {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}

.reply-form-collapsible textarea {
    width: 100%;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    background: rgba(255, 255, 255, 0.03);
    color: #fff;
    font-size: 13px;
    resize: none;
    transition: all 0.15s ease;
}

.reply-form-collapsible textarea:focus {
    resize: vertical;
}

.reply-form-collapsible .rte-wrapper {
    flex: 1;
}

.reply-form-collapsible .reply-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
}

.reply-form-collapsible .reply-actions.hidden {
    display: none;
}

/* Inline reply input (replaces Reply button) */
.reply-input-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.reply-input-inline textarea {
    flex: 1;
    min-width: 0;
}

.reply-input-inline .reply-actions {
    display: flex;
    gap: 4px;
}

/* Collapsible textareas */
.comment-textarea-collapsible,
.reply-textarea-collapsible {
    transition: all 0.15s ease;
    resize: none;
}

.comment-textarea-collapsible:focus,
.reply-textarea-collapsible:focus {
    resize: vertical;
}

.comment-form-collapsible.expanded .comment-form {
    margin-bottom: 8px;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .rte-toolbar {
        padding: 4px 6px;
        gap: 1px;
    }

    .rte-btn {
        width: 26px;
        height: 24px;
        font-size: 12px;
    }

    .rte-btn-preview {
        padding: 0 6px;
        font-size: 11px;
    }
}