/* AskVT - Document Assistant Styles */

/* Login Screen */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 3rem;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header .logo-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 0.5rem;
    filter: drop-shadow(0 0 15px var(--accent-glow));
}

.login-header h1 {
    font-size: 2rem;
    margin-bottom: 0.25rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.form-group input {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.875rem 1rem;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

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

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

.login-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: var(--error);
    font-size: 0.9rem;
    text-align: center;
}

.login-btn {
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 1rem 1.5rem;
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: background 0.2s, transform 0.1s;
    margin-top: 0.5rem;
}

.login-btn:hover {
    background: var(--accent-secondary);
}

.login-btn:active {
    transform: scale(0.98);
}

.login-btn:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
}

.login-footer {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.login-footer::before {
    content: '🔒 ';
}

/* Chat Screen */
.chat-screen {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header with logout */
.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.logout-btn {
    position: absolute;
    right: 0;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.logout-btn:hover {
    border-color: var(--error);
    color: var(--error);
    background: rgba(239, 68, 68, 0.1);
}

:root {
    --bg-primary: #0a0f1a;
    --bg-secondary: #111827;
    --bg-tertiary: #1f2937;
    --accent-primary: #3b82f6;
    --accent-secondary: #60a5fa;
    --accent-glow: rgba(59, 130, 246, 0.3);
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --border-color: #374151;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    
    --font-sans: 'Outfit', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 30px var(--accent-glow);
}

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

html {
    font-size: 16px;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    background-image: 
        radial-gradient(ellipse at top, rgba(59, 130, 246, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at bottom right, rgba(147, 51, 234, 0.05) 0%, transparent 50%);
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    text-align: center;
    padding: 2rem 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.logo-icon {
    font-size: 2.5rem;
    filter: drop-shadow(0 0 10px var(--accent-glow));
}

h1 {
    font-size: 2.5rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--text-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 300;
    letter-spacing: 0.05em;
}

/* Main Content */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Chat Container */
.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
    margin-bottom: 1rem;
    min-height: 400px;
    max-height: calc(100vh - 350px);
}

.welcome-message {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-secondary);
}

.welcome-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    filter: grayscale(0.3);
}

.welcome-message h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.welcome-message .hint {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 1rem;
    font-style: italic;
}

/* Chat Messages */
.message {
    display: flex;
    gap: 1rem;
    padding: 1.25rem;
    margin-bottom: 1rem;
    border-radius: 12px;
    animation: fadeIn 0.3s ease-out;
}

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

.message-user {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
}

.message-assistant {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(147, 51, 234, 0.05));
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.message-avatar {
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: 10px;
    flex-shrink: 0;
}

.message-content {
    flex: 1;
    min-width: 0;
}

.message-content p {
    white-space: pre-wrap;
    word-wrap: break-word;
}

.message-loading {
    display: flex;
    gap: 0.3rem;
    padding: 0.5rem 0;
}

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

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

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

/* Streaming cursor animation */
.streaming-cursor {
    display: inline-block;
    animation: blink 0.7s infinite;
    color: var(--accent-primary);
    font-weight: bold;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.message-text {
    white-space: pre-wrap;
}

/* Progressive Status Indicators */
.status-phase {
    margin-bottom: 0.75rem;
}

.status-indicator-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    animation: fadeIn 0.3s ease-out;
}

.status-indicator-inline.searching {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(59, 130, 246, 0.05));
    border-color: rgba(59, 130, 246, 0.3);
    color: var(--accent-secondary);
}

.status-indicator-inline.found {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(16, 185, 129, 0.05));
    border-color: rgba(16, 185, 129, 0.3);
    color: var(--success);
}

.status-indicator-inline.generating {
    background: linear-gradient(135deg, rgba(147, 51, 234, 0.15), rgba(147, 51, 234, 0.05));
    border-color: rgba(147, 51, 234, 0.3);
    color: #a78bfa;
}

.status-icon {
    font-size: 1rem;
}

.status-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.status-text {
    font-weight: 500;
}

/* Sources Display */
.sources-container {
    margin: 0.75rem 0;
    border-radius: 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    overflow: hidden;
    font-size: 0.85rem;
}

.sources-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: rgba(59, 130, 246, 0.1);
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    user-select: none;
    color: var(--text-secondary);
    font-weight: 500;
    transition: background 0.2s;
}

.sources-header:hover {
    background: rgba(59, 130, 246, 0.15);
}

.sources-toggle {
    font-size: 0.7rem;
    transition: transform 0.2s;
    color: var(--text-muted);
}

.sources-container.expanded .sources-toggle {
    transform: rotate(90deg);
}

.sources-list {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.sources-container.expanded .sources-list {
    max-height: 500px;
}

.source-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
}

.source-item:last-child {
    border-bottom: none;
}

.source-item:hover {
    background: rgba(255, 255, 255, 0.02);
}

.source-index {
    width: 20px;
    height: 20px;
    background: var(--accent-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    flex-shrink: 0;
}

.source-content {
    flex: 1;
    min-width: 0;
}

.source-name {
    color: var(--accent-secondary);
    font-weight: 500;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.source-preview {
    color: var(--text-muted);
    font-size: 0.8rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Response text container */
.response-text {
    margin-top: 0.5rem;
}

/* Memory hint in welcome message */
.memory-hint {
    color: var(--accent-primary);
    font-size: 0.85em;
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    background: rgba(76, 175, 80, 0.1);
    border-radius: 8px;
    display: inline-block;
}

/* Input Area */
.input-area {
    padding: 1rem 0;
    border-top: 1px solid var(--border-color);
}

.input-wrapper {
    display: flex;
    gap: 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 0.75rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-wrapper:focus-within {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
}

textarea {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 1rem;
    resize: none;
    outline: none;
    padding: 0.5rem;
    max-height: 150px;
    line-height: 1.5;
}

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

button[type="submit"] {
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 0.75rem 1.5rem;
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.2s, transform 0.1s;
}

button[type="submit"]:hover {
    background: var(--accent-secondary);
}

button[type="submit"]:active {
    transform: scale(0.98);
}

button[type="submit"]:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
}

.btn-icon {
    font-size: 1.2rem;
    transition: transform 0.2s;
}

button[type="submit"]:hover .btn-icon {
    transform: translateX(3px);
}

/* Footer */
footer {
    text-align: center;
    padding: 1.5rem 0;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.status-indicator::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--warning);
    animation: pulse 2s infinite;
}

.status-indicator.connected::before {
    background: var(--success);
    animation: none;
}

.status-indicator.error::before {
    background: var(--error);
    animation: none;
}

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

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

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

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

/* Responsive */
@media (max-width: 640px) {
    .container {
        padding: 1rem;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .welcome-message {
        padding: 2rem 1rem;
    }
    
    .message {
        padding: 1rem;
    }
    
    button[type="submit"] {
        padding: 0.75rem 1rem;
    }
    
    .btn-text {
        display: none;
    }
}

