/**
 * ProEditor - Professional Editor Stylesheet
 *
 * Modern, clean, RTL-friendly styling for the ProEditor MyBB plugin.
 * Based on TinyMCE 6 with custom skin and ProEditor extensions.
 *
 * Color palette (Light Modern):
 *   Primary:    #2563eb (blue-600)
 *   Accent:     #7c3aed (violet-600)
 *   Success:    #16a34a (green-600)
 *   Warning:    #d97706 (amber-600)
 *   Danger:     #dc2626 (red-600)
 *   Surface:    #ffffff
 *   Background: #f8fafc (slate-50)
 *   Border:     #e2e8f0 (slate-200)
 *   Text:       #1e293b (slate-800)
 *   Muted:      #64748b (slate-500)
 */

/* ==========================================================================
   Root Variables & Theme Tokens
   ========================================================================== */

:root {
    --pe-primary: #2563eb;
    --pe-primary-hover: #1d4ed8;
    --pe-primary-light: #dbeafe;
    --pe-accent: #7c3aed;
    --pe-success: #16a34a;
    --pe-success-light: #dcfce7;
    --pe-warning: #d97706;
    --pe-warning-light: #fef3c7;
    --pe-danger: #dc2626;
    --pe-danger-light: #fee2e2;
    --pe-surface: #ffffff;
    --pe-background: #f8fafc;
    --pe-border: #e2e8f0;
    --pe-border-strong: #cbd5e1;
    --pe-text: #1e293b;
    --pe-text-muted: #64748b;
    --pe-text-light: #94a3b8;
    --pe-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --pe-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --pe-shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --pe-shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --pe-radius-sm: 4px;
    --pe-radius: 6px;
    --pe-radius-md: 8px;
    --pe-radius-lg: 12px;
    --pe-font-family: "Cairo", "Tajawal", "Segoe UI", system-ui, -apple-system, sans-serif;
    --pe-font-mono: "Fira Code", "SFMono-Regular", "Consolas", "Liberation Mono", monospace;
    --pe-transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   Dark Theme (auto-applied if user prefers dark mode)
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    :root[data-pe-theme="auto"] {
        --pe-primary: #3b82f6;
        --pe-primary-hover: #60a5fa;
        --pe-primary-light: #1e3a5f;
        --pe-accent: #a78bfa;
        --pe-success: #4ade80;
        --pe-success-light: #166534;
        --pe-warning: #fbbf24;
        --pe-warning-light: #78350f;
        --pe-danger: #f87171;
        --pe-danger-light: #7f1d1d;
        --pe-surface: #1e293b;
        --pe-background: #0f172a;
        --pe-border: #334155;
        --pe-border-strong: #475569;
        --pe-text: #e2e8f0;
        --pe-text-muted: #94a3b8;
        --pe-text-light: #64748b;
    }
}

/* ==========================================================================
   Main Container
   ========================================================================== */

.proeditor-container {
    position: relative;
    background: var(--pe-surface);
    border-radius: var(--pe-radius-lg);
    box-shadow: var(--pe-shadow);
    overflow: hidden;
    margin: 16px 0;
    border: 1px solid var(--pe-border);
    direction: rtl;
    font-family: var(--pe-font-family);
}

.proeditor-container[dir="ltr"] {
    direction: ltr;
}

.proeditor-toolbar-wrapper {
    background: var(--pe-background);
    border-bottom: 1px solid var(--pe-border);
    min-height: 42px;
}

.proeditor-editor-wrapper {
    background: var(--pe-surface);
    position: relative;
    min-height: 400px;
}

.proeditor-editor-wrapper textarea {
    display: none;
}

/* ==========================================================================
   TinyMCE Toolbar Customization
   ========================================================================== */

.tox-tinymce {
    border: none !important;
    border-radius: 0 !important;
    font-family: var(--pe-font-family) !important;
}

.tox .tox-toolbar__primary {
    background: var(--pe-background) !important;
    border-bottom: 1px solid var(--pe-border) !important;
    padding: 6px 8px !important;
}

.tox .tox-tbtn {
    color: var(--pe-text-muted) !important;
    border-radius: var(--pe-radius) !important;
    transition: var(--pe-transition) !important;
    margin: 2px !important;
}

.tox .tox-tbtn:hover {
    background: var(--pe-primary-light) !important;
    color: var(--pe-primary) !important;
    transform: translateY(-1px);
}

.tox .tox-tbtn--enabled,
.tox .tox-tbtn--enabled:hover {
    background: var(--pe-primary) !important;
    color: white !important;
}

