/**
 * Dark Mode Support for Message Components
 * Ensures thinking blocks, tables, and other message elements work in both themes
 */

/* Message Thinking Blocks - Dark Mode */
@media (prefers-color-scheme: dark) {
    .message-thinking-block {
        background: rgba(255, 255, 255, 0.02);
        border: 1px solid rgba(255, 255, 255, 0.08);
    }
    
    .message-thinking-header {
        background: rgba(123, 70, 255, 0.15);
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        color: #e5e7eb;
    }
    
    .message-thinking-label {
        color: #a78bfa;
    }
    
    .message-thinking-toggle {
        color: #a78bfa;
    }
    
    .message-thinking-content {
        background: rgba(0, 0, 0, 0.2);
        color: #e5e7eb;
    }
    
    .message-response-content {
        background: rgba(255, 255, 255, 0.02);
        color: #e5e7eb;
    }
}

/* Message Thinking Blocks - Light Mode */
[data-theme="light"] .message-thinking-block {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
}

[data-theme="light"] .message-thinking-header {
    background: rgba(123, 70, 255, 0.1);
    border-bottom: 1px solid var(--glass-border);
    color: var(--text-primary);
}

[data-theme="light"] .message-thinking-label {
    color: #7c3aed;
}

[data-theme="light"] .message-thinking-toggle {
    color: #7c3aed;
}

[data-theme="light"] .message-thinking-content {
    background: rgba(248, 250, 252, 0.8);
    color: var(--text-primary);
}

[data-theme="light"] .message-response-content {
    background: var(--glass-bg);
    color: var(--text-primary);
}

/* Waive Tables - Enhanced Dark Mode */
@media (prefers-color-scheme: dark) {
    .waive-table-container {
        background: rgba(255, 255, 255, 0.02);
        border: 1px solid rgba(255, 255, 255, 0.08);
    }
    
    .waive-table {
        background: transparent;
        color: #e5e7eb;
    }
    
    .waive-table thead {
        background: rgba(255, 255, 255, 0.06);
    }
    
    .waive-table th {
        color: #f3f4f6;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .waive-table td {
        color: #e5e7eb;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }
    
    .waive-table tbody tr:hover {
        background: rgba(255, 255, 255, 0.05);
    }
}

/* Waive Tables - Light Mode */
[data-theme="light"] .waive-table-container {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .waive-table {
    background: transparent;
    color: var(--text-primary);
}

[data-theme="light"] .waive-table thead {
    background: rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .waive-table th {
    color: var(--text-primary);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .waive-table td {
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .waive-table tbody tr:hover {
    background: rgba(0, 0, 0, 0.02);
}

/* Waive Headers - Enhanced Dark Mode */
@media (prefers-color-scheme: dark) {
    .waive-h1 {
        color: #f3f4f6;
        text-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
        border-bottom-color: rgba(59, 130, 246, 0.6);
    }
    
    .waive-h2 {
        color: #e5e7eb;
        text-shadow: 0 0 10px rgba(59, 130, 246, 0.2);
        border-bottom-color: rgba(59, 130, 246, 0.4);
    }
    
    .waive-h3::before {
        background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
        box-shadow: 0 0 8px rgba(59, 130, 246, 0.4);
    }
    
    .waive-h3 {
        color: #e5e7eb;
    }
    
    .waive-h4,
    .waive-h5,
    .waive-h6 {
        color: #d1d5db;
    }
}

/* Waive Headers - Light Mode */
[data-theme="light"] .waive-h1 {
    color: var(--text-primary);
    text-shadow: none;
    border-bottom-color: #3b82f6;
}

[data-theme="light"] .waive-h2 {
    color: var(--text-primary);
    text-shadow: none;
    border-bottom-color: #3b82f6;
}

[data-theme="light"] .waive-h3::before {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

[data-theme="light"] .waive-h3 {
    color: var(--text-primary);
}

[data-theme="light"] .waive-h4,
[data-theme="light"] .waive-h5,
[data-theme="light"] .waive-h6 {
    color: var(--text-secondary);
}

/* Message Bullet Lists - Enhanced Dark Mode */
@media (prefers-color-scheme: dark) {
    .waive-bullet-list {
        color: #e5e7eb;
    }
    
    .waive-bullet-item {
        color: #d1d5db;
    }
    
    .waive-bullet-item::before {
        color: #60a5fa;
    }
}

/* Message Bullet Lists - Light Mode */
[data-theme="light"] .waive-bullet-list {
    color: var(--text-primary);
}

[data-theme="light"] .waive-bullet-item {
    color: var(--text-secondary);
}

[data-theme="light"] .waive-bullet-item::before {
    color: var(--accent-color);
}

/* Message Footer and Actions - Dark Mode */
@media (prefers-color-scheme: dark) {
    .message-footer {
        border-top: 1px solid rgba(255, 255, 255, 0.08);
        background: rgba(255, 255, 255, 0.02);
    }
    
    .message-actions button {
        color: #9ca3af;
        border: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .message-actions button:hover {
        color: #60a5fa;
        background: rgba(255, 255, 255, 0.05);
        border-color: rgba(96, 165, 250, 0.3);
    }
    
    .message-timestamp {
        color: #6b7280;
    }
}

/* Message Footer and Actions - Light Mode */
[data-theme="light"] .message-footer {
    border-top: 1px solid var(--border-color);
    background: rgba(248, 250, 252, 0.5);
}

[data-theme="light"] .message-actions button {
    color: var(--text-light);
    border: 1px solid var(--border-color);
}

[data-theme="light"] .message-actions button:hover {
    color: var(--primary-color);
    background: rgba(8, 109, 148, 0.05);
    border-color: rgba(8, 109, 148, 0.2);
}

[data-theme="light"] .message-timestamp {
    color: var(--text-muted);
}

/* Document Badges - Dark Mode */
@media (prefers-color-scheme: dark) {
    .message-documents {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin: 8px 0;
    }

    .document-badge {
        display: inline-flex;
        align-items: center;
        padding: 6px 12px;
        background: rgba(59, 130, 246, 0.1);
        border: 1px solid rgba(59, 130, 246, 0.3);
        border-radius: 6px;
        font-size: 0.85em;
        color: #93c5fd;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .document-badge:hover {
        background: rgba(59, 130, 246, 0.15);
        border-color: rgba(59, 130, 246, 0.5);
    }
}

/* Document Badges - Light Mode */
[data-theme="light"] .message-documents {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 0;
}

[data-theme="light"] .document-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 6px;
    font-size: 0.85em;
    color: #1d4ed8;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

[data-theme="light"] .document-badge:hover {
    background: rgba(59, 130, 246, 0.12);
    border-color: rgba(59, 130, 246, 0.3);
}