/* ============================================
   RSL Text Editor Component
   Version: 1.0.0
   Description: Accessible, lightweight WYSIWYG text editor
   ============================================ */

/* CSS Custom Properties */
:root {
    --rsl-editor-bg: #ffffff;
    --rsl-editor-border: #d1d5db;
    --rsl-editor-border-focus: #6E7BFF;
    --rsl-editor-text: #1f2937;
    --rsl-editor-placeholder: #9ca3af;
    --rsl-editor-toolbar-bg: #f9fafb;
    --rsl-editor-toolbar-border: #e5e7eb;
    --rsl-editor-btn-bg: transparent;
    --rsl-editor-btn-hover: #e5e7eb;
    --rsl-editor-btn-active: #6E7BFF;
    --rsl-editor-btn-active-text: #ffffff;
    --rsl-editor-status-bg: #f3f4f6;
    --rsl-editor-status-text: #6b7280;
    --rsl-editor-dropdown-bg: #ffffff;
    --rsl-editor-dropdown-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    --rsl-editor-link-color: #6E7BFF;
    --rsl-editor-selection-bg: rgba(110, 123, 255, 0.2);
    --rsl-editor-focus-ring: 0 0 0 3px rgba(110, 123, 255, 0.3);
    --rsl-editor-transition: 0.15s ease;
    --rsl-editor-radius: 8px;
    --rsl-editor-separator: #e5e7eb;
}

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

.rsl-text-editor {
    display: flex;
    flex-direction: column;
    border: 2px solid var(--rsl-editor-border);
    border-radius: var(--rsl-editor-radius);
    background: var(--rsl-editor-bg);
    overflow: hidden;
    transition: border-color var(--rsl-editor-transition), box-shadow var(--rsl-editor-transition);
}

.rsl-text-editor:focus-within {
    border-color: var(--rsl-editor-border-focus);
    box-shadow: var(--rsl-editor-focus-ring);
}

.rsl-text-editor.rsl-text-editor-disabled {
    opacity: 0.6;
    pointer-events: none;
}

/* ==========================================================================
   Toolbar
   ========================================================================== */

.rsl-text-editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem;
    background: var(--rsl-editor-toolbar-bg);
    border-bottom: 1px solid var(--rsl-editor-toolbar-border);
    user-select: none;
}

/* Toolbar Group */
.rsl-text-editor-group {
    display: flex;
    align-items: center;
    gap: 2px;
}

/* Separator between groups */
.rsl-text-editor-separator {
    width: 1px;
    height: 24px;
    background: var(--rsl-editor-separator);
    margin: 0 0.5rem;
    flex-shrink: 0;
}

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

.rsl-text-editor-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    margin: 0;
    background: var(--rsl-editor-btn-bg);
    border: none;
    border-radius: 4px;
    color: var(--rsl-editor-text);
    font-size: 14px;
    cursor: pointer;
    transition: all var(--rsl-editor-transition);
    position: relative;
}

.rsl-text-editor-btn:hover {
    background: var(--rsl-editor-btn-hover);
}

.rsl-text-editor-btn:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--rsl-editor-border-focus);
    z-index: 1;
}

.rsl-text-editor-btn:focus:not(:focus-visible) {
    box-shadow: none;
}

.rsl-text-editor-btn:focus-visible {
    outline: 2px solid var(--rsl-editor-border-focus);
    outline-offset: 2px;
}

/* Active state (toggle on) */
.rsl-text-editor-btn[aria-pressed="true"],
.rsl-text-editor-btn.active {
    background: var(--rsl-editor-btn-active);
    color: var(--rsl-editor-btn-active-text);
}

.rsl-text-editor-btn[aria-pressed="true"]:hover,
.rsl-text-editor-btn.active:hover {
    background: #5a67d8;
}

/* Button icons */
.rsl-text-editor-btn svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
    pointer-events: none;
}

/* Button tooltip */
.rsl-text-editor-btn[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    padding: 0.375rem 0.625rem;
    background: #1f2937;
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    border-radius: 4px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s, visibility 0.15s;
    pointer-events: none;
    z-index: 1000;
}

.rsl-text-editor-btn[data-tooltip]::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #1f2937;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s, visibility 0.15s;
    pointer-events: none;
    z-index: 1000;
}

