/* ═══════════════════════════════════════════════════════════════
   TEAdobem Chat — Design System (Dark Mode First)
   Paleta: Teal (#0d9488) + Coral (#f43f5e) + Dark Slate
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&family=Open+Sans:wght@400;500;600&display=swap');

/* ─── TOKENS ──────────────────────────────────────────────────── */
:root {
  /* Brand */
  --teal-50:  #f0fdfa;
  --teal-100: #ccfbf1;
  --teal-200: #99f6e4;
  --teal-300: #5eead4;
  --teal-400: #2dd4bf;
  --teal-500: #14b8a6;
  --teal-600: #0d9488;
  --teal-700: #0f766e;
  --teal-800: #115e59;
  --teal-900: #134e4a;

  --coral-400: #fb7185;
  --coral-500: #f43f5e;
  --coral-600: #e11d48;

  /* Dark Background (WhatsApp Dark-like) */
  --bg-app:     #0b1014;
  --bg-sidebar: #111b21;
  --bg-chat:    #0d1418;
  --bg-header:  #202c33;
  --bg-input:   #202c33;
  --bg-bubble-bot: #202c33;
  --bg-bubble-user: #005c4b;
  --bg-card:    #1a2530;

  /* Text */
  --text-primary:  #e9edef;
  --text-secondary:#8696a0;
  --text-muted:    #54656f;

  /* Border / Divider */
  --border:       #2a3942;
  --border-input: #2a3942;

  /* Status */
  --success:   #25d366;
  --warning:   #fbbf24;
  --error:     #ef4444;
  --online:    #25d366;

  /* Fonts */
  --font-head: 'Nunito', sans-serif;
  --font-body: 'Open Sans', sans-serif;

  /* Radii */
  --r-sm:   6px;
  --r-md:  12px;
  --r-lg:  20px;
  --r-pill:9999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 20px rgba(13,148,136,0.35);
}

/* ─── RESET ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: var(--font-body);
  background: var(--bg-app);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  overflow: hidden;
}

/* ─── SCROLLBAR ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ─── SCREENS (routing) ───────────────────────────────────────── */
.screen { display: none; }
.screen.active { display: flex; flex-direction: column; height: 100vh; width: 100vw; }

/* ═══════════════════════════════════════════════════════════════
   LOGIN
   ═══════════════════════════════════════════════════════════════ */
#login-screen {
  align-items: center;
  justify-content: center;
  background-color: #f8fafc; /* Light background as requested */
}

.login-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 440px;
  padding: 2.5rem 1.5rem;
  background: transparent; 
  animation: fade-in 0.4s ease-out both;
}

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

.login-logo-container {
  background: #ffffff;
  padding: 1.5rem;
  border-radius: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-logo-img {
  width: 180px;
  height: auto;
  display: block;
}

.login-titles {
  text-align: center;
  margin-bottom: 2.5rem;
}

.logo-title {
  font-family: var(--font-head);
  font-size: 2rem;
  font-weight: 800;
  color: #2b3954; /* Dark slate blue */
  margin-bottom: 0.5rem;
}

.logo-subtitle {
  color: #64748b;
  font-size: 1.05rem;
  font-weight: 500;
}

.login-error {
  background: rgba(239,68,68,0.15);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--r-sm);
  padding: 0.75rem 1rem;
  color: #ef4444;
  font-size: 0.875rem;
  text-align: center;
  margin-bottom: 1rem;
  width: 100%;
}



/* Google Button */
.btn-google {
  width: 100%;
  padding: 0.95rem;
  border: 1px solid #e2e8f0;
  border-radius: 30px; 
  background: #ffffff;
  color: #2b3954;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
  margin-bottom: 2.5rem;
}
.btn-google:hover {
  background: #f8fafc;
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
}
.btn-google:disabled { opacity: 0.5; cursor: not-allowed; }

/* Footer Registration */
.login-footer {
  text-align: center;
  width: 100%;
}

.register-text {
  color: #64748b;
  font-size: 0.95rem;
}

.register-link {
  color: var(--teal-600);
  font-weight: 700;
  text-decoration: underline;
  transition: color 0.2s;
}

.register-link:hover {
  color: var(--teal-700);
}

/* Spinner */
.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

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

.hidden { display: none !important; }

/* ═══════════════════════════════════════════════════════════════
   CHAT SCREEN
   ═══════════════════════════════════════════════════════════════ */
#chat-screen {
  background: var(--bg-chat);
  position: relative;
}

/* HEADER ─────────────────────────────────────────────────────── */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  min-height: 60px;
  position: relative;
  z-index: 10;
}

.header-profile {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

/* Teo avatar */
.avatar-teo {
  position: relative;
  width: 42px; height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--teal-700), var(--teal-500));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
  box-shadow: var(--shadow-glow);
}

.online-dot {
  position: absolute;
  bottom: 1px; right: 1px;
  width: 10px; height: 10px;
  background: var(--online);
  border-radius: 50%;
  border: 2px solid var(--bg-header);
  animation: pulse-online 2s ease-in-out infinite;
}

