:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-color: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --ai-bubble: #f1f5f9;
    --user-bubble: #2563eb;
    --error-color: #ef4444;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

.screen { display: none; width: 100%; height: 100%; }
.screen.active { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.hidden { display: none !important; }

/* AUTH SCREEN */
.auth-container {
    width: 100%;
    max-width: 480px;
    padding: 2rem;
}
.brand-header {
    text-align: center;
    margin-bottom: 2rem;
}
.brand-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px; height: 56px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 16px;
    margin-bottom: 1rem;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2);
}
.brand-name { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.25rem; }
.brand-tagline { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1.5rem; }
.brand-badges {
    display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center;
}
.badge {
    background-color: #f1f5f9;
    color: var(--text-color);
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid var(--border-color);
}

.auth-card {
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.01);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.auth-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
}
.auth-tab {
    flex: 1;
    padding: 1rem;
    text-align: center;
    background: none; border: none;
    font-size: 0.95rem; font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}
.auth-tab.active {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    background-color: #f8fafc;
}
.auth-forms { padding: 2rem; }

.form-group { margin-bottom: 1.25rem; }
.form-group label {
    display: block; font-size: 0.85rem; font-weight: 500; color: var(--text-color); margin-bottom: 0.5rem;
}
.form-group input, .form-group select {
    width: 100%; padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s;
}
.form-group input:focus, .form-group select:focus {
    outline: none; border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.btn-primary {
    background-color: var(--primary-color);
    color: white; border: none; border-radius: 8px;
    padding: 0.75rem 1.5rem; font-size: 0.95rem; font-weight: 600;
    cursor: pointer; transition: background-color 0.2s;
    display: flex; justify-content: center; align-items: center; gap: 0.5rem;
}
.btn-primary:hover { background-color: var(--primary-hover); }
.btn-outline {
    background-color: transparent;
    color: var(--text-color); border: 1px solid var(--border-color); border-radius: 8px;
    padding: 0.5rem 1rem; font-size: 0.85rem; font-weight: 500;
    cursor: pointer; transition: all 0.2s;
}
.btn-outline:hover { background-color: #f1f5f9; }
.btn-icon { background: none; border: none; color: var(--text-muted); cursor: pointer; display: flex; align-items: center; padding: 0.5rem; border-radius: 6px;}
.btn-icon:hover { background-color: #f1f5f9; color: var(--text-color); }
.w-full { width: 100%; }
.mt-4 { margin-top: 1rem; }

.error-msg {
    margin-top: 1rem; padding: 0.75rem; background-color: #fef2f2; color: var(--error-color);
    border-radius: 8px; font-size: 0.85rem; text-align: center; border: 1px solid #fca5a5;
}

/* CHAT SCREEN */
#chat-screen {
    max-width: 800px;
    width: 100%; height: 100vh;
    background: var(--card-bg);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.05);
}

.chat-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 1rem 1.5rem; border-bottom: 1px solid var(--border-color);
    background: var(--card-bg);
}
.chat-header-left { display: flex; align-items: center; gap: 1rem; }
.agent-avatar {
    width: 40px; height: 40px; background: var(--primary-color); color: white;
    border-radius: 50%; display: flex; align-items: center; justify-content: center; position: relative;
}
.online-dot {
    position: absolute; bottom: 0; right: 0; width: 10px; height: 10px;
    background: #10b981; border: 2px solid white; border-radius: 50%;
}
.agent-name { font-weight: 600; font-size: 1rem; }
.agent-status { font-size: 0.75rem; color: var(--text-muted); }
.chat-header-right { display: flex; align-items: center; gap: 0.5rem; }

.messages-container {
    flex: 1; padding: 1.5rem; overflow-y: auto; display: flex; flex-direction: column; gap: 1.25rem;
    background-color: var(--bg-color);
}
.message { display: flex; gap: 1rem; max-width: 85%; }
.message.user { align-self: flex-end; flex-direction: row-reverse; }
.msg-avatar {
    width: 32px; height: 32px; background: #e2e8f0; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--text-muted); font-size: 0.85rem;
}
.message.user .msg-avatar { background: var(--primary-color); color: white; }
.msg-bubble {
    padding: 0.85rem 1.25rem; border-radius: 12px; font-size: 0.95rem; line-height: 1.5;
}
.message.ai .msg-bubble { background: var(--ai-bubble); color: var(--text-color); border-top-left-radius: 2px; }
.message.user .msg-bubble { background: var(--user-bubble); color: white; border-top-right-radius: 2px; }
.msg-time { font-size: 0.7rem; color: var(--text-muted); margin-top: 0.25rem; }
.message.user .msg-time { text-align: right; }

.quick-suggestions {
    padding: 0.75rem 1.5rem; display: flex; gap: 0.5rem; overflow-x: auto; background: var(--card-bg);
}
.suggestion-chip {
    padding: 0.5rem 1rem; border: 1px solid var(--border-color); background: var(--card-bg); border-radius: 20px;
    font-size: 0.8rem; color: var(--text-color); cursor: pointer; white-space: nowrap; transition: all 0.2s;
}
.suggestion-chip:hover { background: #f1f5f9; border-color: #cbd5e1; }

.chat-input-area {
    padding: 1rem 1.5rem; border-top: 1px solid var(--border-color); background: var(--card-bg);
}
.input-container {
    display: flex; gap: 0.75rem; align-items: flex-end;
}
.chat-textarea {
    flex: 1; padding: 0.75rem 1rem; border: 1px solid var(--border-color); border-radius: 20px;
    font-family: inherit; font-size: 0.95rem; resize: none; overflow-y: hidden;
    line-height: 1.5; transition: border-color 0.2s;
}
.chat-textarea:focus { outline: none; border-color: var(--primary-color); }
.btn-send {
    width: 44px; height: 44px; border-radius: 50%; border: none; background: var(--primary-color); color: white;
    cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: background-color 0.2s;
}
.btn-send:hover { background: var(--primary-hover); }
.btn-send:disabled { background: #94a3b8; cursor: not-allowed; }

.typing-indicator { display: flex; gap: 1rem; padding: 0.5rem 1.5rem; background: var(--bg-color); }
.typing-bubble { background: var(--ai-bubble); padding: 0.85rem 1.25rem; border-radius: 12px; border-top-left-radius: 2px; display: flex; gap: 4px; align-items: center;}
.typing-bubble span { width: 6px; height: 6px; background: #94a3b8; border-radius: 50%; animation: typing 1s infinite alternate; }
.typing-bubble span:nth-child(2) { animation-delay: 0.2s; }
.typing-bubble span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing { 0% { transform: translateY(0); opacity: 0.5; } 100% { transform: translateY(-4px); opacity: 1; } }

.modal { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal-overlay { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.6); backdrop-filter: blur(2px); }
.modal-card {
    position: relative; background: var(--card-bg); padding: 2rem; border-radius: 16px; max-width: 400px; width: 90%; text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}
.modal-card h3 { font-size: 1.25rem; font-weight: 600; margin-bottom: 0.75rem; }
.modal-card p { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 1.5rem; line-height: 1.5; }
.modal-actions { display: flex; gap: 1rem; }
.modal-actions button { flex: 1; padding: 0.75rem; }