.tox .tox-tbtn--select {
    padding: 0 12px !important;
    font-size: 13px !important;
}

.tox .tox-toolbar__group {
    border-color: var(--pe-border) !important;
}

.tox .tox-split-button {
    border-radius: var(--pe-radius) !important;
    margin: 2px !important;
}

.tox .tox-split-button:hover {
    box-shadow: var(--pe-shadow-sm) !important;
}

/* TinyMCE menubar */
.tox .tox-menubar {
    background: var(--pe-background) !important;
    border-bottom: 1px solid var(--pe-border) !important;
    padding: 4px 8px !important;
}

.tox .tox-mbtn {
    color: var(--pe-text-muted) !important;
    border-radius: var(--pe-radius) !important;
    font-size: 13px !important;
}

.tox .tox-mbtn:hover {
    background: var(--pe-primary-light) !important;
    color: var(--pe-primary) !important;
}

/* TinyMCE editor area */
.tox .tox-edit-area {
    border: none !important;
    background: var(--pe-surface) !important;
}

.tox .tox-edit-area__iframe {
    background: var(--pe-surface) !important;
}

/* ==========================================================================
   Status Bar (Custom)
   ========================================================================== */

.proeditor-statusbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: var(--pe-background);
    border-top: 1px solid var(--pe-border);
    font-size: 12px;
    color: var(--pe-text-muted);
    gap: 16px;
    flex-wrap: wrap;
}

.proeditor-statusbar > span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: var(--pe-radius);
    background: var(--pe-surface);
    transition: var(--pe-transition);
}

.proeditor-statusbar > span:hover {
    background: var(--pe-primary-light);
    color: var(--pe-primary);
}

.proeditor-statusbar i.fas {
    font-size: 11px;
    opacity: 0.8;
}

.proeditor-status-direction {
    cursor: pointer;
    margin-inline-start: auto;
}

.proeditor-status-autosave .fa-check-circle {
    color: var(--pe-success);
}

.proeditor-status-autosave .fa-history {
    color: var(--pe-warning);
}

/* ==========================================================================
   Emoji Picker
   ========================================================================== */

.proeditor-emoji-picker {
    position: absolute;
    z-index: 100000;
    background: var(--pe-surface);
    border: 1px solid var(--pe-border);
    border-radius: var(--pe-radius-md);
    box-shadow: var(--pe-shadow-lg);
    width: 360px;
    max-width: calc(100vw - 32px);
    overflow: hidden;
    font-family: var(--pe-font-family);
}

.proeditor-emoji-header {
    display: flex;
    gap: 8px;
    padding: 10px;
    background: var(--pe-background);
    border-bottom: 1px solid var(--pe-border);
    align-items: center;
}

.proeditor-emoji-search {
    flex: 1;
    padding: 6px 12px;
    border: 1px solid var(--pe-border);
    border-radius: var(--pe-radius);
    font-size: 13px;
    background: var(--pe-surface);
    color: var(--pe-text);
    transition: var(--pe-transition);
    font-family: inherit;
}

.proeditor-emoji-search:focus {
    outline: none;
    border-color: var(--pe-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.proeditor-emoji-close {
    background: transparent;
    border: none;
    color: var(--pe-text-muted);
    cursor: pointer;
    padding: 4px 8px;
    font-size: 18px;
    border-radius: var(--pe-radius);
    transition: var(--pe-transition);
}

.proeditor-emoji-close:hover {
    background: var(--pe-danger-light);
    color: var(--pe-danger);
}

.proeditor-emoji-categories {
    display: flex;
    gap: 2px;
    padding: 6px 8px;
    background: var(--pe-background);
    border-bottom: 1px solid var(--pe-border);
    overflow-x: auto;
}

.proeditor-emoji-cat {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px 10px;
    font-size: 18px;
    border-radius: var(--pe-radius);
    transition: var(--pe-transition);
    opacity: 0.6;
}

.proeditor-emoji-cat:hover {
    background: var(--pe-primary-light);
    opacity: 1;
}

.proeditor-emoji-cat.active {
    background: var(--pe-primary);
    opacity: 1;
}

.proeditor-emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 2px;
    padding: 8px;
    max-height: 280px;
    overflow-y: auto;
}

.proeditor-emoji-item {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px;
    font-size: 22px;
    border-radius: var(--pe-radius);
    transition: var(--pe-transition);
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.proeditor-emoji-item:hover {
    background: var(--pe-primary-light);
    transform: scale(1.15);
}

.proeditor-emoji-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 24px;
    color: var(--pe-text-muted);
    font-size: 13px;
}

/* ==========================================================================
   Mention Dropdown
   ========================================================================== */

.proeditor-mention-dropdown {
    position: absolute;
    z-index: 100000;
    background: var(--pe-surface);
    border: 1px solid var(--pe-border);
    border-radius: var(--pe-radius-md);
    box-shadow: var(--pe-shadow-lg);
    width: 280px;
    max-height: 320px;
    overflow-y: auto;
    font-family: var(--pe-font-family);
}

.proeditor-mention-list {
    list-style: none;
    margin: 0;
    padding: 4px;
}

.proeditor-mention-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    cursor: pointer;
    border-radius: var(--pe-radius);
    transition: var(--pe-transition);
    color: var(--pe-text);
}

