/* Leadfuel intake — matches leadfuel.cloud branding */
@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #0b081c;              /* leadfuel deep midnight */
  --bg-elevated: #15112a;     /* slightly lifted surface */
  --bg-subtle: #1c1838;       /* even lifted, for inputs */
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);

  --brand: #e10b0b;            /* leadfuel red */
  --brand-hover: #c00808;
  --brand-soft: rgba(225, 11, 11, 0.12);

  --text: #ffffff;
  --text-muted: #a0a0b8;
  --text-faint: #6b6b80;

  --user-bg: linear-gradient(135deg, #e10b0b, #c00808);
  --user-fg: #ffffff;
  --bot-bg: var(--bg-elevated);
  --bot-fg: #ffffff;

  --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  --radius: 14px;
  --radius-lg: 18px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#app {
  display: flex; flex-direction: column;
  height: 100vh; max-width: 880px; margin: 0 auto;
  background: var(--bg);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
}

/* Header */
.hdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px; border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
  gap: 16px;
}
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.logo-img {
  height: 28px; width: auto;
  display: block;
}
.brand-sub {
  font-size: 12px; color: var(--text-muted);
  border-left: 1px solid var(--border-strong);
  padding-left: 14px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.hdr-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.invitee-pill {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 500;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-link {
  font-size: 11px;
  color: var(--text-muted);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: all .15s;
}
.admin-link:hover {
  color: var(--brand);
  border-color: var(--brand);
}
.progress { min-width: 200px; max-width: 240px; }
.progress-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-align: right;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.progress-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--brand), #ff3030);
  transition: width .4s ease;
  border-radius: 3px;
}

/* Messages */
.chat {
  flex: 1; overflow-y: auto; padding: 28px 24px;
  display: flex; flex-direction: column;
  background: var(--bg);
  scroll-behavior: smooth;
}
.chat::-webkit-scrollbar { width: 8px; }
.chat::-webkit-scrollbar-track { background: transparent; }
.chat::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); border-radius: 4px; }
.chat::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.16); }

.messages { display: flex; flex-direction: column; gap: 16px; }

.msg { display: flex; flex-direction: column; max-width: 82%; }
.msg .bubble {
  padding: 13px 18px;
  border-radius: var(--radius);
  line-height: 1.55;
  font-size: 15px;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-weight: 400;
}
.msg.bot { align-self: flex-start; }
.msg.bot .bubble {
  background: var(--bot-bg);
  color: var(--bot-fg);
  border: 1px solid var(--border);
  border-top-left-radius: 4px;
}
.msg.user { align-self: flex-end; }
.msg.user .bubble {
  background: var(--user-bg);
  color: var(--user-fg);
  border-top-right-radius: 4px;
  box-shadow: 0 4px 12px rgba(225, 11, 11, 0.25);
}

.typing {
  display: inline-flex; gap: 4px; align-items: center;
  padding: 16px 18px;
  background: var(--bot-bg); border: 1px solid var(--border);
  border-radius: var(--radius); border-top-left-radius: 4px;
  width: fit-content;
}
.typing span {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--brand);
  opacity: 0.5;
  animation: dot 1.2s infinite ease-in-out;
}
.typing span:nth-child(2) { animation-delay: .15s; }
.typing span:nth-child(3) { animation-delay: .3s; }
@keyframes dot {
  0%, 60%, 100% { opacity: .3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-4px); }
}

.saved-pill {
  display: inline-block;
  margin: 8px 0 0;
  align-self: flex-start;
  font-size: 11px;
  color: var(--brand);
  background: var(--brand-soft);
  border: 1px solid rgba(225, 11, 11, 0.25);
  padding: 4px 12px;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.completion-banner {
  margin-top: 28px; padding: 20px 24px;
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(34, 197, 94, 0.05));
  border: 1px solid rgba(34, 197, 94, 0.4);
  border-radius: var(--radius);
  color: #d4f5dc;
  font-weight: 500;
  font-size: 15px;
}
.completion-banner.hidden { display: none; }

/* Universal hidden utility */
.hidden { display: none !important; }

