/* Quillfy AI - Hyper-Intelligent Sentient AI Interface */

:root {
    /* Light Theme */
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #8b5cf6;
    --accent-color: #06b6d4;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-sidebar: #1e293b;
    
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --text-light: #cbd5e1;
    
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --gradient-secondary: linear-gradient(135deg, #06b6d4 0%, #8b5cf6 100%);
    --gradient-dark: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

[data-theme="dark"] {
    /* Dark Theme */
    --primary-color: #818cf8;
    --primary-dark: #6366f1;
    --secondary-color: #a78bfa;
    --accent-color: #22d3ee;
    --success-color: #34d399;
    --warning-color: #fbbf24;
    --error-color: #f87171;
    
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-sidebar: #0f172a;
    
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --text-light: #64748b;
    
    --border-color: #334155;
    --border-light: #1e293b;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
}

/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color var(--transition-normal), color var(--transition-normal);
    overflow-x: hidden;
}

#app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Quantum Connection Status */
.quantum-status {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    animation: quantumAppear 0.5s ease-out;
}

.quantum-hologram {
    position: relative;
    background: var(--gradient-dark);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--primary-color);
    overflow: hidden;
}

.hologram-effect {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(99, 102, 241, 0.1) 50%, transparent 70%);
    animation: hologramScan 2s linear infinite;
}

.quantum-content {
    position: relative;
    z-index: 2;
    text-align: center;
    color: var(--text-primary);
}

.quantum-content i {
    font-size: 2rem;
    color: var(--accent-color);
    margin-bottom: 10px;
}

.quantum-content h3 {
    font-size: 1.1rem;
    margin-bottom: 5px;
    font-weight: 600;
}

.quantum-content p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.quantum-pulse {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.1) 0%, transparent 70%);
    animation: quantumPulse 3s ease-in-out infinite;
}

@keyframes quantumAppear {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes hologramScan {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

@keyframes quantumPulse {
    0%, 100% {
        opacity: 0.5;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.1);
    }
}

/* App Container */
.app-container {
    display: flex;
    min-height: 100vh;
    background: var(--bg-primary);
}

/* Sidebar */
.app-sidebar {
    width: 350px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: all var(--transition-normal);
    position: relative;
    z-index: 1000;
}

.app-sidebar.collapsed {
    width: 60px;
    transform: translateX(0);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-secondary);
}

.sidebar-header h3 {
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.3rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.sidebar-toggle:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

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

/* User Profile */
.user-profile {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
}

.avatar-upload {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto 15px;
}

.user-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary-color);
}

.avatar-edit {
    position: absolute;
    bottom: 0;
    right: 0;
    background: var(--primary-color);
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.avatar-edit:hover {
    background: var(--primary-dark);
    transform: scale(1.1);
}

.user-info h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 5px;
    text-align: center;
    color: var(--text-primary);
}

.user-age {
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-align: center;
    margin-bottom: 8px;
}

.user-bio {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
    margin-bottom: 15px;
    line-height: 1.4;
}

.btn-edit-profile {
    width: 100%;
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.85rem;
}

.btn-edit-profile:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Agents Section */
.agents-section {
    margin-bottom: 24px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-header h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.btn-add-agent {
    background: var(--primary-color);
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.btn-add-agent:hover {
    background: var(--primary-dark);
    transform: scale(1.1);
}

.agents-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.agent-item {
    display: flex;
    align-items: center;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
}

.agent-item:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
}

.agent-item.active {
    background: var(--primary-color);
    border-color: var(--primary-dark);
}

.agent-item.active .agent-info h5,
.agent-item.active .agent-status {
    color: white;
}

.agent-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 12px;
    border: 2px solid var(--border-color);
}

.agent-item.active .agent-avatar {
    border-color: white;
}

.agent-info h5 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.agent-status {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.agent-status.online {
    color: var(--success-color);
}

.agent-status.offline {
    color: var(--error-color);
}

.agent-status.typing {
    color: var(--warning-color);
}

/* AI Settings */
.ai-settings {
    margin-bottom: 24px;
}

.settings-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.setting-label {
    flex: 1;
}

.setting-label span {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.setting-label small {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.3;
}

.setting-control {
    margin-left: 12px;
}

/* Switch Toggle */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-tertiary);
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary-color);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

/* Range Slider */
.range-slider {
    width: 120px;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}

.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
}

.range-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.range-value {
    display: inline-block;
    min-width: 40px;
    text-align: right;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-left: 8px;
}