@keyframes pulse-online {
  0%, 100% { box-shadow: 0 0 0 0 rgba(37,211,102,0.5); }
  50%       { box-shadow: 0 0 0 4px rgba(37,211,102,0); }
}

.header-info { display: flex; flex-direction: column; }

.header-name {
  font-family: var(--font-head);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.header-status {
  font-size: 0.78rem;
  color: var(--teal-400);
  font-weight: 500;
}

/* Header action buttons */
.header-actions { display: flex; align-items: center; gap: 0.5rem; }

.header-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  border-radius: var(--r-sm);
  transition: background 0.2s, color 0.2s;
  text-decoration: none;
  font-family: var(--font-head);
  font-size: 0.8rem;
  font-weight: 600;
}

.header-btn svg { width: 20px; height: 20px; }
.header-btn:hover { background: rgba(255,255,255,0.07); color: var(--text-primary); }

.analise-shortcut {
  gap: 0.35rem;
  background: rgba(13,148,136,0.15);
  border: 1px solid rgba(13,148,136,0.25);
  color: var(--teal-400);
  padding: 0.45rem 0.75rem;
  border-radius: var(--r-lg);
}

.analise-shortcut svg { width: 16px; height: 16px; }
.analise-shortcut:hover { background: rgba(13,148,136,0.25); color: var(--teal-300); }

.shortcut-label { display: inline; }

/* MESSAGES AREA ──────────────────────────────────────────────── */
.messages-area {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%232a3942' fill-opacity='0.18'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

/* Date separator */
.date-separator {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  margin: 0.5rem 0;
}

.date-separator span {
  background: rgba(32,44,51,0.9);
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.25rem 0.75rem;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  white-space: nowrap;
}

/* Bubbles */
.message-row {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  animation: bubble-in 0.25s cubic-bezier(0.16,1,0.3,1) both;
}

@keyframes bubble-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.message-row.user { flex-direction: row-reverse; }

.bubble {
  max-width: 72%;
  padding: 0.6rem 0.85rem;
  border-radius: var(--r-md);
  font-size: 0.9rem;
  line-height: 1.5;
  position: relative;
  word-break: break-word;
}

.bubble-teo {
  background: var(--bg-bubble-bot);
  color: var(--text-primary);
  border-radius: var(--r-md) var(--r-md) var(--r-md) 2px;
  box-shadow: var(--shadow-sm);
}

.bubble-user {
  background: var(--bg-bubble-user);
  color: var(--text-primary);
  border-radius: var(--r-md) var(--r-md) 2px var(--r-md);
  box-shadow: var(--shadow-sm);
}

.bubble-meta {
  margin-top: 0.25rem;
  font-size: 0.68rem;
  color: var(--text-muted);
  text-align: right;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.25rem;
}

/* Audio bubble */
.audio-bubble {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 200px;
}

.audio-play-btn {
  background: var(--teal-600);
  border: none;
  border-radius: 50%;
  width: 36px; height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.15s;
  color: #fff;
}
.audio-play-btn:hover { background: var(--teal-500); transform: scale(1.08); }
.audio-play-btn svg { width: 16px; height: 16px; }

.audio-waveform-static {
  flex: 1;
  height: 30px;
  display: flex;
  align-items: center;
  gap: 2px;
}

.audio-waveform-static span {
  display: inline-block;
  width: 2px;
  border-radius: 1px;
  background: var(--teal-400);
  opacity: 0.7;
  transition: height 0.1s;
}

.audio-duration {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Typing indicator */
.typing-indicator { display: flex; }

.bubble.typing {
  background: var(--bg-bubble-bot);
  border-radius: var(--r-md) var(--r-md) var(--r-md) 2px;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 5px;
}

.typing .dot {
  width: 7px; height: 7px;
  background: var(--teal-400);
  border-radius: 50%;
  animation: typing-bounce 1.2s ease-in-out infinite;
}

.typing .dot:nth-child(2) { animation-delay: 0.15s; }
.typing .dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30%            { transform: translateY(-6px); }
}

/* System message */
.system-message {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 0.4rem 1rem;
  background: rgba(32,44,51,0.6);
  border-radius: var(--r-pill);
  margin: 0.5rem auto;
  max-width: 320px;
}

/* ─── INPUT BAR ───────────────────────────────────────────────── */
.input-bar {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  padding: 0.7rem 1rem;
  background: var(--bg-input);
  border-top: 1px solid var(--border);
  position: relative;
  z-index: 10;
}

.attach-btn {
  width: 42px; height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  cursor: pointer;
  color: var(--text-secondary);
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
}

.attach-btn svg { width: 22px; height: 22px; }
.attach-btn:hover { background: rgba(255,255,255,0.07); color: var(--text-primary); }

.text-input-wrapper {
  flex: 1;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border-input);
  border-radius: var(--r-lg);
  padding: 0 0.85rem;
  display: flex;
  align-items: center;
  transition: border-color 0.2s;
}

.text-input-wrapper:focus-within { border-color: var(--teal-600); }

