/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
  color: #1a1a2e;
  line-height: 1.5;
  background: #f7f5f2;
  -webkit-font-smoothing: antialiased;
}
a { color: #2d6a4f; }

:root {
  --accent: #2d6a4f;
  --accent-light: #40916c;
  --accent-bg: #d8f3dc;
  --bg: #f7f5f2;
  --bg-white: #fff;
  --text: #1a1a2e;
  --text-muted: #5a5a7a;
  --border: #e8e6e1;
  --shadow: 0 2px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.1);
  --radius: 12px;
  --radius-lg: 20px;
  --danger: #e63946;
  --success: #2d6a4f;
}

/* ===== Screens ===== */
.screen { display: none; height: 100vh; }
.screen.active { display: flex; }

/* ===== Login ===== */
.login-container {
  width: 100%; max-width: 440px; margin: 0 auto; padding: 40px 24px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 100vh;
}
.login-brand { text-align: center; margin-bottom: 32px; }
.login-logo { width: 80px; height: 80px; border-radius: 16px; margin-bottom: 16px; object-fit: contain; }
.login-brand h1 { font-size: 1.8rem; font-weight: 700; }
.login-tagline { color: var(--text-muted); font-size: 0.95rem; margin-top: 4px; }
.login-card {
  width: 100%; background: var(--bg-white); border-radius: var(--radius-lg);
  padding: 32px; box-shadow: var(--shadow-lg);
}
.login-card h2 { font-size: 1.4rem; margin-bottom: 4px; }
.login-sub { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 24px; }
.login-help { text-align: center; font-size: 0.8rem; color: var(--text-muted); margin-top: 20px; }

