/* ===================================
   TEXT EDITOR STYLES
   =================================== */

/* Text Editor Button in Header - Match other header buttons exactly */
.text-editor-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-sm);
    background-color: var(--bg-primary);
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    width: 36px;
    height: 36px;
}

.text-editor-btn:hover {
    background-color: var(--gray-50);
    color: var(--text-primary);
    border-color: var(--border-dark);
}

.text-editor-btn:active {
    transform: translateY(1px);
}

.text-editor-btn i {
    width: 18px;
    height: 18px;
}

/* Off-canvas Container */
.text-editor-offcanvas {
    position: fixed;
    top: 0;
    right: -600px;
    width: 600px;
    height: 100vh;
    background: #ffffff;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease-in-out;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    border-left: 1px solid #e1e4e8;
}

.text-editor-offcanvas.show {
    right: 0;
}

/* Backdrop */
.text-editor-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease-in-out;
}

/* Backdrop is controlled via JavaScript */

/* Header */
.text-editor-header {
    background: white;
    border-bottom: 1px solid #e1e4e8;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    flex-shrink: 0;
}

.text-editor-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: #24292e;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.text-editor-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Buttons */
.text-editor-btn-secondary {
    padding: 6px 12px;
    border: 1px solid #d1d5da;
    border-radius: 6px;
    background: white;
    color: #24292e;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.text-editor-btn-secondary:hover {
    background: #f6f8fa;
    border-color: #d1d5da;
}

.text-editor-btn-primary {
    background: #39c0a3;
    color: white;
    border-color: #29a489;
}

.text-editor-btn-primary:hover {
    background: #5FD0C0;
    border-color: #34BA9E;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(52, 186, 158, 0.3);
}

.text-editor-btn-danger {
    background: #FAF9FA;
    color: #6c757d;
    border-color: #dee2e6;
}

.text-editor-btn-danger:hover {
    background: #e9ecef;
    border-color: #ced4da;
    color: #495057;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.2);
}

.text-editor-close-btn {
    background: none;
    border: none;
    color: #6a737d;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.text-editor-close-btn:hover {
    background: #f6f8fa;
    color: #24292e;
}

/* Version History */
.text-editor-version-section {
    padding: 12px 20px;
    border-bottom: 1px solid #e1e4e8;
    background: #FAF9FA;
    flex-shrink: 0;
}

.text-editor-version-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

/* Button group for import and missive buttons */
.text-editor-version-row .text-editor-import-btn + .text-editor-import-btn {
    margin-left: 4px;
}

/* Message client modal form help text */
.form-help {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    color: #6a737d;
    line-height: 1.3;
}

