/* ── CrownPayRoll Chatbot — Crown Aesthetic ── */

/* ── Chat Toggle Button (floating) ── */
.cb-toggle {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 56px;
  height: 56px;
  border-radius: 0;
  background: var(--rust-orange);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 3px 3px 0 rgba(0,0,0,0.5);
  z-index: 150;
  transition: transform 0.2s, box-shadow 0.2s;
}
.cb-toggle:hover {
  transform: scale(1.08);
  box-shadow: 4px 4px 0 rgba(0,0,0,0.6);
}
.cb-toggle svg { width: 26px; height: 26px; fill: white; }

/* ── Labeled pill variant ── */
.cb-toggle-labeled {
  width: auto;
  min-width: 160px;
  height: 48px;
  padding: 0 20px 0 16px;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  white-space: nowrap;
}
.cb-toggle-labeled svg { width: 22px; height: 22px; fill: none; flex-shrink: 0; }

/* ── Pulse animation (fires 3× on first login) ── */
@keyframes cb-pulse-ring {
  0%   { box-shadow: 3px 3px 0 rgba(0,0,0,0.5), 0 0 0 0 rgba(192,57,43,0.55); }
  60%  { box-shadow: 3px 3px 0 rgba(0,0,0,0.5), 0 0 0 14px rgba(192,57,43,0); }
  100% { box-shadow: 3px 3px 0 rgba(0,0,0,0.5), 0 0 0 0 rgba(192,57,43,0); }
}
.cb-toggle.pulse {
  animation: cb-pulse-ring 2s ease-out 3;
}

/* ── Landing sticky bottom bar ── */
.cb-landing-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 150;
  background: var(--rust-orange);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 14px 24px;
  font-family: var(--font-display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  cursor: pointer;
  transition: transform 0.4s, opacity 0.2s;
  font-size: 15px;
}
.cb-landing-bar:hover { opacity: 0.92; }
.cb-landing-bar.hidden { transform: translateY(100%); }

/* ── Free-tier notice strip ── */
.cb-free-notice {
  padding: 8px 16px;
  background: rgba(232, 96, 28, 0.08);
  border-top: 1px solid rgba(232, 96, 28, 0.2);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}
.cb-free-notice .crown-link {
  color: var(--neon-gold);
  text-decoration: underline;
}

/* ── Onboarding Crown AI callout ── */
.cb-onboarding-callout {
  background: rgba(192, 57, 43, 0.08);
  border: 1px solid rgba(192, 57, 43, 0.3);
  border-radius: 0;
  padding: 22px 24px;
  margin-bottom: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}
.cb-onboarding-callout-title {
  font-family: var(--font-display);
  font-size: 22px;
  text-transform: uppercase;
  color: var(--neon-gold);
  line-height: 1;
}
.cb-onboarding-callout-body {
  font-family: var(--font-condensed);
  font-size: 14px;
  color: var(--text-muted);
  margin: 0;
}
.cb-toggle.has-unread::after {
  content: '';
  position: absolute;
  top: 6px;
  right: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--neon-gold);
  border: 2px solid var(--rust-orange);
}

/* ── Chat Window ── */
.cb-window {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 360px;
  max-width: calc(100vw - 48px);
  height: 520px;
  max-height: calc(100vh - 140px);
  background: var(--bg-card);
  border: 1px solid rgba(232, 96, 28, 0.25);
  border-radius: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 8px 48px rgba(0, 0, 0, 0.7);
  z-index: 160;
  opacity: 0;
  transform: translateY(12px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.cb-window.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* ── Chat Header ── */
.cb-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  background: var(--bg-mid);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.cb-crown-icon {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}
.cb-header-text { flex: 1; }
.cb-header-title {
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
  line-height: 1;
}
.cb-header-sub {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--neon-pink);
  margin-top: 3px;
}
.cb-tier-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 0;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
}
.cb-tier-badge.paid {
  border-color: rgba(255, 214, 14, 0.3);
  color: var(--neon-gold);
  background: rgba(255, 214, 14, 0.08);
}
.cb-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  border-radius: 3px;
  transition: color 0.2s;
  display: flex;
  align-items: center;
}
.cb-close:hover { color: var(--neon-pink); }

