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

:root {
    --primary: #2563eb;
    --primary-light: #eff6ff;
    --bg: #f8fafc;
    --surface: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --agent-bg: #f0fdf4;
    --agent-border: #bbf7d0;
    --user-bg: #eff6ff;
    --user-border: #bfdbfe;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    height: 100vh;
    overflow: hidden;
}

.app {
    height: 100vh;
}

/* Login Screen */
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
}

.login-card {
    background: var(--surface);
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-card h1 {
    color: var(--primary);
    font-size: 24px;
    margin-bottom: 4px;
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 28px;
}

.form-group {
    text-align: left;
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus {
    border-color: var(--primary);
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.login-error {
    color: #ef4444;
    font-size: 13px;
    margin-top: 12px;
    min-height: 18px;
}

/* Chat Screen */
.chat-screen {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 900px;
    margin: 0 auto;
}

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

.btn-logout {
    padding: 6px 14px;
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-logout:hover {
    border-color: #ef4444;
    color: #ef4444;
}

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

.header h1 {
    font-size: 20px;
    color: var(--primary);
}

.subtitle {
    font-size: 13px;
    color: var(--text-muted);
}

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

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
}

.status-dot.thinking {
    background: #f59e0b;
    animation: pulse 1s infinite;
}

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

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

/* Welcome */
.welcome-message {
    text-align: center;
    padding: 40px 20px;
}

.welcome-message h2 {
    font-size: 24px;
    margin-bottom: 8px;
}

.welcome-message p {
    color: var(--text-muted);
    margin-bottom: 20px;
}

.suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.suggestion {
    padding: 10px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text);
    transition: all 0.2s;
}

.suggestion:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

/* Messages */
.message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.message.user {
    align-self: flex-end;
    background: var(--user-bg);
    border: 1px solid var(--user-border);
    border-bottom-right-radius: 4px;
}

.message.agent {
    align-self: flex-start;
    background: var(--agent-bg);
    border: 1px solid var(--agent-border);
    border-bottom-left-radius: 4px;
}

.message .agent-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
    font-weight: 600;
}

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

/* Thinking indicator */
.thinking {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    color: var(--text-muted);
    font-size: 13px;
}

.thinking-dots {
    display: flex;
    gap: 4px;
}

.thinking-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: bounce 1.4s infinite;
}

.thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
    0%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-8px); }
}

/* Input */
.input-container {
    padding: 16px 24px;
    background: var(--surface);
    border-top: 1px solid var(--border);
}

.input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 8px 12px;
    transition: border-color 0.2s;
}

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

textarea {
    flex: 1;
    border: none;
    background: none;
    resize: none;
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    line-height: 1.5;
    max-height: 120px;
    outline: none;
}

#send-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--primary);
    color: white;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s;
}

#send-btn:hover {
    background: #1d4ed8;
}

#send-btn:disabled {
    background: var(--border);
    cursor: not-allowed;
}

.footer-info {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    margin-top: 8px;
}

/* Scrollbar */
.chat-container::-webkit-scrollbar {
    width: 6px;
}

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

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