.rsl-text-editor-btn:hover[data-tooltip]::after,
.rsl-text-editor-btn:hover[data-tooltip]::before,
.rsl-text-editor-btn:focus[data-tooltip]::after,
.rsl-text-editor-btn:focus[data-tooltip]::before {
    opacity: 1;
    visibility: visible;
}

/* ==========================================================================
   Dropdown (Headings, etc.)
   ========================================================================== */

.rsl-text-editor-dropdown {
    position: relative;
}

.rsl-text-editor-dropdown-btn {
    width: auto;
    min-width: 80px;
    padding: 0 0.5rem;
    gap: 0.375rem;
    font-size: 0.8125rem;
    font-weight: 500;
}

.rsl-text-editor-dropdown-btn svg.dropdown-arrow {
    width: 12px;
    height: 12px;
    transition: transform var(--rsl-editor-transition);
}

.rsl-text-editor-dropdown-btn[aria-expanded="true"] svg.dropdown-arrow {
    transform: rotate(180deg);
}

.rsl-text-editor-dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 140px;
    padding: 0.375rem 0;
    background: var(--rsl-editor-dropdown-bg);
    border: 1px solid var(--rsl-editor-border);
    border-radius: 6px;
    box-shadow: var(--rsl-editor-dropdown-shadow);
    list-style: none;
    margin: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity 0.15s, visibility 0.15s, transform 0.15s;
    z-index: 1000;
}

.rsl-text-editor-dropdown-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.rsl-text-editor-dropdown-item {
    display: block;
    width: 100%;
    padding: 0.5rem 1rem;
    margin: 0;
    background: transparent;
    border: none;
    color: var(--rsl-editor-text);
    font-size: 0.875rem;
    text-align: left;
    cursor: pointer;
    transition: background var(--rsl-editor-transition);
}

.rsl-text-editor-dropdown-item:hover,
.rsl-text-editor-dropdown-item:focus {
    background: var(--rsl-editor-btn-hover);
    outline: none;
}

.rsl-text-editor-dropdown-item:focus-visible {
    background: var(--rsl-editor-btn-hover);
    outline: 2px solid var(--rsl-editor-border-focus);
    outline-offset: -2px;
}

.rsl-text-editor-dropdown-item[aria-selected="true"] {
    background: rgba(110, 123, 255, 0.1);
    color: var(--rsl-editor-btn-active);
    font-weight: 600;
}

/* Heading styles in dropdown */
.rsl-text-editor-dropdown-item[data-value="h1"] { font-size: 1.5rem; font-weight: 700; }
.rsl-text-editor-dropdown-item[data-value="h2"] { font-size: 1.25rem; font-weight: 700; }
.rsl-text-editor-dropdown-item[data-value="h3"] { font-size: 1.125rem; font-weight: 600; }
.rsl-text-editor-dropdown-item[data-value="h4"] { font-size: 1rem; font-weight: 600; }
.rsl-text-editor-dropdown-item[data-value="p"] { font-size: 0.875rem; }

/* ==========================================================================
   Content Area
   ========================================================================== */

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

.rsl-text-editor-content:focus {
    outline: none;
}

/* Placeholder */
.rsl-text-editor-content:empty::before {
    content: attr(data-placeholder);
    color: var(--rsl-editor-placeholder);
    pointer-events: none;
}

.rsl-text-editor-content:focus:empty::before {
    color: var(--rsl-editor-placeholder);
}

/* Selection styling */
.rsl-text-editor-content ::selection {
    background: var(--rsl-editor-selection-bg);
}

/* Content element styling */
.rsl-text-editor-content h1 {
    font-size: 2rem;
    font-weight: 700;
    margin: 0 0 1rem 0;
    line-height: 1.2;
}

.rsl-text-editor-content h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 0.875rem 0;
    line-height: 1.25;
}

.rsl-text-editor-content h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 0.75rem 0;
    line-height: 1.3;
}

.rsl-text-editor-content h4 {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0 0 0.625rem 0;
    line-height: 1.35;
}

.rsl-text-editor-content p {
    margin: 0 0 1rem 0;
}

.rsl-text-editor-content p:last-child {
    margin-bottom: 0;
}

.rsl-text-editor-content a {
    color: var(--rsl-editor-link-color);
    text-decoration: underline;
}