/* ── Message Thread ── */
.cb-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}
.cb-messages::-webkit-scrollbar { width: 4px; }
.cb-messages::-webkit-scrollbar-track { background: transparent; }
.cb-messages::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 2px; }

/* ── Messages ── */
.cb-msg {
  display: flex;
  flex-direction: column;
  max-width: 88%;
  animation: cb-fade-in 0.2s ease;
}
@keyframes cb-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.cb-msg.user { align-self: flex-end; align-items: flex-end; }
.cb-msg.ai { align-self: flex-start; align-items: flex-start; }

.cb-bubble {
  padding: 10px 14px;
  border-radius: 8px;
  font-family: var(--font-condensed);
  font-size: 14px;
  line-height: 1.45;
  word-break: break-word;
}
.cb-msg.user .cb-bubble {
  background: var(--rust-orange);
  color: white;
  border-radius: 0;
  border-bottom-right-radius: 2px;
}
.cb-msg.ai .cb-bubble {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text);
  border-radius: 0;
  border-bottom-left-radius: 2px;
}
.cb-msg.ai .cb-bubble strong {
  color: var(--neon-pink);
  font-weight: 600;
}
.cb-msg.ai .cb-bubble em {
  color: var(--neon-gold);
  font-style: normal;
  font-weight: 500;
}

.cb-msg-time {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-dim);
  margin-top: 4px;
  letter-spacing: 0.08em;
}

/* ── Typing Indicator ── */
.cb-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0;
  width: fit-content;
}
.cb-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-dim);
  animation: cb-pulse 1.2s ease-in-out infinite;
}
.cb-typing-dot:nth-child(2) { animation-delay: 0.15s; }
.cb-typing-dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes cb-pulse {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1); }
}

/* ── Preloaded Questions ── */
.cb-questions {
  padding: 12px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.cb-question-btn {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 6px 10px;
  border-radius: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.18s;
  text-align: left;
  max-width: 160px;
}
.cb-question-btn:hover {
  background: rgba(232, 96, 28, 0.08);
  border-color: var(--rust-orange);
  color: var(--rust-orange);
}
.cb-question-btn.paid {
  border-color: rgba(255, 214, 14, 0.25);
  background: rgba(255, 214, 14, 0.06);
  color: var(--neon-gold);
}
.cb-question-btn.paid:hover {
  background: rgba(255, 214, 14, 0.15);
  border-color: var(--neon-gold);
}

/* ── Input Area ── */
.cb-input-area {
  padding: 14px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  gap: 10px;
  align-items: flex-end;
  background: var(--bg-card);
}
.cb-input {
  flex: 1;
  background: var(--bg);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0;
  padding: 10px 14px;
  font-family: var(--font-condensed);
  font-size: 14px;
  color: var(--text);
  resize: none;
  max-height: 100px;
  line-height: 1.4;
  transition: border-color 0.2s;
  box-sizing: border-box;
  width: 100%;
}
.cb-input::placeholder { color: var(--text-dim); }
.cb-input:focus { outline: none; border-color: var(--neon-pink); }
.cb-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 0;
  background: var(--rust-orange);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.2s, transform 0.2s;
}
.cb-send-btn:hover { opacity: 0.85; transform: scale(1.05); }
.cb-send-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.cb-send-btn svg { width: 18px; height: 18px; fill: white; }

/* ── Landing page variant (standalone window) ── */
.cb-window.landing {
  bottom: auto;
  top: 50%;
  right: auto;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.97);
  width: 400px;
  max-height: 560px;
}
.cb-window.landing.open {
  transform: translate(-50%, -50%) scale(1);
}

/* ── Responsive ── */
@media (max-width: 480px) {
  .cb-window {
    bottom: 16px;
    right: 16px;
    left: 16px;
    width: auto;
    max-width: none;
    height: 60vh;
  }
  .cb-toggle { bottom: 20px; right: 20px; }
  .cb-toggle-labeled { min-width: auto; padding: 0 14px; font-size: 13px; }
  .cb-landing-bar { padding: 12px 16px; font-size: 13px; gap: 10px; }
}