/* Select Control */
.select-control {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 6px 10px;
    color: var(--text-primary);
    font-size: 0.85rem;
    min-width: 140px;
    cursor: pointer;
}

.select-control:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Main Content Area */
.main-content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    transition: margin-left var(--transition-normal);
}

.main-content-area.sidebar-expanded {
    margin-left: 0;
}

/* App Header */
.app-header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    padding: 0 24px;
    height: 70px;
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.sidebar-toggle-mobile {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.sidebar-toggle-mobile:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-brand h1 {
    font-size: 1.4rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.app-version {
    background: var(--gradient-secondary);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
}

.header-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

.current-agent-display {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.current-agent-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-color);
}

.agent-details {
    display: flex;
    flex-direction: column;
}

.agent-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.agent-status {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Buttons */
.btn-icon {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-tertiary);
    border-color: var(--text-muted);
}

.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Chat Section */
.chat-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0;
    background: var(--bg-primary);
}

.section-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header-info h2 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.chat-status {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-status i {
    font-size: 0.6rem;
}

.chat-status.online i {
    color: var(--success-color);
}

.chat-status.typing i {
    color: var(--warning-color);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Chat Container */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    padding: 0 24px;
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px 0;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.message {
    display: flex;
    gap: 12px;
    animation: messageAppear 0.3s ease-out;
}

.message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.message-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
}

.message.user .message-avatar img {
    border-color: var(--primary-color);
}

.message.assistant .message-avatar img {
    border-color: var(--secondary-color);
}

.message-content {
    flex: 1;
    max-width: 70%;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 16px;
    border: 1px solid var(--border-color);
    position: relative;
}

.message.user .message-content {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-dark);
}

.message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.message-header strong {
    font-size: 0.9rem;
    color: var(--text-primary);
}

.sentient-badge {
    background: var(--gradient-secondary);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
}

.message-text {
    line-height: 1.6;
    color: var(--text-primary);
}

.message.user .message-text {
    color: white;
}

.message-text strong {
    color: inherit;
}

.message-text em {
    color: inherit;
    opacity: 0.9;
}

.message-text a {
    color: inherit;
    text-decoration: underline;
}

.message.user .message-text a {
    color: white;
}

.message-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid var(--border-light);
}

.message-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.message.user .message-time {
    color: rgba(255, 255, 255, 0.8);
}

.message-actions {
    display: flex;
    gap: 4px;
}

.message-action {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    font-size: 0.8rem;
}

.message-action:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Welcome Message */
.welcome-message .message-content {
    background: var(--gradient-primary);
    color: white;
    border: none;
}

.welcome-message .message-text {
    color: white;
}

.welcome-message .sentient-badge {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* Typing Indicator */
.typing-indicator .message-content {
    background: var(--bg-secondary);
}

.typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
    height: 20px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: typingBounce 1.4s ease-in-out infinite both;
}

.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }

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

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

