/**
 * Modern AI Chat CSS Styles
 * Matching AIFreeTools site design
 * 
 * @package AIFreeTools
 * @since 1.0.0
 */

/* Modern Chat Container */
.aifreetools-ai-chat-container {
    background: #ffffff;
    border: none;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    box-shadow: 0 8px 32px rgba(26, 115, 232, 0.12);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    max-width: 100%;
}

/* Modern Header with Gradient */
.ai-chat-header {
    background: linear-gradient(135deg, #1a73e8 0%, #1557b0 100%);
    border: none;
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.ai-chat-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.2) 50%, transparent 100%);
}

.ai-chat-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #ffffff;
    letter-spacing: -0.3px;
}

/* Modern Controls */
.ai-chat-controls {
    display: flex;
    gap: 12px;
    align-items: center;
}

.ai-chat-mode-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-chat-mode-selector label {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

.ai-chat-mode-select {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #ffffff;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    backdrop-filter: blur(10px);
}

.ai-chat-mode-select:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
}

.ai-chat-mode-select option {
    background: #1557b0;
    color: #ffffff;
}

/* Modern Action Buttons */
.ai-chat-reset-btn,
.ai-chat-show-documents-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #ffffff;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-chat-reset-btn:hover,
.ai-chat-show-documents-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.ai-chat-reset-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Main Chat Area */
.ai-chat-main {
    display: flex;
    flex: 1;
    min-height: 400px;
    background: #f8f9fb;
}

.ai-chat-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #ffffff;
}