/* Modal status area for progress feedback */
.modal-status {
    margin-top: 16px;
    padding: 12px 16px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.modal-status.hidden {
    display: none;
}

.modal-status.success {
    background: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.modal-status.error {
    background: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

.modal-status-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.modal-status-icon i {
    width: 16px;
    height: 16px;
}

.modal-status-icon .spinner {
    animation: spin 1s linear infinite;
}

.modal-status-text {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
}

.modal-status-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 12px;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    color: inherit;
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.modal-status-link:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
}

.modal-status-link i {
    width: 12px;
    height: 12px;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.text-editor-import-btn {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    padding: 6px;
    border: 1px solid #d1d5da;
    border-radius: 6px;
    background: white;
    color: #24292e;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.text-editor-import-btn:hover {
    background: #e9ecef;
    border-color: #ced4da;
    color: #495057;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(108, 117, 125, 0.2);
}

.text-editor-import-btn i {
    width: 16px;
    height: 16px;
}

.text-editor-version-dropdown {
    flex: 1;
}

.text-editor-version-dropdown label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #24292e;
    margin-bottom: 6px;
}

.text-editor-version-select {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #d1d5da;
    border-radius: 6px;
    font-size: 12px;
    background: white;
    color: #24292e;
}

.text-editor-version-select:focus {
    outline: none;
    border-color: #0366d6;
}

/* Editor Content */
.text-editor-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: white;
}

.text-editor-quill-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.text-editor-quill-container .ql-toolbar {
    border: none;
    border-bottom: 1px solid #e1e4e8;
    background: #f6f8fa;
    padding: 12px 16px;
    flex-shrink: 0;
}

.text-editor-quill-container .ql-container {
    border: none;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.text-editor-quill-container .ql-editor {
    flex: 1;
    padding: 20px;
    font-size: 14px;
    line-height: 1.6;
    color: #24292e;
    overflow-y: auto;
    border: none;
    outline: none;
}

.text-editor-quill-container .ql-editor.ql-blank::before {
    color: #6a737d;
    font-style: normal;
    left: 20px;
}

.text-editor-quill-container:focus-within {
    border-color: #0366d6;
}

/* Footer */
.text-editor-footer {
    padding: 16px 20px;
    border-top: 1px solid #e1e4e8;
    background: #FAF9FA;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.text-editor-footer-actions {
    display: flex;
    gap: 8px;
}

/* Save Status */
.text-editor-save-status {
    font-size: 12px;
    color: #6a737d;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.text-editor-save-status.saving {
    color: #fd7e14;
    background: rgba(253, 126, 20, 0.1);
}

.text-editor-save-status.saved {
    color: #28a745;
    background: rgba(40, 167, 69, 0.1);
}

/* Responsive Design */
@media (max-width: 768px) {
    .text-editor-offcanvas {
        width: 100%;
        right: -100%;
    }
    
    .text-editor-header {
        padding: 12px 16px;
    }
    
    .text-editor-header h2 {
        font-size: 16px;
    }
    
    .text-editor-version-section {
        padding: 10px 16px;
    }
    
    .text-editor-version-row {
        flex-direction: row;
        align-items: center;
        gap: 6px;
        flex-wrap: nowrap;
    }
    
    .text-editor-import-btn {
        flex-shrink: 0;
        width: 32px;
        height: 32px;
        padding: 6px;
    }
    
    .text-editor-version-dropdown {
        flex: 1;
        min-width: 0;
    }
    
    .text-editor-version-dropdown label {
        display: none;
    }
    
    .text-editor-version-select {
        width: 100%;
        font-size: 12px;
        padding: 6px 8px;
    }
    
    .text-editor-quill-container .ql-editor {
        padding: 16px;
    }
    
    .text-editor-footer {
        padding: 12px 16px;
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .text-editor-footer-actions {
        justify-content: center;
    }
    
    .text-editor-save-status {
        text-align: center;
    }
}

@media (max-width: 480px) {
    .text-editor-header {
        padding: 10px 12px;
    }
    
    .text-editor-version-section {
        padding: 8px 12px;
    }
    
    .text-editor-quill-container .ql-editor {
        padding: 12px;
    }
    
    .text-editor-footer {
        padding: 10px 12px;
    }
    
    .text-editor-btn-secondary,
    .text-editor-btn-primary,
    .text-editor-btn-danger {
        padding: 8px 12px;
        font-size: 13px;
    }
}

/* Animation for smooth entrance */
@keyframes slideInFromRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.text-editor-offcanvas.show {
    animation: slideInFromRight 0.3s ease-out;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .text-editor-offcanvas {
        background: #2d3748;
        border-left-color: #4a5568;
    }
    
    .text-editor-header {
        background: #2d3748;
        border-bottom-color: #4a5568;
        color: #e2e8f0;
    }
    
    .text-editor-header h2 {
        color: #e2e8f0;
    }
    
    .text-editor-version-section {
        background: #1a202c;
        border-bottom-color: #4a5568;
    }
    
    .text-editor-version-section label {
        color: #e2e8f0;
    }
    
    .text-editor-version-select {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .text-editor-import-btn {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .text-editor-import-btn:hover {
        background: #4a5568;
        border-color: #718096;
        color: #e2e8f0;
        transform: translateY(-1px);
        box-shadow: 0 2px 4px rgba(113, 128, 150, 0.2);
    }
    
    .text-editor-content {
        background: #2d3748;
    }
    
    .text-editor-quill-container .ql-toolbar {
        background: #1a202c;
        border-bottom-color: #4a5568;
    }
    
    .text-editor-quill-container .ql-editor {
        color: #e2e8f0;
    }
    
    .text-editor-footer {
        background: #1a202c;
        border-top-color: #4a5568;
    }
    
    .text-editor-btn-secondary {
        background: #4a5568;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .text-editor-btn-secondary:hover {
        background: #718096;
        border-color: #718096;
    }
}

/* ===================================
   INSERT MODAL STYLES
   =================================== */

/* Insert Modal Container */
.insert-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    visibility: visible;
    transition: all 0.3s ease-in-out;
}

.insert-modal.hidden {
    opacity: 0;
    visibility: hidden;
}

/* Modal Content */
.insert-modal-content {
    background: white;
    border-radius: 8px;
    width: 600px;
    max-width: 90vw;
    height: 500px;
    max-height: 90vh;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Modal Header */
.insert-modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e1e4e8;
    background: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.insert-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #24292e;
    display: flex;
    align-items: center;
    gap: 8px;
}

.insert-modal-close {
    background: none;
    border: none;
    color: #6a737d;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.insert-modal-close:hover {
    background: #f6f8fa;
    color: #24292e;
}

/* Tab Navigation */
.insert-modal-tabs {
    display: flex;
    border-bottom: 1px solid #e1e4e8;
    background: #f6f8fa;
    flex-shrink: 0;
}

.insert-tab {
    flex: 1;
    padding: 12px 16px;
    border: none;
    background: transparent;
    color: #6a737d;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-bottom: 2px solid transparent;
}

.insert-tab:hover {
    background: #f0f0f0;
    color: #24292e;
}

.insert-tab.active {
    background: white;
    color: #24292e;
    border-bottom-color: #34BA9E;
}

.insert-tab i {
    width: 16px;
    height: 16px;
}

/* Modal Body */
.insert-modal-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.insert-tab-content {
    display: none;
    flex: 1;
    flex-direction: column;
    overflow: hidden;
}

.insert-tab-content.active {
    display: flex;
}

/* Search Container */
.insert-search-container {
    padding: 16px;
    border-bottom: 1px solid #e1e4e8;
    background: #f6f8fa;
    flex-shrink: 0;
}

.insert-search-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5da;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.insert-search-input:focus {
    outline: none;
    border-color: #34BA9E;
    box-shadow: 0 0 0 3px rgba(52, 186, 158, 0.1);
}

/* List Container */
.insert-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
    background: white;
}

/* List Items - Matching snippets/links styling */
.insert-item {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.insert-item:hover {
    background: #f6f8fa;
}

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

.insert-item.selected {
    background: #e3f2fd;
    border-left: 3px solid #34BA9E;
}

.insert-item-title {
    font-weight: 500;
    font-size: 13px;
    color: #24292e;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.insert-item-preview {
    font-size: 11px;
    color: #6a737d;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

/* Empty State */
.insert-empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: #6a737d;
}

.insert-empty-state i {
    font-size: 48px;
    opacity: 0.5;
    margin-bottom: 16px;
}

.insert-empty-state h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 500;
    color: #24292e;
}

.insert-empty-state p {
    margin: 0;
    font-size: 14px;
}

/* Modal Footer */
.insert-modal-footer {
    padding: 16px 20px;
    border-top: 1px solid #e1e4e8;
    background: #f6f8fa;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-shrink: 0;
}

.insert-btn {
    padding: 8px 16px;
    border: 1px solid #d1d5da;
    border-radius: 6px;
    background: white;
    color: #24292e;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.insert-btn:hover {
    background: #f6f8fa;
    border-color: #d1d5da;
}

.insert-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.insert-btn-primary {
    background: #34BA9E;
    color: white;
    border-color: #29a489;
}

.insert-btn-primary:hover:not(:disabled) {
    background: #2da68a;
    border-color: #2da68a;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(52, 186, 158, 0.3);
}

.insert-btn-secondary {
    background: #f8f9fa;
    color: #6c757d;
    border-color: #dee2e6;
}

.insert-btn-secondary:hover {
    background: #e9ecef;
    border-color: #ced4da;
    color: #495057;
}

/* Responsive Design */
@media (max-width: 768px) {
    .insert-modal-content {
        width: 95vw;
        height: 80vh;
    }
    
    .insert-modal-header {
        padding: 12px 16px;
    }
    
    .insert-modal-header h3 {
        font-size: 16px;
    }
    
    .insert-tab {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .insert-search-container {
        padding: 12px;
    }
    
    .insert-item {
        padding: 10px 12px;
    }
    
    .insert-modal-footer {
        padding: 12px 16px;
    }
    
    .insert-btn {
        padding: 6px 12px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .insert-modal-content {
        width: 98vw;
        height: 85vh;
        border-radius: 4px;
    }
    
    .insert-tab {
        flex-direction: column;
        gap: 4px;
        padding: 8px 6px;
    }
    
    .insert-tab i {
        width: 14px;
        height: 14px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .insert-modal-content {
        background: #1a1a1a;
        border: 1px solid #333;
    }
    
    .insert-modal-header {
        background: #1a1a1a;
        border-bottom-color: #333;
    }
    
    .insert-modal-header h3 {
        color: #e6e6e6;
    }
    
    .insert-modal-close {
        color: #999;
    }
    
    .insert-modal-close:hover {
        background: #333;
        color: #e6e6e6;
    }
    
    .insert-modal-tabs {
        background: #2a2a2a;
        border-bottom-color: #333;
    }
    
    .insert-tab {
        color: #999;
    }
    
    .insert-tab:hover {
        background: #333;
        color: #e6e6e6;
    }
    
    .insert-tab.active {
        background: #1a1a1a;
        color: #e6e6e6;
    }
    
    .insert-search-container {
        background: #2a2a2a;
        border-bottom-color: #333;
    }
    
    .insert-search-input {
        background: #1a1a1a;
        border-color: #333;
        color: #e6e6e6;
    }
    
    .insert-search-input:focus {
        border-color: #34BA9E;
    }
    
    .insert-list {
        background: #1a1a1a;
    }
    
    .insert-item {
        border-bottom-color: #333;
    }
    
    .insert-item:hover {
        background: #2a2a2a;
    }
    
    .insert-item-title {
        color: #e6e6e6;
    }
    
    .insert-item-preview {
        color: #999;
    }
    
    .insert-modal-footer {
        background: #2a2a2a;
        border-top-color: #333;
    }
    
    .insert-btn {
        background: #333;
        border-color: #444;
        color: #e6e6e6;
    }
    
    .insert-btn:hover {
        background: #444;
    }
    
    .insert-btn-secondary {
        background: #2a2a2a;
        color: #999;
    }
    
    .insert-btn-secondary:hover {
        background: #333;
        color: #e6e6e6;
    }
} 