/* Social buttons */
.login-methods { display: flex; flex-direction: column; gap: 10px; }
.btn-social {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 12px 16px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg-white); font-size: 0.95rem; font-weight: 500; font-family: inherit;
  cursor: pointer; transition: all 0.2s;
}
.btn-social:hover { background: var(--bg); border-color: #ccc; }
.btn-google:hover { border-color: #4285F4; }
.btn-facebook:hover { border-color: #1877F2; }

/* Divider */
.login-divider {
  display: flex; align-items: center; gap: 16px; margin: 20px 0;
  color: var(--text-muted); font-size: 0.85rem;
}
.login-divider::before, .login-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* Form */
.login-form { display: flex; flex-direction: column; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group label { font-size: 0.85rem; font-weight: 600; color: var(--text-muted); }
.form-group input {
  padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px;
  font-family: inherit; font-size: 0.95rem; transition: border-color 0.2s;
}
.form-group input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(45,106,79,0.1); }
.forgot-link { text-align: center; font-size: 0.85rem; color: var(--text-muted); }
.forgot-link:hover { color: var(--accent); }

/* Buttons */
.btn { display: inline-block; font-family: inherit; font-weight: 600; font-size: 0.95rem; padding: 12px 24px; border-radius: 8px; border: none; cursor: pointer; transition: all 0.2s; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-light); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-outline { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn-outline:hover { background: var(--accent); color: #fff; }
.btn-full { width: 100%; }
.btn-sm { padding: 8px 16px; font-size: 0.85rem; }
.btn-action {
  padding: 10px 20px; border-radius: 20px; border: 1px solid var(--accent);
  background: var(--bg-white); color: var(--accent); font-family: inherit;
  font-size: 0.9rem; font-weight: 500; cursor: pointer; transition: all 0.2s;
}
.btn-action:hover { background: var(--accent); color: #fff; }

.error-msg { background: #fef2f2; color: var(--danger); padding: 12px; border-radius: 8px; font-size: 0.9rem; margin-top: 12px; }
.success-msg { background: #f0fdf4; color: var(--success); padding: 12px; border-radius: 8px; font-size: 0.9rem; margin-top: 12px; }

/* ===== Chat Layout ===== */
.chat-layout { display: flex; height: 100vh; width: 100%; }

/* Sidebar */
.chat-sidebar {
  width: 280px; min-width: 280px; background: var(--bg-white); border-right: 1px solid var(--border);
  padding: 32px 24px; display: flex; flex-direction: column; align-items: center; gap: 16px;
}
.avatar-container { position: relative; width: 120px; height: 120px; }
.avatar-img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; box-shadow: var(--shadow); }
.avatar-pulse {
  position: absolute; bottom: 4px; right: 4px; width: 18px; height: 18px;
  background: #22c55e; border: 3px solid #fff; border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.avatar-name { font-size: 1.1rem; font-weight: 700; }
.avatar-role { font-size: 0.85rem; color: var(--text-muted); margin-top: -8px; }

.progress-section { width: 100%; margin-top: 16px; }
.progress-title { font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); margin-bottom: 8px; }
.progress-bar { width: 100%; height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 4px; transition: width 0.5s ease; }
.progress-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 6px; }

.owner-info { width: 100%; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.owner-info .info-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 0.85rem; }
.owner-info .info-label { color: var(--text-muted); }
.owner-info .info-value { font-weight: 600; }

/* Chat Main */
.chat-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.chat-header {
  display: none; padding: 12px 16px; background: var(--bg-white); border-bottom: 1px solid var(--border);
  align-items: center; justify-content: space-between;
}
.chat-header-mobile { display: flex; align-items: center; gap: 12px; }
.avatar-sm { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.chat-header-name { font-weight: 600; font-size: 0.95rem; }
.chat-header-status { font-size: 0.8rem; color: var(--text-muted); }
.chat-header-progress { flex: 1; max-width: 120px; }
.progress-bar-sm { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.progress-fill-sm { height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.5s; }

/* Messages */
.chat-messages {
  flex: 1; overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 16px;
  scroll-behavior: smooth;
}
.message { display: flex; gap: 12px; max-width: 85%; animation: fadeIn 0.3s ease; }
.message-bot { align-self: flex-start; }
.message-user { align-self: flex-end; flex-direction: row-reverse; }
.message-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.message-bubble {
  padding: 14px 18px; border-radius: 18px; font-size: 0.95rem; line-height: 1.5;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.message-bot .message-bubble { background: var(--bg-white); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.message-user .message-bubble { background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.message-time { font-size: 0.7rem; color: var(--text-muted); margin-top: 4px; }

/* Typing indicator */
.typing-indicator { display: flex; gap: 4px; padding: 14px 18px; }
.typing-dot { width: 8px; height: 8px; background: var(--text-muted); border-radius: 50%; animation: typingBounce 1.2s infinite; opacity: 0.4; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce { 0%, 60%, 100% { transform: translateY(0); opacity: 0.4; } 30% { transform: translateY(-6px); opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* Input area */
.chat-input-area { padding: 16px 24px; background: var(--bg-white); border-top: 1px solid var(--border); }
.chat-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.chat-actions:empty { display: none; margin: 0; }
.chat-input-row { display: flex; gap: 8px; }
#chatInput {
  flex: 1; padding: 12px 16px; border: 1px solid var(--border); border-radius: 24px;
  font-family: inherit; font-size: 0.95rem; transition: border-color 0.2s;
}
#chatInput:focus { outline: none; border-color: var(--accent); }
.btn-send {
  width: 44px; height: 44px; border-radius: 50%; border: none; background: var(--accent);
  color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
.btn-send:hover { background: var(--accent-light); }

/* Upload area */
.upload-area {
  margin-top: 12px; padding: 20px; border: 2px dashed var(--border); border-radius: var(--radius);
  text-align: center; cursor: pointer; transition: border-color 0.2s; position: relative;
}
.upload-area:hover { border-color: var(--accent); }
.upload-area input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload-prompt { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--text-muted); font-size: 0.9rem; }

/* Step indicator in messages */
.step-badge {
  display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 0.75rem;
  font-weight: 600; background: var(--accent-bg); color: var(--accent); margin-bottom: 6px;
}
.checklist { list-style: none; padding: 0; margin: 8px 0; }
.checklist li { padding: 6px 0 6px 24px; position: relative; font-size: 0.9rem; }
.checklist li::before { content: '○'; position: absolute; left: 0; color: var(--text-muted); }
.checklist li.done::before { content: '✓'; color: var(--accent); font-weight: 700; }
.checklist li.current::before { content: '●'; color: var(--accent); }

/* Mobile */
@media (max-width: 768px) {
  .chat-sidebar { display: none; }
  .chat-header { display: flex; }
  .chat-messages { padding: 16px; }
  .chat-input-area { padding: 12px 16px; }
  .message { max-width: 92%; }
}
