/* Custom Editor Styles - Default Theme */
.editor-toolbar,
.bbcode-toolbar {
    user-select: none;
    background-color: #f8f9fa; /* neutral-50 */
    border: 1px solid #e9ecef; /* neutral-200 */
    border-bottom: none;
    border-radius: 0.5rem 0.5rem 0 0; /* rounded-t-lg */
    padding: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.dark .editor-toolbar,
.dark .bbcode-toolbar {
    background-color: #1f2937; /* neutral-800 */
    border-color: #374151; /* neutral-700 */
}

.editor-btn,
.bbcode-btn {
    padding: 0.375rem 0.75rem;
    background-color: white;
    border: 1px solid #dee2e6; /* neutral-300 */
    border-radius: 0.375rem; /* rounded-md */
    color: #212529; /* neutral-900 */
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
}

.dark .editor-btn,
.dark .bbcode-btn {
    background-color: #374151; /* neutral-700 */
    border-color: #4b5563; /* neutral-600 */
    color: #f9fafb; /* neutral-100 */
}

.editor-btn:hover,
.bbcode-btn:hover {
    background-color: #e9ecef; /* neutral-200 */
    border-color: #ced4da; /* neutral-400 */
}

.dark .editor-btn:hover,
.dark .bbcode-btn:hover {
    background-color: #4b5563; /* neutral-600 */
    border-color: #6b7280; /* neutral-500 */
}

.editor-btn:active,
.bbcode-btn:active {
    transform: scale(0.95);
    background-color: #dee2e6; /* neutral-300 */
}

.dark .editor-btn:active,
.dark .bbcode-btn:active {
    background-color: #6b7280; /* neutral-500 */
}

.editor-separator {
    width: 1px;
    background-color: #dee2e6; /* neutral-300 */
    margin: 0 0.25rem;
    height: 1.5rem;
    align-self: center;
}

.dark .editor-separator {
    background-color: #4b5563; /* neutral-600 */
}

.editor-visual {
    min-height: 300px;
    border: 1px solid #e9ecef; /* neutral-200 */
    border-top: none;
    border-radius: 0 0 0.5rem 0.5rem; /* rounded-b-lg */
    background-color: white;
    color: #212529; /* neutral-900 */
    padding: 1rem;
    overflow-y: auto;
    outline: none;
    line-height: 1.6;
}

.dark .editor-visual {
    background-color: #374151; /* neutral-700 */
    border-color: #4b5563; /* neutral-600 */
    color: #f9fafb; /* neutral-100 */
}

.editor-visual:focus {
    outline: 2px solid #0066cc; /* primary-500 */
    outline-offset: -2px;
    border-color: #0066cc; /* primary-500 */
}

.dark .editor-visual:focus {
    outline-color: #2d8f8f; /* primary-500 */
    border-color: #2d8f8f; /* primary-500 */
}

.editor-visual.editor-empty:before {
    content: attr(data-placeholder);
    color: #adb5bd; /* neutral-500 */
    pointer-events: none;
    position: absolute;
}

.dark .editor-visual.editor-empty:before {
    color: #6b7280; /* neutral-500 */
}

.editor-visual img {
    max-width: 100%;
    height: auto;
    border-radius: 0.375rem; /* rounded-md */
    margin: 0.5rem 0;
}

.editor-visual a {
    color: #0066cc; /* primary-600 */
    text-decoration: underline;
}

.dark .editor-visual a {
    color: #2d8f8f; /* primary-400 */
}

.editor-visual a:hover {
    color: #0066cc; /* primary-700 */
}

.dark .editor-visual a:hover {
    color: #3ba3a3; /* primary-300 */
}

/* Mention Dropdown */
.mention-dropdown {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.dark .mention-dropdown {
    background-color: #374151 !important; /* neutral-800 */
    border-color: #4b5563 !important; /* neutral-700 */
}

.mention-item {
    transition: background-color 0.15s;
}

.mention-item:hover,
.mention-item.selected {
    background-color: #e9ecef; /* neutral-200 */
    color: #212529; /* neutral-900 */
}

.dark .mention-item:hover,
.dark .mention-item.selected {
    background-color: #4b5563 !important; /* neutral-600 */
    color: #f9fafb !important; /* neutral-100 */
}

.mention-item.selected {
    background-color: #dbeafe; /* primary-100 */
    color: #1e40af; /* primary-800 */
    font-weight: 500;
}

.dark .mention-item.selected {
    background-color: #1e3a5f !important; /* primary-900/30 */
    color: #7dd3fc !important; /* primary-300 */
}

.mention-item:last-child {
    border-bottom: none;
}

.editor-visual blockquote {
    border-left: 4px solid #2d8f8f; /* primary-500 */
    padding-left: 1rem;
    margin: 1rem 0;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    background-color: #f1f3f5; /* neutral-100 */
    font-style: italic;
    border-radius: 0 0.375rem 0.375rem 0; /* rounded-r-md */
}

.dark .editor-visual blockquote {
    background-color: #1f2937; /* neutral-800 */
    border-left-color: #2d8f8f; /* primary-500 */
}

.editor-visual ul,
.editor-visual ol {
    margin: 0.5rem 0;
    padding-left: 2rem;
    list-style-type: disc;
}

.editor-visual ol {
    list-style-type: decimal;
}

.editor-visual ul li,
.editor-visual ol li {
    margin: 0.25rem 0;
    display: list-item;
}

.editor-visual h1,
.editor-visual h2,
.editor-visual h3,
.editor-visual h4,
.editor-visual h5,
.editor-visual h6 {
    margin: 1rem 0 0.5rem 0;
    font-weight: bold;
    color: #212529; /* neutral-900 */
}

.dark .editor-visual h1,
.dark .editor-visual h2,
.dark .editor-visual h3,
.dark .editor-visual h4,
.dark .editor-visual h5,
.dark .editor-visual h6 {
    color: #f9fafb; /* neutral-100 */
}

.editor-visual h1 {
    font-size: 2rem;
}

.editor-visual h2 {
    font-size: 1.5rem;
}

.editor-visual h3 {
    font-size: 1.25rem;
}

.editor-visual h4 {
    font-size: 1.125rem;
}

.editor-visual h5 {
    font-size: 1rem;
}

.editor-visual h6 {
    font-size: 0.875rem;
}

.editor-visual p {
    margin: 0.5rem 0;
    color: inherit;
}

.dark .editor-visual p {
    color: #f9fafb; /* neutral-100 */
}

.editor-visual code {
    background-color: #f1f3f5; /* neutral-100 */
    color: #111827; /* neutral-900 */
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.875em;
}

.dark .editor-visual code {
    background-color: #1f2937; /* neutral-800 */
    color: #f9fafb; /* neutral-100 */
}

.editor-visual pre {
    background-color: #f1f3f5; /* neutral-100 */
    color: #111827; /* neutral-900 */
    padding: 1rem;
    border-radius: 0.375rem;
    overflow-x: auto;
    margin: 1rem 0;
}

.dark .editor-visual pre {
    background-color: #1f2937; /* neutral-800 */
    color: #f9fafb; /* neutral-100 */
}

.editor-visual pre code {
    background-color: transparent;
    padding: 0;
    color: inherit;
}

.editor-visual hr {
    border: none;
    border-top: 1px solid #e9ecef; /* neutral-200 */
    margin: 1rem 0;
}

.dark .editor-visual hr {
    border-top-color: #4b5563; /* neutral-600 */
}

.editor-visual table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.editor-visual table th,
.editor-visual table td {
    border: 1px solid #e9ecef; /* neutral-200 */
    padding: 0.5rem;
    text-align: left;
}

.dark .editor-visual table th,
.dark .editor-visual table td {
    border-color: #4b5563; /* neutral-600 */
    color: #f9fafb; /* neutral-100 */
}

.editor-visual table th {
    background-color: #f8f9fa; /* neutral-50 */
    font-weight: 600;
}

.dark .editor-visual table th {
    background-color: #374151; /* neutral-700 */
}

.bbcode-textarea {
    width: 100%;
    padding: 1rem;
    border: 1px solid #e9ecef; /* neutral-200 */
    border-top: none;
    border-radius: 0 0 0.5rem 0.5rem; /* rounded-b-lg */
    background-color: white;
    color: #212529; /* neutral-900 */
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.875rem; /* text-sm */
    resize: vertical;
    outline: none;
    min-height: 300px;
    line-height: 1.6;
}

.dark .bbcode-textarea {
    background-color: #374151; /* neutral-700 */
    border-color: #4b5563; /* neutral-600 */
    color: #f9fafb; /* neutral-100 */
}

.bbcode-textarea:focus {
    outline: 2px solid #2d8f8f; /* primary-500 */
    outline-offset: -2px;
    border-color: #2d8f8f; /* primary-500 */
}

.dark .bbcode-textarea:focus {
    outline-color: #2d8f8f; /* primary-500 */
    border-color: #2d8f8f; /* primary-500 */
}

.bbcode-textarea::placeholder {
    color: #adb5bd; /* neutral-500 */
}

.dark .bbcode-textarea::placeholder {
    color: #6b7280; /* neutral-500 */
}

/* Dropdown Menu Styles */
.editor-format-dropdown {
    position: relative;
    display: inline-block;
}

.editor-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid #dee2e6; /* neutral-300 */
    border-radius: 0.375rem; /* rounded-md */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    min-width: 150px;
    margin-top: 4px;
    overflow: hidden;
}

.dark .editor-dropdown-menu {
    background-color: #374151; /* neutral-800 */
    border-color: #4b5563; /* neutral-700 */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.editor-dropdown-item {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    text-align: left;
    background: white;
    border: none;
    color: #212529; /* neutral-900 */
    font-size: 0.875rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.dark .editor-dropdown-item {
    background-color: #374151; /* neutral-800 */
    color: #f9fafb; /* neutral-100 */
}

.editor-dropdown-item:hover {
    background-color: #f1f3f5; /* neutral-100 */
}

.dark .editor-dropdown-item:hover {
    background-color: #4b5563; /* neutral-600 */
}

.editor-dropdown-item:first-child {
    border-top-left-radius: 0.375rem;
    border-top-right-radius: 0.375rem;
}

.editor-dropdown-item:last-child {
    border-bottom-left-radius: 0.375rem;
    border-bottom-right-radius: 0.375rem;
}

/* Editor Container - Ensure relative positioning for dropdowns */
#editor-container,
#reply-editor-container {
    position: relative;
}

/* Editor Modal Styles */
.editor-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.editor-modal-content {
    background: white;
    border-radius: 0.5rem;
    padding: 1.5rem;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.dark .editor-modal-content {
    background-color: #374151; /* neutral-800 */
    color: #f9fafb; /* neutral-100 */
}

.editor-modal-content h3 {
    color: #212529;
}

.dark .editor-modal-content h3 {
    color: #f9fafb; /* neutral-100 */
}

.editor-modal-content .close-modal {
    color: #6b7280;
}

.dark .editor-modal-content .close-modal {
    color: #9ca3af; /* neutral-400 */
}

.dark .editor-modal-content .close-modal:hover {
    color: #f9fafb; /* neutral-100 */
}

.editor-modal-content .tabs {
    border-bottom: 1px solid #e5e7eb;
}

.dark .editor-modal-content .tabs {
    border-bottom-color: #4b5563; /* neutral-600 */
}

.editor-modal-content .tab-btn {
    color: #374151;
}

.dark .editor-modal-content .tab-btn {
    color: #d1d5db; /* neutral-300 */
}

.dark .editor-modal-content .tab-btn.active {
    color: #2d8f8f; /* primary-500 */
    border-bottom-color: #2d8f8f !important;
}

.editor-modal-content label {
    color: #374151;
}

.dark .editor-modal-content label {
    color: #f9fafb; /* neutral-100 */
}

.editor-modal-content input[type="text"],
.editor-modal-content input[type="number"],
.editor-modal-content input[type="file"] {
    background-color: white;
    border-color: #d1d5db;
    color: #212529;
}

.dark .editor-modal-content input[type="text"],
.dark .editor-modal-content input[type="number"],
.dark .editor-modal-content input[type="file"] {
    background-color: #1f2937; /* neutral-900 */
    border-color: #4b5563; /* neutral-600 */
    color: #f9fafb; /* neutral-100 */
}

.dark .editor-modal-content input[type="text"]::placeholder,
.dark .editor-modal-content input[type="number"]::placeholder {
    color: #6b7280; /* neutral-500 */
}

.editor-modal-content p {
    color: #6b7280;
}

.dark .editor-modal-content p {
    color: #9ca3af; /* neutral-400 */
}

.editor-modal-content span {
    color: #6b7280;
}

.dark .editor-modal-content span {
    color: #9ca3af; /* neutral-400 */
}

.editor-modal-content button[type="button"].close-modal {
    background-color: #f3f4f6;
    color: #374151;
}

.dark .editor-modal-content button[type="button"].close-modal {
    background-color: #4b5563; /* neutral-600 */
    color: #f9fafb; /* neutral-100 */
}

.dark .editor-modal-content button[type="button"].close-modal:hover {
    background-color: #6b7280; /* neutral-500 */
}

.editor-modal-content #upload-progress {
    background-color: #f3f4f6;
    color: #374151;
}

.dark .editor-modal-content #upload-progress {
    background-color: #4b5563; /* neutral-600 */
    color: #f9fafb; /* neutral-100 */
}

/* Editor Dropdown Header */
.editor-dropdown-header {
    color: #6c757d;
}

.dark .editor-dropdown-header {
    color: #9ca3af; /* neutral-400 */
}

/* Dropdown container and menu styles */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    min-width: 150px;
    margin-top: 4px;
    overflow: hidden;
}

.dark .dropdown-menu {
    background-color: #374151;
    border-color: #4b5563;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.dropdown-menu button {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    text-align: left;
    background: transparent;
    border: none;
    color: #374151;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.dropdown-menu button:hover {
    background-color: #f3f4f6;
}

.dark .dropdown-menu button {
    color: #e5e7eb;
}

.dark .dropdown-menu button:hover {
    background-color: #4b5563;
}
