/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: 'Nunito Sans', 'Helvetica Neue', Arial, sans-serif;
  color: #27221D;
  line-height: 1.5;
  background: #F5F4EF;
  -webkit-font-smoothing: antialiased;
}
a { color: #2d6a4f; text-decoration: none; }
a:hover { text-decoration: underline; }

:root {
  --cream: #F5F4EF;
  --white: #FFFFFF;
  --text: #27221D;
  --text-body: #2C3439;
  --text-muted: #6B7280;
  --accent: #003349;
  --accent-hover: #004d6e;
  --link: #2d6a4f;
  --link-hover: #40916c;
  --border: #E5EBED;
  --input-bg: #FCFCFC;
  --success: #2d6a4f;
  --danger: #c1292e;
  --shadow: 0 1px 3px rgba(0,0,0,0.04);
  --shadow-lg: 0 4px 24px rgba(0,0,0,0.08);
  --radius: 8px;
}

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

/* ===== Login Split Layout ===== */
.login-split { display: flex; width: 100%; height: 100vh; }

.login-form-side {
  flex: 0 0 45%; display: flex; align-items: center; justify-content: center;
  padding: 48px; background: var(--cream);
}
.login-form-inner { width: 100%; max-width: 380px; }

.login-art-side {
  flex: 1; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #eef2e6 0%, #e8e0d4 100%);
  padding: 48px; overflow: hidden;
}
.login-illustration {
  max-width: 100%; max-height: 80vh; object-fit: contain;
  filter: drop-shadow(0 8px 24px rgba(0,0,0,0.06));
}

@media (max-width: 900px) {
  .login-split { flex-direction: column; }
  .login-form-side { flex: 1; padding: 32px 24px; }
  .login-art-side { display: none; }
}

/* ===== Login Brand ===== */
.login-brand { margin-bottom: 40px; }
.login-logo { height: 48px; width: auto; object-fit: contain; }
.logo-text {
  font-family: 'Public Sans', sans-serif; font-size: 1.4rem; font-weight: 800;
  color: var(--text);
}

/* ===== Transition Brand (CS → SC) ===== */
.transition-brand { margin-bottom: 32px; text-align: center; }
.transition-logos {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  margin-bottom: 12px;
}
.transition-logo-cs {
  height: 40px; width: auto; object-fit: contain; opacity: 0.5;
  filter: grayscale(100%);
}
.transition-arrow { display: flex; align-items: center; flex-shrink: 0; }
.transition-logo-sc { height: 48px; width: auto; object-fit: contain; }
.transition-tagline {
  font-size: 13px; color: var(--text-muted); line-height: 1.4;
  max-width: 320px; margin: 0 auto;
}

/* ===== Login Headings ===== */
.login-heading {
  font-family: 'Public Sans', sans-serif; font-size: 28px; font-weight: 800;
  color: var(--text); margin-bottom: 8px; line-height: 1.2;
}
.login-welcome {
  font-size: 15px; color: var(--text-muted); margin-bottom: 32px; line-height: 1.5;
}

/* ===== Form ===== */
.login-form { display: flex; flex-direction: column; gap: 20px; }

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label {
  font-family: 'Public Sans', sans-serif; font-size: 12px; font-weight: 700;
  letter-spacing: 2px; color: var(--text); text-transform: uppercase;
}
.form-group input {
  padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--input-bg); font-family: inherit; font-size: 15px; font-weight: 600;
  color: var(--text-body); transition: border-color 0.2s, box-shadow 0.2s;
}
.form-group input::placeholder { color: #9CA3AF; font-weight: 400; }
.form-group input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,51,73,0.08);
}

/* Password toggle */
.password-wrapper { position: relative; }
.password-wrapper input { width: 100%; padding-right: 48px; }
.pw-toggle {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; color: #B2C2C8;
  padding: 4px; display: flex; align-items: center; transition: color 0.2s;
}
.pw-toggle:hover { color: var(--text-muted); }

/* Forgot password */
.forgot-link {
  font-size: 14px; font-weight: 700; color: var(--link); margin-top: 2px;
  align-self: flex-start;
}
.forgot-link:hover { color: var(--link-hover); }

.back-link {
  display: block; text-align: center; font-size: 14px; font-weight: 600;
  color: var(--text-muted); margin-top: 8px;
}

/* Login button */
.btn-login {
  width: 100%; padding: 14px 24px; border: 1px solid var(--accent);
  border-radius: var(--radius); background: var(--accent); color: #fff;
  font-family: 'Public Sans', sans-serif; font-size: 16px; font-weight: 600;
  cursor: pointer; transition: all 0.2s; margin-top: 4px;
}
.btn-login:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-login:disabled { opacity: 0.6; cursor: not-allowed; }

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