.message-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  resize: none;
  line-height: 1.5;
  max-height: 120px;
  padding: 0.7rem 0;
  overflow-y: auto;
  width: 100%;
}

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

/* Action buttons (send / record) */
.action-btn-wrap { position: relative; flex-shrink: 0; }

.send-btn, .record-btn {
  width: 46px; height: 46px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.16,1,0.3,1);
}

.send-btn {
  background: linear-gradient(135deg, var(--teal-600), var(--teal-500));
  color: #fff;
  box-shadow: 0 3px 10px rgba(13,148,136,0.5);
  animation: pop-in 0.2s cubic-bezier(0.16,1,0.3,1);
}

@keyframes pop-in {
  from { transform: scale(0.6); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.send-btn:hover { box-shadow: 0 4px 16px rgba(13,148,136,0.65); transform: scale(1.05); }
.send-btn svg { width: 20px; height: 20px; }

.record-btn {
  background: linear-gradient(135deg, var(--teal-700), var(--teal-600));
  color: #fff;
  box-shadow: 0 3px 10px rgba(13,148,136,0.35);
}

.record-btn:hover { box-shadow: var(--shadow-glow); transform: scale(1.05); }
.record-btn.recording { background: linear-gradient(135deg, var(--coral-600), var(--coral-500)); box-shadow: 0 3px 10px rgba(244,63,94,0.5); animation: pulse-record 1s ease-in-out infinite; }

@keyframes pulse-record { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }

.mic-icon { width: 22px; height: 22px; }

/* ─── RECORDING OVERLAY ───────────────────────────────────────── */
.recording-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
  padding-bottom: 1.5rem;
  animation: fade-in 0.2s ease;
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.recording-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.75rem 2rem;
  width: 100%;
  max-width: 380px;
  margin: 0 1rem;
  box-shadow: var(--shadow-md);
  animation: slide-up 0.3s cubic-bezier(0.16,1,0.3,1);
}

.waveform-container {
  width: 100%;
  background: rgba(0,0,0,0.2);
  border-radius: var(--r-sm);
  overflow: hidden;
  margin-bottom: 1rem;
}

.waveform-canvas {
  width: 100%;
  height: 60px;
  display: block;
}

.recording-timer {
  font-family: var(--font-head);
  font-size: 2rem;
  font-weight: 800;
  text-align: center;
  color: var(--coral-400);
  margin-bottom: 0.35rem;
  font-variant-numeric: tabular-nums;
}

.recording-hint {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.recording-actions {
  display: flex;
  gap: 0.75rem;
}

.rec-btn {
  flex: 1;
  padding: 0.8rem;
  border: none;
  border-radius: var(--r-lg);
  cursor: pointer;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: all 0.2s;
}

.rec-btn svg { width: 18px; height: 18px; }

.rec-cancel {
  background: rgba(239,68,68,0.15);
  color: #fca5a5;
  border: 1px solid rgba(239,68,68,0.3);
}
.rec-cancel:hover { background: rgba(239,68,68,0.25); }

.rec-send {
  background: linear-gradient(135deg, var(--teal-600), var(--teal-500));
  color: #fff;
  box-shadow: 0 3px 10px rgba(13,148,136,0.4);
}
.rec-send:hover { box-shadow: var(--shadow-glow); }

/* ─── AUDIO PREVIEW BAR ───────────────────────────────────────── */
.audio-preview-bar {
  background: var(--bg-header);
  border-top: 1px solid var(--border);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  animation: slide-up 0.25s cubic-bezier(0.16,1,0.3,1);
}

.preview-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
}

.preview-icon {
  width: 24px; height: 24px;
  color: var(--teal-400);
  flex-shrink: 0;
}

.preview-label {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.preview-audio-ctrl {
  width: 100%;
  height: 30px;
  filter: sepia(1) saturate(3) hue-rotate(120deg) brightness(0.9);
}

.preview-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.prev-btn {
  width: 38px; height: 38px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.prev-btn svg { width: 18px; height: 18px; }

.prev-discard { background: rgba(239,68,68,0.15); color: #fca5a5; }
.prev-discard:hover { background: rgba(239,68,68,0.3); }

.prev-send {
  background: linear-gradient(135deg, var(--teal-600), var(--teal-500));
  color: #fff;
  box-shadow: 0 2px 8px rgba(13,148,136,0.4);
}
.prev-send:hover { box-shadow: var(--shadow-glow); }

/* ─── UPLOAD TOAST ────────────────────────────────────────────── */
.upload-toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-header);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  padding: 0.6rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
  color: var(--text-primary);
  box-shadow: var(--shadow-md);
  z-index: 50;
  animation: fade-in 0.2s ease;
}

.spinner-sm {
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: var(--teal-400);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}

/* ─── RESPONSIVE ──────────────────────────────────────────────── */
@media (max-width: 480px) {
  .shortcut-label { display: none; }
  .analise-shortcut { padding: 0.45rem; }
  .bubble { max-width: 85%; }
  .login-card { margin: 1rem; padding: 2rem 1.5rem; }
}
