/* Trix Editor Base Styling */
trix-editor {
    display: block !important;
    min-height: 120px;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    padding: 12px;
    background: white;
    font-family: inherit;
    line-height: 1.6;
    font-size: 14px;
    max-height: 300px;
    overflow-y: auto;
}

trix-editor:focus {
    outline: none;
    border-color: #1e87f0;
    box-shadow: 0 0 0 3px rgba(30, 135, 240, 0.1);
}

/* Trix Toolbar - Light Mode */
.trix-button-group {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    margin-bottom: 8px;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-right: 8px;
}

.trix-button {
    border: none;
    background: transparent;
    color: #495057;
    padding: 8px 10px;
    border-radius: 4px;
    transition: all 0.2s;
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.trix-button:hover {
    background: #e9ecef;
    color: #212529;
}

.trix-button.trix-active {
    background: #1e87f0;
    color: white;
}

.trix-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Image Gallery Styling */
.image-collection {
    border: 2px dashed #e5e5e5;
    border-radius: 8px;
    padding: 20px;
    background: #fafbfc;
}

.image-item {
    border-left: 4px solid #1e87f0;
    transition: all 0.2s ease;
}

.image-item:hover {
    background-color: #f8f9fa;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.image-item.dragging {
    opacity: 0.5;
    transform: rotate(5deg);
}

/* Sortable indicators */
.uk-sortable .image-item {
    cursor: move;
}

.uk-sortable .image-item:before {
    content: '';
    position: absolute;
    left: -4px;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(45deg, #1e87f0, #0066cc);
}

/* File input styling */
.file-input {
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    transition: border-color 0.2s;
}

.file-input:hover {
    border-color: #1e87f0;
    background-color: #f8fafc;
}

/* Form sections */
.uk-heading-line > span {
    background: white;
    padding: 0 1rem;
    color: #1e87f0;
    font-weight: 600;
}

/* Help text styling */
.uk-form-help {
    color: #6b7280;
    font-size: 0.875rem;
    margin-top: 4px;
}

/* Light Mode - Explicit styles to ensure proper display */
:root trix-editor,
html:not(.dark) trix-editor,
body:not(.dark) trix-editor,
[data-theme="light"] trix-editor {
    background: white;
    border-color: #e5e5e5;
    color: #212529;
}

:root trix-editor:focus,
html:not(.dark) trix-editor:focus,
body:not(.dark) trix-editor:focus,
[data-theme="light"] trix-editor:focus {
    border-color: #1e87f0;
    box-shadow: 0 0 0 3px rgba(30, 135, 240, 0.1);
}

:root .trix-button-group,
html:not(.dark) .trix-button-group,
body:not(.dark) .trix-button-group,
[data-theme="light"] .trix-button-group {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
}

:root .trix-button,
html:not(.dark) .trix-button,
body:not(.dark) .trix-button,
[data-theme="light"] .trix-button {
    color: #495057;
}

:root .trix-button:hover,
html:not(.dark) .trix-button:hover,
body:not(.dark) .trix-button:hover,
[data-theme="light"] .trix-button:hover {
    background: #e9ecef;
    color: #212529;
}

:root .trix-button.trix-active,
html:not(.dark) .trix-button.trix-active,
body:not(.dark) .trix-button.trix-active,
[data-theme="light"] .trix-button.trix-active {
    background: #1e87f0;
    color: white;
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    trix-editor {
        background: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }
    
    trix-editor:focus {
        border-color: #60a5fa;
        box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1);
    }
    
    .trix-button-group {
        background: #4b5563;
        border: 1px solid #6b7280;
    }
    
    .trix-button {
        color: #f9fafb;
    }
    
    .trix-button:hover {
        background: #6b7280;
    }
    
    .trix-button.trix-active {
        background: #60a5fa;
        color: #111827;
    }
    
    .image-collection {
        background: #374151;
        border-color: #4b5563;
    }
    
    .uk-heading-line > span {
        background: #111827;
        color: #60a5fa;
    }
}

/* Class-based dark theme support */
.dark trix-editor,
[data-theme="dark"] trix-editor,
html.dark trix-editor,
body.dark trix-editor {
    background: #374151 !important;
    border-color: #4b5563 !important;
    color: #f9fafb !important;
}

.dark trix-editor:focus,
[data-theme="dark"] trix-editor:focus,
html.dark trix-editor:focus,
body.dark trix-editor:focus {
    border-color: #60a5fa !important;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1) !important;
}

.dark .trix-button-group,
[data-theme="dark"] .trix-button-group,
html.dark .trix-button-group,
body.dark .trix-button-group {
    background: #4b5563 !important;
    border: 1px solid #6b7280;
}

.dark .trix-button,
[data-theme="dark"] .trix-button,
html.dark .trix-button,
body.dark .trix-button {
    color: #f9fafb !important;
}

.dark .trix-button:hover,
[data-theme="dark"] .trix-button:hover,
html.dark .trix-button:hover,
body.dark .trix-button:hover {
    background: #6b7280 !important;
}

.dark .trix-button.trix-active,
[data-theme="dark"] .trix-button.trix-active,
html.dark .trix-button.trix-active,
body.dark .trix-button.trix-active {
    background: #60a5fa !important;
    color: #111827 !important;
}

/* Hide attachment button and related elements */
.trix-button--icon-attach,
.trix-button-group--file-tools {
    display: none !important;
}

/* Custom scrollbar for dark theme */
.dark trix-editor::-webkit-scrollbar,
[data-theme="dark"] trix-editor::-webkit-scrollbar {
    width: 8px;
}

.dark trix-editor::-webkit-scrollbar-track,
[data-theme="dark"] trix-editor::-webkit-scrollbar-track {
    background: #4b5563;
    border-radius: 4px;
}

.dark trix-editor::-webkit-scrollbar-thumb,
[data-theme="dark"] trix-editor::-webkit-scrollbar-thumb {
    background: #6b7280;
    border-radius: 4px;
}

.dark trix-editor::-webkit-scrollbar-thumb:hover,
[data-theme="dark"] trix-editor::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}