.proeditor-mention-item:hover,
.proeditor-mention-item.active {
    background: var(--pe-primary-light);
    color: var(--pe-primary);
}

.proeditor-mention-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--pe-border);
}

.proeditor-mention-name {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
}

.proeditor-mention-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--pe-text-light);
}

.proeditor-mention-status.online {
    background: var(--pe-success);
    box-shadow: 0 0 0 2px var(--pe-success-light);
}

.proeditor-mention-empty {
    padding: 16px;
    text-align: center;
    color: var(--pe-text-muted);
    font-size: 13px;
}

/* ==========================================================================
   Modals
   ========================================================================== */

.proeditor-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100000;
    display: none;
    align-items: center;
    justify-content: center;
    font-family: var(--pe-font-family);
}

.proeditor-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
}

.proeditor-modal-dialog {
    position: relative;
    background: var(--pe-surface);
    border-radius: var(--pe-radius-lg);
    box-shadow: var(--pe-shadow-lg);
    width: 90%;
    max-width: 560px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: proeditor-modal-in 0.2s ease-out;
}

@keyframes proeditor-modal-in {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.proeditor-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--pe-border);
    background: var(--pe-background);
}

.proeditor-modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--pe-text);
}

.proeditor-modal-close {
    background: transparent;
    border: none;
    color: var(--pe-text-muted);
    cursor: pointer;
    font-size: 22px;
    padding: 4px 8px;
    border-radius: var(--pe-radius);
    transition: var(--pe-transition);
    line-height: 1;
}

.proeditor-modal-close:hover {
    background: var(--pe-danger-light);
    color: var(--pe-danger);
}

.proeditor-modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.proeditor-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid var(--pe-border);
    background: var(--pe-background);
}

/* Form Elements */
.proeditor-form-group {
    margin-bottom: 16px;
}

.proeditor-form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--pe-text);
}

.proeditor-form-group input[type="text"],
.proeditor-form-group input[type="url"],
.proeditor-form-group select,
.proeditor-form-group textarea,
.proeditor-code-language,
.proeditor-code-textarea,
.proeditor-spoiler-title-input,
.proeditor-spoiler-textarea,
.proeditor-spoiler-visibility,
.proeditor-image-url-input,
.proeditor-image-alt-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--pe-border);
    border-radius: var(--pe-radius);
    font-size: 14px;
    background: var(--pe-surface);
    color: var(--pe-text);
    font-family: inherit;
    transition: var(--pe-transition);
    box-sizing: border-box;
}

.proeditor-form-group input:focus,
.proeditor-form-group select:focus,
.proeditor-form-group textarea:focus,
.proeditor-code-language:focus,
.proeditor-code-textarea:focus,
.proeditor-spoiler-title-input:focus,
.proeditor-spoiler-textarea:focus,
.proeditor-spoiler-visibility:focus,
.proeditor-image-url-input:focus,
.proeditor-image-alt-input:focus {
    outline: none;
    border-color: var(--pe-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.proeditor-code-textarea {
    font-family: var(--pe-font-mono);
    font-size: 13px;
    min-height: 200px;
    resize: vertical;
    direction: ltr;
    text-align: left;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.proeditor-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--pe-radius);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--pe-transition);
    font-family: inherit;
    text-decoration: none;
}

.proeditor-btn-primary {
    background: var(--pe-primary);
    color: white;
}

.proeditor-btn-primary:hover {
    background: var(--pe-primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--pe-shadow);
}

.proeditor-btn-secondary {
    background: var(--pe-surface);
    color: var(--pe-text);
    border: 1px solid var(--pe-border);
}

.proeditor-btn-secondary:hover {
    background: var(--pe-background);
    border-color: var(--pe-border-strong);
}

.proeditor-btn-danger {
    background: var(--pe-danger);
    color: white;
}

.proeditor-btn-danger:hover {
    background: #b91c1c;
}

