/* chat.css — Qural AI: hero prompt + floating widget */

/* ── Prompt sentinel ── */
.prompt-sentinel { height: 1px; }

/* ── Chat overlay (blur bg on focus) ── */
.chat-overlay {
  position: fixed; inset: 0; z-index: 9998;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s;
}
.chat-overlay.active { opacity: 1; pointer-events: auto; }

/* ══════════════════════════════════════
   HERO PROMPT — inside hero section
   ══════════════════════════════════════ */
.hero-prompt {
  display: flex; align-items: center; gap: 0;
  max-width: 520px; margin: 0 auto 16px;
  padding: 4px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 60px;
  transition: opacity 0.35s ease, transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}
.hero-prompt.fly-out {
  opacity: 0;
  transform: scale(0.7) translate(40vw, 40vh);
  pointer-events: none;
}
.hero-prompt:focus-within {
  border-color: var(--accent);
  background: rgba(255,255,255,0.12);
  box-shadow: 0 0 40px rgba(16,185,129,0.15);
}
.hero-prompt input {
  flex: 1; padding: 18px 24px;
  background: transparent; border: none; outline: none;
  color: #fff; font-size: 16px; font-family: inherit;
}
.hero-prompt input::placeholder { color: rgba(255,255,255,0.35); }
.hero-prompt button {
  width: 48px; height: 48px; flex-shrink: 0;
  background: var(--accent); border: none; border-radius: 50%;
  color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.3s;
}
.hero-prompt button:hover { background: #0ea572; transform: scale(1.05); }
.hero-prompt button svg { width: 20px; height: 20px; }

/* ══════════════════════════════════════
   FLOATING WIDGET — fixed bottom-right
   ══════════════════════════════════════ */
.chat-widget {
  display: none; flex-direction: column;
}
.chat-widget.visible {
  display: flex;
  position: fixed; bottom: 20px; right: 20px; z-index: 9999;
  width: 380px;
  background: linear-gradient(145deg, #151030, #0d0825);
  border: 1px solid rgba(139,92,246,0.2);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 40px rgba(139,92,246,0.08);
  transition: bottom 0.3s ease;
}

/* Fly-in: widget arrives from hero position */
.chat-widget.fly-in {
  animation: widgetFlyIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes widgetFlyIn {
  0% {
    opacity: 0;
    transform: translate(-30vw, -50vh) scale(0.6);
  }
  100% {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
}

/* Fly-out: widget goes back to hero */
.chat-widget.fly-back {
  animation: widgetFlyBack 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  pointer-events: none;
}
@keyframes widgetFlyBack {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-30vw, -50vh) scale(0.6);
  }
}

/* Cookie banner pushes widget up */
.chat-widget.cookie-push {
  bottom: 76px;
}

/* Floating collapsed = only input bar */
.chat-widget.visible.collapsed { border-radius: 60px; }
.chat-widget.visible.collapsed .chat-header,
.chat-widget.visible.collapsed .chat-body,
.chat-widget.visible.collapsed .chat-remaining { display: none; }
.chat-widget.visible.collapsed .chat-footer { border-top: none; }

/* ── Header ── */
.chat-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.chat-title {
  font-size: 14px; font-weight: 700; color: #fff;
  display: flex; align-items: center; gap: 8px;
}
.chat-title::before {
  content: ''; width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(16,185,129,0.5);
  animation: pulse 2s infinite;
}
.chat-toggle {
  width: 28px; height: 28px; border-radius: 8px;
  background: rgba(255,255,255,0.06); border: none;
  color: rgba(255,255,255,0.5); font-size: 18px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.2s; line-height: 1;
}
.chat-toggle:hover { background: rgba(255,255,255,0.1); color: #fff; }

/* ── Body (messages) ── */
.chat-body {
  flex: 1; overflow-y: auto; padding: 16px;
  max-height: 320px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.chat-msg { margin-bottom: 12px; animation: chatFadeIn 0.3s ease; }
@keyframes chatFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.chat-msg-user { text-align: right; }
.chat-msg-user .chat-bubble {
  background: rgba(16,185,129,0.15);
  border: 1px solid rgba(16,185,129,0.2);
  color: #d1fae5;
}
.chat-msg-bot .chat-bubble {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.85);
}
.chat-bubble {
  display: inline-block; max-width: 85%;
  padding: 10px 14px; border-radius: 14px;
  font-size: 14px; line-height: 1.5;
  word-wrap: break-word; text-align: left;
}

/* Typing indicator */
.chat-typing { display: inline-flex; gap: 4px; padding: 12px 16px; }
.chat-typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(255,255,255,0.3);
  animation: chatTyping 1.4s infinite;
}
.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes chatTyping {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.3; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* ── Footer (input) ── */
.chat-footer {
  display: flex; align-items: center; gap: 0;
  padding: 8px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.chat-footer input {
  flex: 1; padding: 12px 16px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 24px; outline: none;
  color: #fff; font-size: 14px; font-family: inherit;
  transition: all 0.3s;
}
.chat-footer input::placeholder { color: rgba(255,255,255,0.3); }
.chat-footer input:focus {
  border-color: var(--accent);
  background: rgba(255,255,255,0.1);
}
.chat-footer button {
  width: 40px; height: 40px; flex-shrink: 0;
  background: var(--accent); border: none; border-radius: 50%;
  color: #fff; cursor: pointer; margin-left: 6px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.3s;
}
.chat-footer button:hover { background: #0ea572; }
.chat-footer button:disabled { opacity: 0.4; cursor: default; }
.chat-footer button svg { width: 16px; height: 16px; }

/* Remaining counter */
.chat-remaining {
  text-align: center; padding: 4px;
  font-size: 11px; color: rgba(255,255,255,0.25);
  border-top: 1px solid rgba(255,255,255,0.04);
}

/* Limit reached */
.chat-limit { text-align: center; padding: 16px; }
.chat-limit-text {
  font-size: 14px; color: rgba(255,255,255,0.7);
  margin-bottom: 12px; line-height: 1.5;
}
.chat-limit-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 28px; border: none; border-radius: 24px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff; font-size: 14px; font-weight: 700; font-family: inherit;
  cursor: pointer; transition: all 0.3s; text-decoration: none;
}
.chat-limit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(16,185,129,0.3);
}

/* Hero examples */
.hero-examples {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
  margin-bottom: 16px; max-width: 520px; margin-left: auto; margin-right: auto;
}
.hero-example {
  padding: 6px 14px; border-radius: 20px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.5); font-size: 13px;
  cursor: pointer; transition: all 0.3s; white-space: nowrap;
}
.hero-example:hover {
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.8);
  border-color: rgba(255,255,255,0.2);
}

/* ── Cookie banner ── */
.cookie-banner {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10000;
  display: flex; align-items: center; justify-content: center; gap: 16px;
  padding: 14px 24px;
  background: rgba(13,8,37,0.95);
  border-top: 1px solid rgba(139,92,246,0.2);
  backdrop-filter: blur(10px);
  animation: cookieSlideUp 0.4s ease;
}
@keyframes cookieSlideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.cookie-text { font-size: 13px; color: rgba(255,255,255,0.7); line-height: 1.4; }
.cookie-text a { color: var(--accent); text-decoration: underline; }
.cookie-accept {
  padding: 8px 20px; border: none; border-radius: 20px;
  background: var(--accent); color: #fff;
  font-size: 13px; font-weight: 600; font-family: inherit;
  cursor: pointer; white-space: nowrap; transition: all 0.2s;
}
.cookie-accept:hover { background: #0ea572; }

/* Footer legal links */
.footer-legal-links { margin-top: 6px; font-size: 12px; }
.footer-legal-links a { opacity: .5; }
.footer-legal-links a:hover { opacity: .8; }

/* ── Mobile ── */
@media (max-width: 600px) {
  .chat-widget.visible {
    width: calc(100% - 16px); right: 8px; bottom: 8px;
    max-height: 70vh;
  }
  .chat-widget.cookie-push { bottom: 60px; }
  .hero-prompt { max-width: 92%; }
  .hero-prompt input { padding: 16px 18px; font-size: 15px; }
  .hero-prompt button { width: 42px; height: 42px; }
  .hero-examples { max-width: 92%; }
  .cookie-banner { flex-direction: column; gap: 10px; padding: 14px 16px; text-align: center; }
}