.rsl-text-editor-content a:hover {
    text-decoration: none;
}

.rsl-text-editor-content ul,
.rsl-text-editor-content ol {
    margin: 0 0 1rem 0;
    padding-left: 1.5rem;
}

.rsl-text-editor-content li {
    margin-bottom: 0.25rem;
}

.rsl-text-editor-content blockquote {
    margin: 0 0 1rem 0;
    padding: 0.75rem 1rem;
    border-left: 4px solid var(--rsl-editor-btn-active);
    background: rgba(110, 123, 255, 0.05);
    font-style: italic;
}

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

.rsl-text-editor-content hr {
    border: none;
    border-top: 2px solid var(--rsl-editor-separator);
    margin: 1.5rem 0;
}

/* ==========================================================================
   Source View
   ========================================================================== */

.rsl-text-editor-source {
    display: none;
    flex: 1;
    min-height: 150px;
    max-height: var(--editor-max-height, none);
    padding: 1rem;
    margin: 0;
    background: #1e1e1e;
    border: none;
    border-radius: 0;
    color: #d4d4d4;
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    font-size: 0.875rem;
    line-height: 1.5;
    resize: none;
    overflow-y: auto;
}

.rsl-text-editor-source:focus {
    outline: none;
}

.rsl-text-editor[data-source-view="true"] .rsl-text-editor-content {
    display: none;
}

.rsl-text-editor[data-source-view="true"] .rsl-text-editor-source {
    display: block;
}

/* ==========================================================================
   Status Bar
   ========================================================================== */

.rsl-text-editor-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.5rem 0.75rem;
    background: var(--rsl-editor-status-bg);
    border-top: 1px solid var(--rsl-editor-toolbar-border);
    font-size: 0.75rem;
    color: var(--rsl-editor-status-text);
}

.rsl-text-editor-status-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.rsl-text-editor-status-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.rsl-text-editor-count {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.rsl-text-editor-count-label {
    opacity: 0.8;
}

.rsl-text-editor-count-value {
    font-weight: 600;
    color: var(--rsl-editor-text);
}

/* Character limit warning */
.rsl-text-editor-count.warning .rsl-text-editor-count-value {
    color: #d97706;
}

.rsl-text-editor-count.danger .rsl-text-editor-count-value {
    color: #dc2626;
}

/* Character limit progress bar */
.rsl-text-editor-progress {
    width: 60px;
    height: 4px;
    background: var(--rsl-editor-separator);
    border-radius: 2px;
    overflow: hidden;
}

.rsl-text-editor-progress-bar {
    height: 100%;
    background: var(--rsl-editor-btn-active);
    border-radius: 2px;
    transition: width 0.2s ease, background 0.2s ease;
}

.rsl-text-editor-progress-bar.warning {
    background: #d97706;
}

.rsl-text-editor-progress-bar.danger {
    background: #dc2626;
}

/* Source view indicator */
.rsl-text-editor-source-indicator {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.5rem;
    background: rgba(110, 123, 255, 0.1);
    border-radius: 4px;
    font-weight: 500;
    color: var(--rsl-editor-btn-active);
}

.rsl-text-editor-source-indicator.hidden {
    display: none;
}

/* ==========================================================================
   Link/Image Dialog
   ========================================================================== */

.rsl-text-editor-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

.rsl-text-editor-dialog-overlay.open {
    opacity: 1;
    visibility: visible;
}

.rsl-text-editor-dialog {
    width: 90%;
    max-width: 400px;
    padding: 1.5rem;
    background: var(--rsl-editor-bg);
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    transform: scale(0.95);
    transition: transform 0.2s;
}

.rsl-text-editor-dialog-overlay.open .rsl-text-editor-dialog {
    transform: scale(1);
}

.rsl-text-editor-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.rsl-text-editor-dialog-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--rsl-editor-text);
    margin: 0;
}

.rsl-text-editor-dialog-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--rsl-editor-status-text);
    cursor: pointer;
    transition: background var(--rsl-editor-transition), color var(--rsl-editor-transition);
}

.rsl-text-editor-dialog-close:hover {
    background: var(--rsl-editor-btn-hover);
    color: var(--rsl-editor-text);
}