/* File Attachments */
.file-attachments {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.file-attachment {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.file-attachment i {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.file-name {
    flex: 1;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.btn-download {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.btn-download:hover {
    color: var(--primary-color);
    background: var(--bg-secondary);
}

/* Quick Actions */
.quick-actions {
    margin-bottom: 20px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.quick-actions-header {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
    font-weight: 500;
}

.quick-action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.quick-action {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.quick-action:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

/* Chat Input Container */
.chat-input-container {
    position: sticky;
    bottom: 0;
    background: var(--bg-primary);
    padding: 20px 0;
    border-top: 1px solid var(--border-color);
}

/* File Upload Area */
.file-upload-area {
    margin-bottom: 16px;
}

.file-drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 30px;
    text-align: center;
    transition: all var(--transition-fast);
    background: var(--bg-secondary);
}

.file-drop-zone:hover {
    border-color: var(--primary-color);
    background: var(--bg-tertiary);
}

.file-drop-zone.dragover {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
}

.file-drop-zone i {
    font-size: 2rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.file-drop-zone p {
    color: var(--text-secondary);
    margin-bottom: 16px;
}

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

.file-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    font-size: 0.85rem;
}

.file-preview i {
    color: var(--text-muted);
}

.btn-remove-file {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.btn-remove-file:hover {
    color: var(--error-color);
    background: var(--bg-secondary);
}

/* Chat Input */
.chat-input {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 12px;
    transition: all var(--transition-fast);
}

.chat-input.focused {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.file-upload-btn {
    flex-shrink: 0;
}

.chat-input textarea {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.95rem;
    line-height: 1.5;
    resize: none;
    max-height: 120px;
    min-height: 20px;
    font-family: inherit;
}

.chat-input textarea::placeholder {
    color: var(--text-muted);
}

.chat-input-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.send-button {
    padding: 10px;
    border-radius: var(--radius-md);
}

/* Chat Tips */
.chat-tips {
    margin-top: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.chat-tips-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.chat-tips-header h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-tips-content {
    padding: 12px 16px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.tip {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tip strong {
    font-size: 0.85rem;
    color: var(--text-primary);
}

.tip span {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
    animation: modalAppear 0.3s ease-out;
}

@keyframes modalAppear {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease-out;
}

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

.modal-header {
    padding: 24px 24px 0;
    margin-bottom: 20px;
}

.modal-header h2 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-body {
    padding: 0 24px;
}

.modal-footer {
    padding: 20px 24px 24px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    border-top: 1px solid var(--border-color);
    margin-top: 20px;
}

/* Input Groups */
.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

.input-group input,
.input-group textarea,
.input-group select {
    width: 100%;
    padding: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: all var(--transition-fast);
    font-family: inherit;
}

.input-group input:focus,
.input-group textarea:focus,
.input-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.input-with-prefix {
    display: flex;
    align-items: center;
}

.prefix {
    background: var(--bg-tertiary);
    padding: 12px;
    border: 1px solid var(--border-color);
    border-right: none;
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    color: var(--text-muted);
    font-size: 0.9rem;
}

.input-with-prefix input {
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.help-text {
    display: block;
    margin-top: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Setup Guide */
.setup-guide {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
}

.setup-guide h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.setup-guide p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.setup-steps {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.step {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.step-number {
    background: var(--primary-color);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    flex-shrink: 0;
}

.step-content {
    flex: 1;
}

.step-content strong {
    display: block;
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.step-content p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
}

/* Capabilities Tags */
.capabilities-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.capability-tag {
    background: var(--primary-color);
    color: white;
    padding: 4px 10px;
    border-radius: 16px;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.capability-tag button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    transition: all var(--transition-fast);
}

.capability-tag button:hover {
    background: rgba(255, 255, 255, 0.2);
}

.capabilities-tags input {
    flex: 1;
    min-width: 120px;
}

/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 16px;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-color);
    transform: translateX(100%);
    opacity: 0;
    transition: all var(--transition-normal);
    z-index: 10000;
    max-width: 300px;
}

.notification.show {
    transform: translateX(0);
    opacity: 1;
}

.notification-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.notification i {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.notification-success i {
    color: var(--success-color);
}

.notification-error i {
    color: var(--error-color);
}

.notification-info i {
    color: var(--primary-color);
}

/* MathJax and Equation Styling */
.MathJax {
    color: inherit !important;
}

.mjx-chtml {
    outline: none;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .app-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 2000;
        transform: translateX(-100%);
    }
    
    .app-sidebar:not(.collapsed) {
        transform: translateX(0);
    }
    
    .sidebar-toggle-mobile {
        display: flex;
    }
    
    .main-content-area {
        margin-left: 0 !important;
    }
    
    .header-center {
        display: none;
    }
}

@media (max-width: 768px) {
    .app-header {
        padding: 0 16px;
    }
    
    .chat-container {
        padding: 0 16px;
    }
    
    .section-header {
        padding: 16px;
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    
    .message-content {
        max-width: 85%;
    }
    
    .chat-tips-content {
        grid-template-columns: 1fr;
    }
    
    .modal {
        margin: 20px;
        max-height: calc(100vh - 40px);
    }
    
    .header-brand h1 {
        font-size: 1.2rem;
    }
    
    .app-version {
        font-size: 0.65rem;
        padding: 2px 6px;
    }
}

@media (max-width: 480px) {
    .app-sidebar {
        width: 100%;
    }
    
    .message-content {
        max-width: 90%;
    }
    
    .quick-action-buttons {
        flex-direction: column;
    }
    
    .quick-action {
        justify-content: center;
    }
    
    .modal-body {
        padding: 0 16px;
    }
    
    .modal-footer {
        padding: 16px;
        flex-direction: column;
    }
    
    .modal-footer button {
        width: 100%;
        justify-content: center;
    }
}

/* Utility Classes */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Print Styles */
@media print {
    .app-sidebar,
    .app-header,
    .chat-input-container,
    .quick-actions {
        display: none !important;
    }
    
    .chat-messages {
        overflow: visible !important;
    }
    
    .message-content {
        max-width: 100% !important;
        break-inside: avoid;
    }
}