/* Social buttons */
.social-buttons { display: flex; gap: 12px; }
.btn-social {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--white); font-family: inherit; font-size: 14px; font-weight: 600;
  color: var(--text-body); cursor: pointer; transition: all 0.2s;
}
.btn-social:hover { background: #f8f7f4; border-color: #ccc; box-shadow: var(--shadow); }

/* Help text */
.login-help {
  text-align: center; font-size: 13px; color: var(--text-muted); margin-top: 32px;
}
.login-help a { font-weight: 700; }

/* Messages */
.error-msg {
  background: #fef2f2; color: var(--danger); padding: 12px 16px;
  border-radius: var(--radius); font-size: 14px; margin-top: 8px;
  border: 1px solid #fecaca;
}
.success-msg {
  background: #f0fdf4; color: var(--success); padding: 12px 16px;
  border-radius: var(--radius); font-size: 14px; margin-top: 8px;
  border: 1px solid #bbf7d0;
}

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

/* Sidebar */
.chat-sidebar {
  width: 280px; min-width: 280px; background: var(--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: 0 4px 16px rgba(0,0,0,0.08);
}
.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-family: 'Public Sans', sans-serif; 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-family: 'Public Sans', sans-serif; font-size: 11px; font-weight: 700;
  letter-spacing: 2px; color: var(--text-muted); margin-bottom: 8px;
}
.progress-bar {
  width: 100%; height: 6px; background: var(--border);
  border-radius: 3px; overflow: hidden;
}
.progress-fill {
  height: 100%; background: var(--link); border-radius: 3px;
  transition: width 0.5s ease;
}
.progress-label { font-size: 13px; 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: 14px;
}
.owner-info .info-label { color: var(--text-muted); }
.owner-info .info-value { font-weight: 700; }

.sidebar-footer { margin-top: auto; width: 100%; }
.btn-logout {
  width: 100%; padding: 10px; border: 1px solid var(--border);
  border-radius: var(--radius); background: transparent; color: var(--text-muted);
  font-family: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  transition: all 0.2s;
}
.btn-logout:hover { background: #fef2f2; color: var(--danger); border-color: #fecaca; }

/* Chat Main */
.chat-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; background: var(--cream); }

.chat-header {
  display: none; padding: 12px 16px; background: var(--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-family: 'Public Sans', sans-serif; font-weight: 700; font-size: 15px; }
.chat-header-status { font-size: 13px; 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(--link); 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: 75%; 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: 15px; line-height: 1.6;
  box-shadow: var(--shadow);
}
.message-bot .message-bubble {
  background: var(--white); border: 1px solid var(--border);
  border-bottom-left-radius: 4px; color: var(--text-body);
}
.message-user .message-bubble {
  background: var(--accent); color: #fff; border-bottom-right-radius: 4px;
}

/* Typing */
.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(--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; }

.btn-action {
  padding: 10px 20px; border-radius: 24px; border: 1px solid var(--link);
  background: var(--white); color: var(--link); font-family: inherit;
  font-size: 14px; font-weight: 600; cursor: pointer; transition: all 0.2s;
}
.btn-action:hover { background: var(--link); color: #fff; }

.chat-input-row { display: flex; gap: 8px; }
#chatInput {
  flex: 1; padding: 12px 18px; border: 1px solid var(--border);
  border-radius: 24px; background: var(--input-bg); font-family: inherit;
  font-size: 15px; 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-hover); }

/* Upload */
.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(--link); }
.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: 14px;
}

/* Secure Forms (inline in chat) */
.secure-form-bubble { max-width: 360px; }
.secure-badge {
  display: inline-block; padding: 4px 12px; border-radius: 12px; font-size: 12px;
  font-weight: 700; background: #f0fdf4; color: var(--success); margin-bottom: 12px;
  border: 1px solid #bbf7d0;
}
.inline-secure-form { display: flex; flex-direction: column; gap: 14px; margin-top: 8px; }
.inline-secure-form .form-group label {
  font-family: 'Public Sans', sans-serif; font-size: 11px; font-weight: 700;
  letter-spacing: 1.5px; color: var(--text-muted); text-transform: uppercase;
}
.inline-secure-form .form-group input {
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px;
  font-size: 14px; font-family: inherit; width: 100%;
}
.inline-secure-form .form-group input:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(0,51,73,0.08);
}
.secure-note { font-size: 12px; color: var(--text-muted); line-height: 1.4; margin-top: 4px; }
.bank-lookup { font-size: 13px; margin-top: 4px; min-height: 20px; }

/* 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: 90%; }
}