.rsl-text-editor-dialog-close:focus {
    outline: 2px solid var(--rsl-editor-border-focus);
    outline-offset: 2px;
}

.rsl-text-editor-dialog-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.rsl-text-editor-dialog-field {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.rsl-text-editor-dialog-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--rsl-editor-text);
}

.rsl-text-editor-dialog-input {
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--rsl-editor-border);
    border-radius: 6px;
    font-size: 0.9375rem;
    color: var(--rsl-editor-text);
    background: var(--rsl-editor-bg);
    transition: border-color var(--rsl-editor-transition), box-shadow var(--rsl-editor-transition);
}

.rsl-text-editor-dialog-input:focus {
    outline: none;
    border-color: var(--rsl-editor-border-focus);
    box-shadow: 0 0 0 3px rgba(110, 123, 255, 0.15);
}

.rsl-text-editor-dialog-input::placeholder {
    color: var(--rsl-editor-placeholder);
}

.rsl-text-editor-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.rsl-text-editor-dialog-btn {
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--rsl-editor-transition);
}

.rsl-text-editor-dialog-btn-cancel {
    background: var(--rsl-editor-btn-hover);
    color: var(--rsl-editor-text);
}

.rsl-text-editor-dialog-btn-cancel:hover {
    background: var(--rsl-editor-separator);
}

.rsl-text-editor-dialog-btn-primary {
    background: var(--rsl-editor-btn-active);
    color: var(--rsl-editor-btn-active-text);
}

.rsl-text-editor-dialog-btn-primary:hover {
    background: #5a67d8;
}

.rsl-text-editor-dialog-btn:focus {
    outline: 2px solid var(--rsl-editor-border-focus);
    outline-offset: 2px;
}

/* ==========================================================================
   Keyboard Shortcuts Overlay
   ========================================================================== */

.rsl-text-editor-shortcuts-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

.rsl-text-editor-shortcuts-overlay.open {
    opacity: 1;
    visibility: visible;
}

.rsl-text-editor-shortcuts {
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    padding: 1.5rem;
    background: var(--rsl-editor-bg);
    border-radius: 12px;
    overflow-y: auto;
}

.rsl-text-editor-shortcuts-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 0 1.25rem 0;
    color: var(--rsl-editor-text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.rsl-text-editor-shortcuts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.rsl-text-editor-shortcut {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    background: var(--rsl-editor-status-bg);
    border-radius: 6px;
}

.rsl-text-editor-shortcut-label {
    font-size: 0.875rem;
    color: var(--rsl-editor-text);
}

.rsl-text-editor-shortcut-keys {
    display: flex;
    gap: 0.25rem;
}

.rsl-text-editor-key {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 0.5rem;
    background: var(--rsl-editor-bg);
    border: 1px solid var(--rsl-editor-border);
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: inherit;
    color: var(--rsl-editor-status-text);
}

.rsl-text-editor-shortcuts-hint {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--rsl-editor-separator);
    font-size: 0.8125rem;
    color: var(--rsl-editor-status-text);
    text-align: center;
}

/* ==========================================================================
   Live Region (Screen Reader Announcements)
   ========================================================================== */

