/* Custom TipTap Editor Styles for Underground RP */
:root {
    --editor-bg: rgba(30, 30, 30, 0.95);
    --editor-border: rgba(255, 255, 255, 0.1);
    --editor-toolbar-bg: rgba(20, 20, 20, 0.95);
    --toolbar-btn-hover: rgba(255, 255, 255, 0.1);
    --toolbar-btn-active: #e74c3c;
    /* Red accent */
    --editor-text: #e0e0e0;
}

.editor-container {
    background: var(--editor-bg);
    border: 1px solid var(--editor-border);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
}

.editor-toolbar {
    background: var(--editor-toolbar-bg);
    padding: 10px;
    border-bottom: 1px solid var(--editor-border);
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
}

.editor-btn {
    background: transparent;
    border: 1px solid transparent;
    color: #aaa;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.2s ease;
    display: flex;
    /* Centering icon */
    align-items: center;
    justify-content: center;
    width: 32px;
    /* Fixed width for better layout */
    height: 32px;
}

.editor-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.editor-btn.is-active {
    background: var(--toolbar-btn-active);
    color: #fff;
    box-shadow: 0 0 8px rgba(231, 76, 60, 0.4);
}

.editor-btn i {
    pointer-events: none;
}

.toolbar-separator {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0 8px;
}

.editor-content {
    padding: 20px;
    min-height: 300px;
    color: var(--editor-text);
    outline: none;
    font-size: 1rem;
    line-height: 1.6;
    overflow-y: auto;
}

/* Quick Reply Height */
.quick-reply .editor-content {
    min-height: 150px;
}

/* ProseMirror Specific Styles (TipTap internal class) */
.ProseMirror {
    outline: none;
    height: 100%;
    cursor: text;
    caret-color: #fff;
}

/* Ensure editor is clickable */
.editor-content {
    cursor: text;
}

.ProseMirror p {
    margin-bottom: 0.8em;
}

.ProseMirror ul,
.ProseMirror ol {
    padding-left: 1.5em;
    margin-bottom: 0.8em;
}

.ProseMirror blockquote {
    border-left: 3px solid #e74c3c;
    padding-left: 1em;
    margin-left: 0;
    font-style: italic;
    color: #ccc;
    background: rgba(255, 255, 255, 0.05);
    padding: 10px;
    border-radius: 4px;
}

.ProseMirror img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 10px 0;
}

.ProseMirror iframe {
    width: 100%;
    aspect-ratio: 16/9;
    border: none;
    border-radius: 4px;
    margin: 10px 0;
}

/* Text Alignment */
.ProseMirror p[style*="text-align: center"],
.ProseMirror h1[style*="text-align: center"],
.ProseMirror h2[style*="text-align: center"] {
    text-align: center;
}

.ProseMirror p[style*="text-align: right"],
.ProseMirror h1[style*="text-align: right"],
.ProseMirror h2[style*="text-align: right"] {
    text-align: right;
}

.ProseMirror p[style*="text-align: justify"],
.ProseMirror h1[style*="text-align: justify"],
.ProseMirror h2[style*="text-align: justify"] {
    text-align: justify;
}

.ProseMirror a {
    color: #e74c3c;
    text-decoration: underline;
}

/* Color Picker & Popups (Simplified) */
.color-picker-wrapper {
    position: relative;
    display: inline-block;
}

.color-options {
    position: absolute;
    top: 100%;
    left: 0;
    background: #2a2a2a;
    border: 1px solid #444;
    padding: 8px;
    border-radius: 4px;
    display: none;
    grid-template-columns: repeat(5, 1fr);
    gap: 5px;
    z-index: 1000;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    width: 150px;
}

.color-option {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.color-option:hover {
    transform: scale(1.2);
}

/* Image Upload Loader */
.image-uploading {
    opacity: 0.5;
    pointer-events: none;
}

/* Placeholder */
.ProseMirror p.is-editor-empty:first-child::before {
    color: #555;
    content: attr(data-placeholder);
    float: left;
    height: 0;
    pointer-events: none;
}