/* Rich Text Editor Styling */
.rich-text-editor {
    margin: 16px 0;
}

.rich-text-editor .tox-tinymce {
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.rich-text-editor .tox-toolbar__primary {
    background-color: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    padding: 8px;
}

.rich-text-editor .tox-edit-area {
    padding: 0;
}

.rich-text-editor .tox-edit-area iframe {
    border: none;
}

/* Mobile responsive toolbar */
@media (max-width: 768px) {
    .rich-text-editor .tox-toolbar__primary {
        flex-wrap: wrap;
        padding: 4px;
    }
    
    .rich-text-editor .tox-toolbar__group {
        margin: 2px;
    }
    
    .rich-text-editor .tox-tbtn {
        margin: 1px;
        padding: 4px;
    }
    
    .rich-text-editor .tox-tbtn svg {
        width: 16px;
        height: 16px;
    }
}

/* File preview styling */
.file-preview-card {
    max-height: 220px;
    position: relative;
    overflow: hidden;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.file-preview-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.preview-image, .preview-video {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 4px;
    border: none;
}

.preview-video {
    background-color: #000;
}

.file-icon {
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 4px;
    position: relative;
}

.file-icon::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(25, 118, 210, 0.1);
    border-radius: 4px;
}

/* File type specific colors */
.file-icon.pdf {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
}

.file-icon.doc {
    background: linear-gradient(135deg, #4dabf7 0%, #339af0 100%);
}

.file-icon.excel {
    background: linear-gradient(135deg, #51cf66 0%, #40c057 100%);
}

.file-icon.video {
    background: linear-gradient(135deg, #845ef7 0%, #7c3aed 100%);
}

/* Drag and drop area */
.drag-drop-area {
    border: 2px dashed #e0e0e0;
    border-radius: 8px;
    padding: 32px;
    text-align: center;
    transition: all 0.3s ease;
    background: #fafafa;
}

.drag-drop-area.drag-over {
    border-color: #1976d2;
    background-color: #e3f2fd;
    transform: scale(1.02);
}

.drag-drop-area .upload-icon {
    font-size: 48px;
    color: #1976d2;
    margin-bottom: 16px;
}

/* Mobile file preview */
@media (max-width: 768px) {
    .file-preview-card {
        max-height: 180px;
    }
    
    .preview-image, .preview-video {
        height: 100px;
    }
    
    .file-icon {
        height: 100px;
    }
    
    .drag-drop-area {
        padding: 16px;
    }
    
    .drag-drop-area .upload-icon {
        font-size: 36px;
    }
}

/* Loading states */
.upload-loading {
    opacity: 0.6;
    pointer-events: none;
}

.upload-progress {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: #1976d2;
    border-radius: 2px;
    animation: progress-animation 1s ease-in-out infinite;
}

@keyframes progress-animation {
    0% { width: 0%; }
    50% { width: 100%; }
    100% { width: 0%; }
}

/* Rich text display enhancements */
.rich-text-display {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

.rich-text-display blockquote {
    position: relative;
    padding-left: 20px;
}

.rich-text-display blockquote::before {
    content: '"';
    position: absolute;
    left: 0;
    top: -5px;
    font-size: 24px;
    color: #1976d2;
    font-weight: bold;
}

.rich-text-display table {
    border-radius: 8px;
    overflow: hidden;
}

.rich-text-display td, .rich-text-display th {
    border: none;
    border-bottom: 1px solid #e0e0e0;
    border-right: 1px solid #e0e0e0;
}

.rich-text-display td:last-child, .rich-text-display th:last-child {
    border-right: none;
}

.rich-text-display tr:last-child td {
    border-bottom: none;
}

/* Responsive tables */
@media (max-width: 768px) {
    .rich-text-display table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    
    .rich-text-display thead {
        display: table-header-group;
    }
    
    .rich-text-display tbody {
        display: table-row-group;
    }
    
    .rich-text-display tr {
        display: table-row;
    }
    
    .rich-text-display td, .rich-text-display th {
        display: table-cell;
        min-width: 120px;
    }
}

/* Print styles */
@media print {
    .rich-text-display {
        color: #000;
        background: #fff;
    }
    
    .rich-text-display a {
        color: #000;
        text-decoration: underline;
    }
    
    .rich-text-display img, .rich-text-display video {
        max-width: 100%;
        page-break-inside: avoid;
    }
}