/* Welcome screen (pre-start) */
.welcome {
  max-width: 560px;
  margin: 32px auto;
  padding: 32px 36px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.welcome-title {
  font-size: 26px;
  font-weight: 700;
  margin: 0 0 16px;
  letter-spacing: -0.01em;
}
.welcome-title .wave {
  display: inline-block;
  animation: wave 2s ease-in-out infinite;
  transform-origin: 70% 70%;
}
@keyframes wave {
  0%, 60%, 100% { transform: rotate(0deg); }
  10%, 30% { transform: rotate(14deg); }
  20% { transform: rotate(-8deg); }
  40% { transform: rotate(14deg); }
  50% { transform: rotate(-4deg); }
}
.welcome-lead {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  margin: 0 0 18px;
}
.welcome-list {
  list-style: none;
  padding: 0;
  margin: 0 0 20px;
}
.welcome-list li {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-muted);
  padding: 8px 0 8px 28px;
  position: relative;
}
.welcome-list li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 8px;
  color: var(--brand);
  font-weight: 700;
}
.welcome-list li strong { color: var(--text); font-weight: 600; }
.welcome-foot {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-muted);
  margin: 0 0 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.start-btn {
  display: block;
  width: 100%;
  padding: 14px 20px;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background .15s, transform .05s, box-shadow .15s;
  box-shadow: 0 2px 12px rgba(225, 11, 11, 0.3);
}
.start-btn:hover {
  background: var(--brand-hover);
  box-shadow: 0 4px 18px rgba(225, 11, 11, 0.5);
}
.start-btn:active { transform: scale(.985); }
.welcome-fineprint {
  font-size: 11px;
  color: var(--text-faint);
  text-align: center;
  margin: 14px 0 0;
}

/* Composer */
.composer {
  padding: 16px 20px 22px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}
.composer-inner {
  display: flex; align-items: flex-end; gap: 10px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 8px 8px 16px;
  transition: border-color .15s, box-shadow .15s;
}
.composer-inner:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(225, 11, 11, 0.18);
}
#input {
  flex: 1; resize: none; border: none; outline: none; background: transparent;
  font-family: inherit; font-size: 15px; line-height: 1.5;
  max-height: 200px; padding: 7px 0;
  color: var(--text);
}
#input::placeholder { color: var(--text-faint); }
#input:disabled { opacity: 0.5; cursor: not-allowed; }

.attach-btn {
  width: 36px; height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: grid; place-items: center;
  transition: all .15s;
  flex-shrink: 0;
}
.attach-btn:hover { color: var(--brand); border-color: var(--brand); background: rgba(225,11,11,0.06); }
.attach-btn:active { transform: scale(.94); }
.attach-btn svg { width: 16px; height: 16px; }

.url-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--brand);
  border-radius: var(--radius);
  margin-bottom: 10px;
  animation: fadeIn 0.2s ease;
}
.url-bar.hidden { display: none; }
.url-bar input {
  flex: 1; padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit; font-size: 14px;
  outline: none;
}
.url-bar input:focus { border-color: var(--brand); }
.btn-attach {
  padding: 8px 14px;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer;
}
.btn-attach:hover { background: var(--brand-hover); }
.btn-attach.btn-attach-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.btn-attach.btn-attach-ghost:hover { color: var(--text); border-color: var(--text-muted); background: transparent; }

.extract-progress {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--brand);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text);
}
.extract-progress.hidden { display: none; }
.extract-spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(225,11,11,0.2);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

.send-btn, .voice-btn {
  width: 40px; height: 40px;
  border-radius: 10px;
  border: none;
  background: var(--brand);
  color: #fff; cursor: pointer;
  display: grid; place-items: center;
  transition: background .15s, transform .05s, box-shadow .15s;
  box-shadow: 0 2px 8px rgba(225, 11, 11, 0.3);
}
.send-btn:hover, .voice-btn:hover {
  background: var(--brand-hover);
  box-shadow: 0 4px 12px rgba(225, 11, 11, 0.45);
}
.send-btn:active, .voice-btn:active { transform: scale(.94); }
.send-btn:disabled {
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.3);
  cursor: not-allowed;
  box-shadow: none;
}
.send-btn svg, .voice-btn svg { width: 18px; height: 18px; }

.voice-btn.recording {
  background: var(--brand);
  animation: pulse 1.4s infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(225,11,11,.6); }
  50% { box-shadow: 0 0 0 10px rgba(225,11,11,0); }
}

.composer-hint {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 10px;
  text-align: center;
  letter-spacing: 0.02em;
}

/* Mobile */
@media (max-width: 640px) {
  .hdr { padding: 12px 16px; gap: 12px; }
  .brand-sub { display: none; }
  .hdr-right { gap: 8px; }
  .progress { min-width: 90px; }
  .progress-label { font-size: 10px; }
  .admin-link { font-size: 10px; padding: 4px 8px; }
  .chat { padding: 18px 14px; }
  .msg { max-width: 92%; }
  .composer { padding: 12px 12px 16px; }
  .logo-img { height: 24px; }
}
