/* AskDoc AI - Premium Dark Theme */
:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a2e;
    --bg-card: #16162a;
    --text-primary: #e8e8f0;
    --text-secondary: #9090a8;
    --text-muted: #606078;
    --accent: #6c5ce7;
    --accent-glow: rgba(108, 92, 231, 0.3);
    --accent-light: #a29bfe;
    --success: #00d2a0;
    --success-glow: rgba(0, 210, 160, 0.2);
    --border: #2a2a3e;
    --user-msg: #1e1e3a;
    --bot-msg: #141428;
    --radius: 12px;
    --font: 'Inter', -apple-system, sans-serif;
}

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

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
}

.logo-icon {
    font-size: 28px;
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.logo h1 span {
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Upload Area */
.upload-section { margin-bottom: 24px; }

.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 28px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--bg-tertiary);
}

.upload-area:hover {
    border-color: var(--accent);
    background: rgba(108, 92, 231, 0.05);
    box-shadow: 0 0 20px var(--accent-glow);
}

.upload-area.dragover {
    border-color: var(--accent);
    background: rgba(108, 92, 231, 0.1);
    transform: scale(1.02);
}

.upload-area.uploading {
    border-color: var(--accent-light);
    opacity: 0.7;
    pointer-events: none;
}

.upload-icon { font-size: 32px; margin-bottom: 8px; }

.upload-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.upload-hint {
    font-size: 12px;
    color: var(--text-muted);
}

/* Document Info */
.doc-info {
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    padding: 16px;
    border: 1px solid var(--border);
    animation: fadeIn 0.3s ease;
}

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

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--success-glow);
    animation: pulse 2s infinite;
}

.doc-status span {
    font-size: 13px;
    font-weight: 600;
    color: var(--success);
}

.doc-name {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
    word-break: break-all;
    margin-bottom: 4px;
}

.doc-chunks {
    font-size: 12px;
    color: var(--text-muted);
}

.sidebar-footer {
    margin-top: auto;
    text-align: center;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.sidebar-footer p {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.tech-stack {
    font-size: 11px !important;
    color: var(--text-muted) !important;
    opacity: 0.6;
}

/* Main Chat Area */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
}

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

.chat-header h2 {
    font-size: 16px;
    font-weight: 600;
}

.header-badge {
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 20px;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.header-badge.active {
    background: var(--success-glow);
    color: var(--success);
    border-color: var(--success);
}

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

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

/* Welcome Message */
.welcome-message {
    text-align: center;
    padding: 48px 24px;
    max-width: 480px;
    margin: auto;
}

.welcome-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.welcome-message h3 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 12px;
    background: linear-gradient(135deg, var(--text-primary), var(--accent-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.welcome-message p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 24px;
}

.features {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.feature {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: var(--bg-card);
    border-radius: 8px;
    border: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-secondary);
}

.feature-icon { font-size: 18px; }

/* Message Bubbles */
.message {
    display: flex;
    gap: 12px;
    max-width: 75%;
    animation: slideUp 0.3s ease;
}

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

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.message.bot .message-avatar {
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
}

.message.user .message-avatar {
    background: var(--bg-tertiary);
}

.message-content {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    line-height: 1.6;
}

.message.bot .message-content {
    background: var(--bot-msg);
    border: 1px solid var(--border);
    border-top-left-radius: 4px;
}

.message.user .message-content {
    background: var(--accent);
    color: white;
    border-top-right-radius: 4px;
}

.message-content p { margin-bottom: 8px; }
.message-content p:last-child { margin-bottom: 0; }

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

.message-content li { margin-bottom: 4px; }

.message-content strong { color: var(--accent-light); }

.message-content code {
    background: rgba(108, 92, 231, 0.15);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
}

.message-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) { animation-delay: 0s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

/* Chat Input */
.chat-input-area {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
}

.chat-form {
    display: flex;
    gap: 12px;
    align-items: center;
}

.chat-form input {
    flex: 1;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
}

.chat-form input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.chat-form input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

.chat-form button {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    border: none;
    border-radius: var(--radius);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    flex-shrink: 0;
}

.chat-form button:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 0 20px var(--accent-glow);
}

.chat-form button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

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

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

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .message { max-width: 90%; }
}