/* Messages Container */
.ai-chat-messages {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    background: linear-gradient(180deg, #fafbfc 0%, #ffffff 100%);
    min-height: 300px;
    max-height: 500px;
}

/* Welcome Message */
.ai-chat-welcome {
    text-align: center;
    padding: 40px 20px;
    color: #5f6368;
    background: linear-gradient(135deg, #f8f9fb 0%, #ffffff 100%);
    border-radius: 12px;
    border: 1px solid #e8ecf1;
}

.ai-chat-welcome p {
    margin: 8px 0;
    font-size: 15px;
    line-height: 1.5;
}

.ai-chat-welcome p:first-child {
    font-weight: 600;
    color: #3c4043;
    font-size: 16px;
}

/* Modern Message Bubbles */
.ai-chat-message {
    display: flex;
    margin: 16px 0;
    animation: messageSlideIn 0.3s ease-out;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-chat-message.user-message {
    justify-content: flex-end;
}

.ai-chat-message.assistant-message {
    justify-content: flex-start;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 12px;
    font-size: 18px;
    flex-shrink: 0;
}

.user-message .message-avatar {
    background: linear-gradient(135deg, #1a73e8 0%, #1557b0 100%);
    color: #ffffff;
    order: 2;
}

.assistant-message .message-avatar {
    background: linear-gradient(135deg, #34a853 0%, #0f9d58 100%);
    color: #ffffff;
}

.message-content {
    max-width: 70%;
    background: #ffffff;
    border-radius: 18px;
    padding: 16px 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #e8ecf1;
    position: relative;
}

.user-message .message-content {
    background: linear-gradient(135deg, #1a73e8 0%, #1557b0 100%);
    color: #ffffff;
    border-color: #1557b0;
}

.assistant-message .message-content {
    background: #ffffff;
    color: #3c4043;
}

/* Message Bubbles Tails */
.user-message .message-content::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 20px;
    width: 0;
    height: 0;
    border-left: 8px solid #1557b0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
}

.assistant-message .message-content::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 20px;
    width: 0;
    height: 0;
    border-right: 8px solid #e8ecf1;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
}

.assistant-message .message-content::after {
    content: '';
    position: absolute;
    left: -5px;
    top: 20px;
    width: 0;
    height: 0;
    border-right: 8px solid #ffffff;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
}

/* Message Text */
.message-text {
    line-height: 1.5;
    font-size: 15px;
}

.user-message .message-text {
    color: #ffffff;
}

.assistant-message .message-text {
    color: #3c4043;
}

/* Message formatting */
.message-text p {
    margin: 0 0 12px 0;
}

.message-text p:last-child {
    margin-bottom: 0;
}

.message-text ul, .message-text ol {
    margin: 8px 0;
    padding-left: 20px;
}

.message-text table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 14px;
}

.message-text th, .message-text td {
    border: 1px solid #e8ecf1;
    padding: 8px 12px;
    text-align: left;
}

.message-text th {
    background: #f8f9fb;
    font-weight: 600;
}

/* Citations */
.message-citations {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.user-message .message-citations {
    border-top-color: rgba(255, 255, 255, 0.2);
}

.assistant-message .message-citations {
    border-top-color: #e8ecf1;
}

.message-citations h5 {
    margin: 0 0 8px 0;
    font-size: 13px;
    font-weight: 600;
    color: inherit;
}

.message-citations ul {
    margin: 0;
    padding-left: 16px;
    font-size: 13px;
    line-height: 1.4;
}

/* Message Time */
.message-time {
    font-size: 11px;
    margin-top: 8px;
    opacity: 0.7;
    text-align: right;
}

/* Modern Typing Indicator */
.ai-chat-typing {
    justify-content: flex-start;
}

.typing-dots {
    background: #ffffff;
    border-radius: 18px;
    padding: 16px 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #e8ecf1;
    display: flex;
    gap: 4px;
    align-items: center;
}

.typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #9aa0a6;
    animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }
.typing-dot:nth-child(3) { animation-delay: 0s; }

@keyframes typingBounce {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Modern Input Area */
.ai-chat-input-area {
    background: #ffffff;
    padding: 20px 24px;
    border-top: 1px solid #e8ecf1;
}


/* CAPTCHA */
.ai-chat-captcha {
    margin-bottom: 16px;
    display: flex;
    justify-content: center;
}


.ai-chat-input-wrapper:focus-within {
    border-color: #1a73e8;
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.1);
}

.ai-chat-input {
    flex: 1;
    border: none;
    background: transparent;
    resize: none;
    outline: none;
    font-size: 15px;
    line-height: 1.4;
    padding: 12px 0;
    color: #3c4043;
    font-family: inherit;
    min-height: 20px;
    max-height: 120px;
}

.ai-chat-input::placeholder {
    color: #9aa0a6;
}

.ai-chat-send-btn {
    background: linear-gradient(135deg, #1a73e8 0%, #1557b0 100%);
    border: none;
    border-radius: 20px;
    color: #ffffff;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 80px;
    justify-content: center;
}

.ai-chat-send-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(26, 115, 232, 0.3);
}

.ai-chat-send-btn:disabled {
    background: #dadce0;
    color: #9aa0a6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}


/* Loading Spinner */
.ai-chat-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    backdrop-filter: blur(4px);
    z-index: 100;
}

.ai-chat-loading .spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e8ecf1;
    border-top: 3px solid #1a73e8;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.ai-chat-loading span {
    color: #5f6368;
    font-size: 14px;
    font-weight: 500;
}

/* Error Messages */
.ai-chat-error {
    background: linear-gradient(135deg, #fce8e6 0%, #fdf2f2 100%);
    border: 1px solid #fbb8b5;
    border-radius: 12px;
    color: #d93025;
    padding: 12px 16px;
    margin: 12px 0;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Privacy Notice */
.ai-chat-privacy-notice {
    background: linear-gradient(135deg, #fff3cd 0%, #fefdf8 100%);
    border: 1px solid #ffeaa7;
    border-radius: 12px;
    padding: 16px;
    margin-top: 20px;
    font-size: 13px;
    color: #856404;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    line-height: 1.4;
}

.ai-chat-privacy-notice .icon {
    color: #856404;
    margin-top: 1px;
    flex-shrink: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .ai-chat-main {
        flex-direction: column;
    }
    
    
    .ai-chat-header {
        padding: 16px 20px;
    }
    
    .ai-chat-header h3 {
        font-size: 18px;
    }
    
    .ai-chat-controls {
        gap: 8px;
    }
    
    .ai-chat-mode-selector {
        display: none;
    }
    
    .message-content {
        max-width: 85%;
    }
    
    .ai-chat-messages {
        padding: 16px;
    }
    
    .ai-chat-input-area {
        padding: 16px 20px;
    }
}

@media (max-width: 480px) {
    .ai-chat-input-wrapper {
        padding: 4px 4px 4px 16px;
    }
    
    .ai-chat-send-btn {
        padding: 10px 16px;
        min-width: 70px;
    }
    
    .message-content {
        max-width: 90%;
        padding: 12px 16px;
    }
    
    .ai-chat-file-upload {
        flex-direction: column;
        align-items: stretch;
    }
}

/* Uploaded Files Display */
.ai-chat-uploaded-files {
    padding: 12px 20px 0;
    background: #f8f9fb;
}

.uploaded-files-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.uploaded-file-chip {
    display: inline-flex;
    align-items: center;
    background: #ffffff;
    border: 1px solid #e8ecf1;
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 13px;
    color: #3c4043;
    max-width: 200px;
    transition: all 0.2s ease;
}

.uploaded-file-chip:hover {
    background: #f8f9fb;
    border-color: #1a73e8;
}

.uploaded-file-chip.active {
    background: #e3f2fd;
    border-color: #1a73e8;
    color: #1a73e8;
}

.file-chip-icon {
    margin-right: 6px;
    font-size: 16px;
    color: #5f6368;
}

.file-chip-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 8px;
}

.file-chip-remove {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    margin-left: 4px;
    color: #9aa0a6;
    font-size: 16px;
    line-height: 1;
    transition: color 0.2s;
}

.file-chip-remove:hover {
    color: #dc3545;
}

/* Attachment Button */
.ai-chat-attachment-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: #5f6368;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-chat-attachment-btn:hover {
    color: #1a73e8;
    background: rgba(26, 115, 232, 0.08);
    border-radius: 50%;
}

.ai-chat-attachment-btn .icon,
.ai-chat-reset-btn .icon,
.ai-chat-show-documents-btn .icon,
.ai-chat-send-btn .icon,
.preview-toggle .icon,
.message-avatar .icon {
    font-size: 20px;
    line-height: 1;
    display: inline-block;
}

/* Fix: Ensure upload button is visible for all users */
body:not(.logged-in) .ai-chat-attachment-btn,
body.logged-out .ai-chat-attachment-btn {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Document Preview Sidebar */
.ai-chat-sidebar {
    width: 350px;
    background: #f8f9fa;
    border-left: 1px solid #e9ecef;
    display: flex;
    flex-direction: column;
    transition: margin-right 0.3s ease;
}

.ai-chat-sidebar.collapsed {
    margin-right: -350px;
}

.ai-chat-document-preview {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.preview-header {
    padding: 20px;
    background: #fff;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.preview-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
}

.preview-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: #6c757d;
    transition: color 0.2s;
}

.preview-toggle:hover {
    color: #2c3e50;
}

.preview-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.preview-document-list {
    padding: 20px;
    border-top: 1px solid #e9ecef;
}

.preview-document-list h5 {
    margin: 0 0 15px 0;
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
}

.document-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.document-list-item {
    display: flex;
    align-items: center;
    padding: 10px;
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.document-list-item:hover {
    background: #f8f9fa;
    border-color: #1a73e8;
}

.document-list-item.active {
    background: #e3f2fd;
    border-color: #1a73e8;
}

.document-icon {
    color: #1a73e8;
    margin-right: 10px;
    font-size: 20px;
}

.document-name {
    flex: 1;
    font-size: 14px;
    color: #2c3e50;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.document-size {
    font-size: 12px;
    color: #6c757d;
    margin-left: 5px;
}

.remove-document {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: #dc3545;
    opacity: 0;
    transition: opacity 0.2s;
}

.document-list-item:hover .remove-document {
    opacity: 1;
}

.remove-document:hover {
    color: #bd2130;
}

/* Upload Status */
.ai-chat-upload-status {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 1000;
    min-width: 320px;
    text-align: center;
}

.upload-progress {
    height: 4px;
    background: #e9ecef;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 16px;
    margin-bottom: 12px;
}

.progress-bar {
    height: 100%;
    background: #1a73e8;
    transition: width 0.3s ease;
    border-radius: 2px;
}

.upload-message {
    font-size: 14px;
    color: #3c4043;
    margin-bottom: 8px;
}

.upload-status-icon {
    font-size: 48px;
    color: #1a73e8;
    margin-bottom: 16px;
    animation: rotate 1s linear infinite;
}

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

/* Preview Loading States */
.preview-loading {
    text-align: center;
    padding: 40px;
    color: #5f6368;
}

.preview-loading .icon {
    font-size: 24px;
    margin-bottom: 12px;
    display: block;
}

.icon.spin {
    animation: rotate 1s linear infinite;
}

.preview-error {
    text-align: center;
    padding: 40px;
    color: #dc3545;
}

/* Auto-resize textarea */
.ai-chat-input {
    overflow-y: hidden;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .ai-chat-sidebar {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: 400px;
        z-index: 1000;
        box-shadow: -4px 0 12px rgba(0, 0, 0, 0.1);
    }
    
    .ai-chat-sidebar.collapsed {
        margin-right: -100%;
    }
    
    .uploaded-file-chip {
        font-size: 12px;
        padding: 4px 10px;
    }
}

/* Notifications */
.ai-chat-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 12px 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 10000;
    display: flex;
    align-items: flex-start;
    font-size: 14px;
    animation: slideInRight 0.3s ease;
    max-width: 400px;
    line-height: 1.4;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.ai-chat-notification.success {
    border-color: #28a745;
    color: #155724;
}

.ai-chat-notification.success .icon {
    color: #28a745;
    margin-right: 8px;
}

.ai-chat-notification.error {
    border-color: #dc3545;
    color: #721c24;
}

.ai-chat-notification.error .icon {
    color: #dc3545;
    margin-right: 8px;
    margin-top: 2px;
    flex-shrink: 0;
}

.ai-chat-notification .error-content {
    flex: 1;
}

.ai-chat-notification .error-content br {
    margin-bottom: 0.5em;
}

/* Update main layout for sidebar */
.ai-chat-main {
    flex: 1;
    display: flex;
    overflow: hidden;
    min-height: 0;
}

.ai-chat-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Adjust input wrapper */
.ai-chat-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8f9fb;
    border-radius: 24px;
    padding: 4px 4px 4px 12px;
    border: 2px solid #e8ecf1;
    transition: all 0.2s ease;
}

.ai-chat-input {
    background: transparent;
    border: none;
    outline: none;
    resize: vertical;
    min-height: 40px;
    max-height: 120px;
    line-height: 1.5;
    padding: 8px 0;
}

/* Document Sidebar Styles */
.ai-chat-sidebar {
    width: 400px;
    min-width: 300px;
    max-width: 50%;
    background: #f8f9fb;
    border-left: 1px solid #e8ecf1;
    display: flex;
    position: relative;
    transition: width 0.3s ease;
}

/* Sidebar Resizer */
.sidebar-resizer {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 5px;
    background: transparent;
    cursor: col-resize;
    z-index: 10;
}

.sidebar-resizer:hover {
    background: rgba(26, 115, 232, 0.2);
}

.sidebar-resizer.resizing {
    background: rgba(26, 115, 232, 0.3);
}

/* Document Preview Container */
.ai-chat-document-preview {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.preview-header {
    padding: 16px 20px;
    background: #fff;
    border-bottom: 1px solid #e8ecf1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.preview-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
}

.preview-toggle {
    background: transparent;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.preview-toggle:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #374151;
}

/* Document Tabs */
.document-tabs-container {
    background: #fff;
    border-bottom: 1px solid #e8ecf1;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.1) transparent;
}

.document-tabs-container::-webkit-scrollbar {
    height: 4px;
}

.document-tabs-container::-webkit-scrollbar-track {
    background: transparent;
}

.document-tabs-container::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 2px;
}

.document-tabs {
    display: inline-flex;
    padding: 0 12px;
    min-width: 100%;
}

.document-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: #6b7280;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    position: relative;
}

.document-tab:hover {
    color: #374151;
    background: rgba(0, 0, 0, 0.02);
}

.document-tab.active {
    color: #1a73e8;
    border-bottom-color: #1a73e8;
    background: rgba(26, 115, 232, 0.04);
}

.document-tab .tab-icon {
    font-size: 18px;
    width: 18px;
    height: 18px;
    margin-right: 6px;
}

/* File type color coding */
.document-tab[data-file-type="pdf"] .tab-icon {
    color: #dc2626; /* Red */
}

.document-tab[data-file-type="docx"] .tab-icon,
.document-tab[data-file-type="doc"] .tab-icon {
    color: #2563eb; /* Blue */
}

.document-tab[data-file-type="xlsx"] .tab-icon,
.document-tab[data-file-type="xls"] .tab-icon,
.document-tab[data-file-type="csv"] .tab-icon {
    color: #16a34a; /* Green */
}

.document-tab[data-file-type="txt"] .tab-icon {
    color: #6b7280; /* Gray */
}

.document-tab .tab-close {
    margin-left: 4px;
    padding: 2px;
    border-radius: 3px;
    transition: all 0.2s ease;
    line-height: 0;
}

.document-tab .tab-close:hover {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

/* Preview Content */
.preview-content-container {
    flex: 1;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

.preview-placeholder {
    padding: 40px 20px;
    text-align: center;
    color: #9ca3af;
    font-size: 14px;
}

.preview-content {
    flex: 1;
    overflow: hidden;
    height: 100%;
}

/* Excel/CSV Table Styles */
.xlsx-preview,
.csv-preview {
    overflow: auto;
    max-height: 100%;
}

.xlsx-table,
.csv-table {
    border-collapse: collapse;
    width: 100%;
    font-size: 13px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    overflow: hidden;
}

.xlsx-table th,
.csv-table th {
    background: #f3f4f6;
    font-weight: 600;
    text-align: left;
    padding: 12px;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 1;
}

.xlsx-table td,
.csv-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #f3f4f6;
}

.xlsx-table tr:hover td,
.csv-table tr:hover td {
    background: #f9fafb;
}

/* Document Content Formatting */
.document-content {
    line-height: 1.6;
    color: #374151;
}

.document-content h1,
.document-content h2,
.document-content h3,
.document-content h4,
.document-content h5,
.document-content h6 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    font-weight: 600;
    color: #1f2937;
}

.document-content p {
    margin-bottom: 1em;
}

.document-content ul,
.document-content ol {
    margin-bottom: 1em;
    padding-left: 2em;
}

.document-content pre {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 12px;
    overflow-x: auto;
    font-family: 'SF Mono', Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
    font-size: 13px;
}

.document-content code {
    background: #f3f4f6;
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 0.9em;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .ai-chat-sidebar {
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        width: 100% !important;
        max-width: 100%;
        z-index: 100;
        box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
    }
    
    .sidebar-resizer {
        display: none;
    }
    
    .document-tabs {
        padding: 0 8px;
    }
    
    .document-tab {
        padding: 10px 12px;
        font-size: 12px;
    }
}