.rsl-text-editor-live-region {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ==========================================================================
   Toolbar Presets
   ========================================================================== */

/* Minimal toolbar */
.rsl-text-editor[data-editor-toolbar="minimal"] .rsl-text-editor-group:not([data-group="format-basic"]):not([data-group="insert-link"]) {
    display: none;
}

.rsl-text-editor[data-editor-toolbar="minimal"] .rsl-text-editor-separator {
    display: none;
}

/* Basic toolbar */
.rsl-text-editor[data-editor-toolbar="basic"] .rsl-text-editor-group[data-group="format-headings"],
.rsl-text-editor[data-editor-toolbar="basic"] .rsl-text-editor-group[data-group="format-align"],
.rsl-text-editor[data-editor-toolbar="basic"] .rsl-text-editor-group[data-group="insert-image"],
.rsl-text-editor[data-editor-toolbar="basic"] .rsl-text-editor-group[data-group="actions-source"] {
    display: none;
}

/* ==========================================================================
   Read-only Mode
   ========================================================================== */

.rsl-text-editor[data-editor-read-only="true"] .rsl-text-editor-toolbar {
    display: none;
}

.rsl-text-editor[data-editor-read-only="true"] .rsl-text-editor-content {
    cursor: default;
}

.rsl-text-editor[data-editor-read-only="true"] .rsl-text-editor-status {
    display: none;
}

/* ==========================================================================
   Focus Mode (toolbar fades when typing)
   ========================================================================== */

.rsl-text-editor.focus-mode .rsl-text-editor-toolbar {
    opacity: 0.4;
    transition: opacity 0.3s ease;
}

.rsl-text-editor.focus-mode:hover .rsl-text-editor-toolbar,
.rsl-text-editor.focus-mode .rsl-text-editor-toolbar:focus-within {
    opacity: 1;
}

/* ==========================================================================
   Dark Mode
   ========================================================================== */

[data-theme="dark"] {
    --rsl-editor-bg: #1a1a2e;
    --rsl-editor-border: #374151;
    --rsl-editor-border-focus: #818cf8;
    --rsl-editor-text: #e5e7eb;
    --rsl-editor-placeholder: #6b7280;
    --rsl-editor-toolbar-bg: #111827;
    --rsl-editor-toolbar-border: #374151;
    --rsl-editor-btn-bg: transparent;
    --rsl-editor-btn-hover: #374151;
    --rsl-editor-btn-active: #818cf8;
    --rsl-editor-btn-active-text: #ffffff;
    --rsl-editor-status-bg: #111827;
    --rsl-editor-status-text: #9ca3af;
    --rsl-editor-dropdown-bg: #1f2937;
    --rsl-editor-dropdown-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    --rsl-editor-link-color: #a5b4fc;
    --rsl-editor-selection-bg: rgba(129, 140, 248, 0.3);
    --rsl-editor-focus-ring: 0 0 0 3px rgba(129, 140, 248, 0.3);
    --rsl-editor-separator: #374151;
}

[data-theme="dark"] .rsl-text-editor-btn[data-tooltip]::after {
    background: #374151;
}

[data-theme="dark"] .rsl-text-editor-btn[data-tooltip]::before {
    border-top-color: #374151;
}

[data-theme="dark"] .rsl-text-editor-source {
    background: #0d1117;
    color: #c9d1d9;
}

[data-theme="dark"] .rsl-text-editor-key {
    background: #1f2937;
    border-color: #4b5563;
}

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

@media (max-width: 768px) {
    .rsl-text-editor-toolbar {
        padding: 0.375rem;
        gap: 0.125rem;
    }

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

    .rsl-text-editor-btn svg {
        width: 14px;
        height: 14px;
    }

    .rsl-text-editor-separator {
        margin: 0 0.25rem;
        height: 20px;
    }

    .rsl-text-editor-dropdown-btn {
        min-width: 60px;
        font-size: 0.75rem;
    }

    .rsl-text-editor-content {
        padding: 0.75rem;
        font-size: 0.9375rem;
    }

    .rsl-text-editor-status {
        flex-wrap: wrap;
        gap: 0.5rem;
        padding: 0.375rem 0.5rem;
    }

    .rsl-text-editor-shortcuts-grid {
        grid-template-columns: 1fr;
    }

    /* Hide tooltips on touch devices */
    .rsl-text-editor-btn[data-tooltip]::after,
    .rsl-text-editor-btn[data-tooltip]::before {
        display: none;
    }
}

@media (max-width: 480px) {
    .rsl-text-editor-group[data-group="format-align"] {
        display: none;
    }

    .rsl-text-editor-status-left {
        gap: 0.5rem;
    }

    .rsl-text-editor-progress {
        width: 40px;
    }
}

/* ==========================================================================
   Reduced Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .rsl-text-editor,
    .rsl-text-editor-btn,
    .rsl-text-editor-dropdown-menu,
    .rsl-text-editor-dialog-overlay,
    .rsl-text-editor-dialog,
    .rsl-text-editor-shortcuts-overlay,
    .rsl-text-editor-progress-bar {
        transition: none;
    }
}

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

@media print {
    .rsl-text-editor {
        border: none;
        box-shadow: none;
    }

    .rsl-text-editor-toolbar,
    .rsl-text-editor-status {
        display: none;
    }

    .rsl-text-editor-content {
        padding: 0;
        max-height: none;
        overflow: visible;
    }
}