/* ==========================================================================
   Image Upload Modal Tabs
   ========================================================================== */

.proeditor-image-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    border-bottom: 2px solid var(--pe-border);
    padding-bottom: 0;
}

.proeditor-image-tabs button {
    background: transparent;
    border: none;
    color: var(--pe-text-muted);
    cursor: pointer;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: var(--pe-transition);
    font-family: inherit;
}

.proeditor-image-tabs button:hover {
    color: var(--pe-primary);
}

.proeditor-image-tabs button.active {
    color: var(--pe-primary);
    border-bottom-color: var(--pe-primary);
}

/* Upload Zone */
.proeditor-upload-zone {
    border: 2px dashed var(--pe-border-strong);
    border-radius: var(--pe-radius-md);
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--pe-transition);
    background: var(--pe-background);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.proeditor-upload-zone:hover,
.proeditor-upload-zone.proeditor-dragover {
    border-color: var(--pe-primary);
    background: var(--pe-primary-light);
}

.proeditor-upload-zone i.fas {
    font-size: 36px;
    color: var(--pe-primary);
    margin-bottom: 8px;
}

.proeditor-upload-zone p {
    margin: 0;
    color: var(--pe-text);
    font-weight: 500;
}

.proeditor-upload-zone span {
    color: var(--pe-text-muted);
    font-size: 12px;
}

.proeditor-upload-preview {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--pe-background);
    border-radius: var(--pe-radius-md);
    border: 1px solid var(--pe-border);
}

.proeditor-preview-img {
    max-width: 120px;
    max-height: 120px;
    border-radius: var(--pe-radius);
    object-fit: cover;
    border: 1px solid var(--pe-border);
}

.proeditor-upload-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.proeditor-file-name {
    font-weight: 600;
    color: var(--pe-text);
    font-size: 13px;
    word-break: break-all;
}

.proeditor-file-size {
    color: var(--pe-text-muted);
    font-size: 12px;
}

/* ==========================================================================
   Editor Content Rendering (in posts)
   ========================================================================== */

.proeditor-spoiler-box {
    background: var(--pe-background);
    border: 1px solid var(--pe-border);
    border-radius: var(--pe-radius-md);
    margin: 12px 0;
    overflow: hidden;
}

.proeditor-spoiler-box .proeditor-spoiler-header {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, var(--pe-primary-light), var(--pe-background));
    padding: 10px 14px;
    font-weight: 600;
    cursor: pointer;
    color: var(--pe-primary);
    transition: var(--pe-transition);
    user-select: none;
}

.proeditor-spoiler-box .proeditor-spoiler-header:hover {
    background: var(--pe-primary-light);
}

.proeditor-spoiler-box .proeditor-spoiler-header i.fas {
    transition: var(--pe-transition);
}

.proeditor-spoiler-box .proeditor-spoiler-arrow {
    margin-inline-start: auto;
}

.proeditor-spoiler-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    padding: 0 14px;
}

.proeditor-spoiler-box.proeditor-spoiler-open .proeditor-spoiler-content {
    max-height: 2000px;
    padding: 12px 14px;
}

.proeditor-spoiler-box.proeditor-spoiler-open .proeditor-spoiler-arrow {
    transform: rotate(180deg);
}

/* Code Blocks */
.proeditor-codeblock {
    background: #1e293b;
    border-radius: var(--pe-radius-md);
    margin: 12px 0;
    overflow: hidden;
    direction: ltr;
    text-align: left;
    box-shadow: var(--pe-shadow);
}

.proeditor-codeblock-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    background: #0f172a;
    color: #94a3b8;
    font-size: 12px;
    border-bottom: 1px solid #334155;
}

.proeditor-codeblock-lang {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: var(--pe-font-mono);
}

.proeditor-codeblock-copy {
    background: transparent;
    border: 1px solid #334155;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: var(--pe-radius-sm);
    font-size: 11px;
    transition: var(--pe-transition);
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.proeditor-codeblock-copy:hover {
    background: #1e293b;
    color: #e2e8f0;
    border-color: #475569;
}

.proeditor-codeblock-pre {
    margin: 0;
    padding: 16px;
    overflow-x: auto;
    background: #1e293b;
}

.proeditor-codeblock code {
    font-family: var(--pe-font-mono);
    font-size: 13px;
    color: #e2e8f0;
    line-height: 1.6;
}

/* Mentions in posts */
.proeditor-mention-link {
    display: inline-block;
    background: var(--pe-primary-light);
    color: var(--pe-primary);
    padding: 1px 6px;
    border-radius: var(--pe-radius-sm);
    font-weight: 600;
    text-decoration: none;
    transition: var(--pe-transition);
}

.proeditor-mention-link:hover {
    background: var(--pe-primary);
    color: white;
    text-decoration: none;
}

/* Info boxes in posts */
.proeditor-infobox {
    background: #dbeafe;
    border-inline-start: 4px solid #2563eb;
    padding: 12px 16px;
    border-radius: var(--pe-radius);
    margin: 12px 0;
    color: #1e3a5f;
}

.proeditor-warnbox {
    background: #fef3c7;
    border-inline-start: 4px solid #d97706;
    padding: 12px 16px;
    border-radius: var(--pe-radius);
    margin: 12px 0;
    color: #78350f;
}

/* Image loading placeholder */
.proeditor-image-loading {
    background: linear-gradient(90deg, var(--pe-background) 0%, var(--pe-border) 50%, var(--pe-background) 100%);
    background-size: 200% 100%;
    animation: proeditor-loading 1.5s infinite;
    border-radius: var(--pe-radius);
    min-width: 100px;
    min-height: 100px;
}

@keyframes proeditor-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ==========================================================================
   RTL-Specific Adjustments
   ========================================================================== */

[dir="rtl"] .proeditor-statusbar {
    direction: rtl;
}

[dir="rtl"] .proeditor-modal-footer {
    flex-direction: row-reverse;
}

[dir="rtl"] .proeditor-image-tabs {
    direction: rtl;
}

[dir="rtl"] .tox .tox-toolbar__primary {
    direction: rtl;
}

[dir="rtl"] .proeditor-codeblock,
[dir="rtl"] .proeditor-codeblock pre,
[dir="rtl"] .proeditor-codeblock code {
    direction: ltr;
    text-align: left;
}

/* ==========================================================================
   Fallback Notice
   ========================================================================== */

.proeditor-fallback-notice {
    background: var(--pe-warning-light);
    color: #78350f;
    padding: 12px 16px;
    border-radius: var(--pe-radius);
    margin-bottom: 12px;
    border-inline-start: 4px solid var(--pe-warning);
    font-size: 13px;
}

.proeditor-fallback-notice i.fas {
    margin-inline-end: 8px;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 768px) {
    .proeditor-container {
        border-radius: var(--pe-radius);
        margin: 8px 0;
    }

    .proeditor-statusbar {
        padding: 6px 10px;
        font-size: 11px;
        gap: 8px;
    }

    .proeditor-statusbar > span {
        padding: 3px 6px;
    }

    .proeditor-emoji-picker {
        width: 100%;
        max-width: calc(100vw - 16px);
        right: 8px;
        left: 8px;
    }

    .proeditor-emoji-grid {
        grid-template-columns: repeat(6, 1fr);
    }

    .proeditor-modal-dialog {
        width: 95%;
        max-width: none;
        margin: 8px;
    }

    .proeditor-upload-zone {
        padding: 24px 12px;
    }

    .tox .tox-toolbar__primary {
        padding: 4px !important;
    }
}

@media (max-width: 480px) {
    .proeditor-emoji-grid {
        grid-template-columns: repeat(5, 1fr);
    }

    .proeditor-statusbar > span {
        padding: 2px 4px;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .proeditor-container,
    .proeditor-statusbar,
    .proeditor-modal {
        display: none !important;
    }
}

/* ==========================================================================
   Scrollbar Styling
   ========================================================================== */

.proeditor-emoji-grid::-webkit-scrollbar,
.proeditor-mention-dropdown::-webkit-scrollbar,
.proeditor-modal-body::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.proeditor-emoji-grid::-webkit-scrollbar-track,
.proeditor-mention-dropdown::-webkit-scrollbar-track,
.proeditor-modal-body::-webkit-scrollbar-track {
    background: var(--pe-background);
}

.proeditor-emoji-grid::-webkit-scrollbar-thumb,
.proeditor-mention-dropdown::-webkit-scrollbar-thumb,
.proeditor-modal-body::-webkit-scrollbar-thumb {
    background: var(--pe-border-strong);
    border-radius: 4px;
}

.proeditor-emoji-grid::-webkit-scrollbar-thumb:hover,
.proeditor-mention-dropdown::-webkit-scrollbar-thumb:hover,
.proeditor-modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--pe-text-muted);
}

/* Code block scrollbar */
.proeditor-codeblock-pre::-webkit-scrollbar {
    height: 8px;
}

.proeditor-codeblock-pre::-webkit-scrollbar-track {
    background: #0f172a;
}

.proeditor-codeblock-pre::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 4px;
}
