/* =========================================================
   AI-SEO Insights — Shared Stylesheet
   Works alongside Tailwind (Play CDN). Designed to be
   WordPress-friendly: utility classes are reusable, custom
   styles are scoped, and component classes mirror common
   WP block patterns.
   ========================================================= */

:root {
  --brand-50:  #f5f3ff;
  --brand-100: #ede9fe;
  --brand-200: #ddd6fe;
  --brand-300: #c4b5fd;
  --brand-400: #a78bfa;
  --brand-500: #8b5cf6;
  --brand-600: #7c3aed;
  --brand-700: #6d28d9;
  --brand-800: #5b21b6;
  --brand-900: #4c1d95;
  --ink-900:   #0f0a29;
  --ink-700:   #312e58;
  --ink-500:   #6b6890;
  --surface:   #ffffff;
  --surface-soft: #faf9ff;
  --ring: rgba(124, 58, 237, 0.35);
}

* { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink-900);
  background: #ffffff;
}

/* ---------- Backgrounds ---------- */

.bg-gradient-hero {
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, #ddd6fe 0%, rgba(221, 214, 254, 0) 60%),
    linear-gradient(180deg, #f5f3ff 0%, #ffffff 60%);
}

.bg-soft-violet {
  background: linear-gradient(180deg, #ffffff 0%, #f5f3ff 100%);
}

.bg-grid {
  background-image:
    linear-gradient(rgba(124, 58, 237, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124, 58, 237, 0.08) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
          mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
}

.glow-blob {
  position: absolute;
  border-radius: 9999px;
  filter: blur(80px);
  opacity: 0.55;
  pointer-events: none;
  z-index: 0;
}

/* ---------- Typography helpers ---------- */

.text-display {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.text-gradient {
  background: linear-gradient(90deg, #6d28d9 0%, #8b5cf6 50%, #a78bfa 100%);
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 600;
  border-radius: 9999px;
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, #6d28d9 0%, #4c1d95 100%);
  color: #fff;
  box-shadow: 0 10px 25px -10px rgba(76, 29, 149, 0.55);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 35px -10px rgba(76, 29, 149, 0.7);
}

.btn-secondary {
  background: #ffffff;
  color: var(--brand-700);
  border: 1px solid var(--brand-200);
}
.btn-secondary:hover {
  background: var(--brand-50);
  border-color: var(--brand-300);
  transform: translateY(-2px);
}

.btn-ghost {
  color: var(--ink-700);
  background: transparent;
}
.btn-ghost:hover { color: var(--brand-700); }

/* ---------- Cards ---------- */

.card {
  background: #ffffff;
  border: 1px solid rgba(124, 58, 237, 0.08);
  border-radius: 1.25rem;
  box-shadow: 0 1px 0 rgba(124, 58, 237, 0.04), 0 12px 28px -18px rgba(76, 29, 149, 0.18);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 1px 0 rgba(124, 58, 237, 0.06), 0 24px 40px -20px rgba(76, 29, 149, 0.28);
  border-color: rgba(124, 58, 237, 0.18);
}

.card-soft {
  background: linear-gradient(180deg, #ffffff 0%, #faf9ff 100%);
  border: 1px solid rgba(124, 58, 237, 0.1);
  border-radius: 1.25rem;
}

.card-feature .feature-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #ede9fe 0%, #c4b5fd 100%);
  color: var(--brand-700);
}

/* ---------- Nav ---------- */

.nav-link {
  position: relative;
  color: var(--ink-700);
  font-weight: 500;
  padding: 0.5rem 0.25rem;
  transition: color 0.2s ease;
}
.nav-link:hover { color: var(--brand-700); }
.nav-link.active { color: var(--brand-700); }
.nav-link.active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -6px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, #7c3aed, #a78bfa);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  background: rgba(255, 255, 255, 0.75);
  border-bottom: 1px solid rgba(124, 58, 237, 0.08);
}

/* ---------- Badge / pill ---------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.875rem;
  border-radius: 9999px;
  background: #ffffff;
  border: 1px solid rgba(124, 58, 237, 0.18);
  color: var(--ink-700);
  font-size: 0.8125rem;
  font-weight: 500;
  box-shadow: 0 6px 18px -10px rgba(76, 29, 149, 0.25);
}

.pill-violet {
  background: linear-gradient(135deg, #ede9fe 0%, #ddd6fe 100%);
  color: var(--brand-800);
  border-color: rgba(124, 58, 237, 0.2);
}

/* ---------- Hero mockup ---------- */

.mockup {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(124, 58, 237, 0.12);
  border-radius: 1rem;
  box-shadow: 0 25px 60px -25px rgba(76, 29, 149, 0.35);
  backdrop-filter: blur(8px);
  padding: 1.25rem;
}

.mockup-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.time-slot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 0.875rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(124, 58, 237, 0.12);
  background: #fff;
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--ink-700);
  transition: all 0.2s ease;
  cursor: pointer;
}
.time-slot:hover { border-color: var(--brand-400); }
.time-slot.active {
  background: linear-gradient(135deg, #6d28d9, #4c1d95);
  color: #fff;
  border-color: transparent;
}

.calendar-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  width: 32px;
  border-radius: 9999px;
  font-size: 0.8125rem;
  color: var(--ink-700);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.calendar-cell:hover { background: var(--brand-50); }
.calendar-cell.active {
  background: linear-gradient(135deg, #6d28d9, #4c1d95);
  color: #fff;
}
.calendar-cell.muted { color: #c4c2dd; }

/* ---------- Section helpers ---------- */

.section {
  position: relative;
  padding-top: 5rem;
  padding-bottom: 5rem;
}
@media (min-width: 768px) {
  .section { padding-top: 6rem; padding-bottom: 6rem; }
}

.container-tight {
  max-width: 1200px;
  margin: 0 auto;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-700);
  background: var(--brand-50);
  border: 1px solid var(--brand-100);
  padding: 0.375rem 0.875rem;
  border-radius: 9999px;
}

/* ---------- Pricing ---------- */

.price-card {
  position: relative;
  background: #ffffff;
  border: 1px solid rgba(124, 58, 237, 0.1);
  border-radius: 1.5rem;
  padding: 2rem 1.75rem;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.price-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 24px 40px -20px rgba(76, 29, 149, 0.28);
}
.price-card.popular {
  background: linear-gradient(180deg, #faf9ff 0%, #ffffff 100%);
  border-color: var(--brand-400);
  box-shadow: 0 25px 50px -20px rgba(124, 58, 237, 0.35);
}

.price-card.popular::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 1.5rem;
  padding: 1px;
  background: linear-gradient(135deg, #a78bfa, #6d28d9);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
          mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
}

.feature-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  color: var(--ink-700);
  font-size: 0.9375rem;
  padding: 0.4rem 0;
}
.feature-list li svg { flex: 0 0 auto; margin-top: 3px; color: var(--brand-600); }

/* ---------- Testimonials ---------- */

.testimonial {
  background: #fff;
  border: 1px solid rgba(124, 58, 237, 0.1);
  border-radius: 1.25rem;
  padding: 1.5rem;
  box-shadow: 0 12px 28px -18px rgba(76, 29, 149, 0.2);
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 9999px;
  background: linear-gradient(135deg, #c4b5fd, #6d28d9);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  font-size: 0.875rem;
}

/* ---------- Footer ---------- */

.site-footer {
  background: linear-gradient(180deg, #ffffff 0%, #f5f3ff 100%);
  border-top: 1px solid rgba(124, 58, 237, 0.1);
}

/* ---------- Animations ---------- */

@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-10px); }
}
.animate-floaty { animation: floaty 6s ease-in-out infinite; }

@keyframes pulse-soft {
  0%, 100% { opacity: 0.55; }
  50%      { opacity: 0.85; }
}
.animate-pulse-soft { animation: pulse-soft 4s ease-in-out infinite; }

/* Reveal-on-scroll (toggled by JS) */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Marquee for logo/social-proof row */
.marquee {
  display: flex;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
.marquee-track {
  display: flex;
  gap: 3rem;
  animation: marquee 28s linear infinite;
  white-space: nowrap;
}
@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ---------- FAQ ---------- */

.faq-item {
  border: 1px solid rgba(124, 58, 237, 0.12);
  border-radius: 1rem;
  background: #fff;
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.faq-item[open] {
  border-color: var(--brand-300);
  box-shadow: 0 12px 28px -18px rgba(76, 29, 149, 0.25);
}
.faq-item summary {
  list-style: none;
  cursor: pointer;
  padding: 1.125rem 1.25rem;
  font-weight: 600;
  color: var(--ink-900);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item .faq-icon {
  width: 26px; height: 26px;
  border-radius: 999px;
  background: var(--brand-50);
  color: var(--brand-700);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s ease, background 0.2s ease;
  flex: 0 0 auto;
}
.faq-item[open] .faq-icon { transform: rotate(45deg); background: var(--brand-100); }
.faq-item .faq-body {
  padding: 0 1.25rem 1.25rem;
  color: var(--ink-500);
  line-height: 1.65;
}

/* ---------- Steps (How it works) ---------- */

.step-card {
  position: relative;
  background: #fff;
  border: 1px solid rgba(124, 58, 237, 0.1);
  border-radius: 1.25rem;
  padding: 1.75rem;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.step-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 24px 40px -20px rgba(76, 29, 149, 0.25);
}
.step-number {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #6d28d9, #4c1d95);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  box-shadow: 0 10px 22px -10px rgba(76, 29, 149, 0.55);
}

/* ---------- Stats ---------- */

.stat {
  text-align: center;
}
.stat .stat-num {
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, #4c1d95, #8b5cf6);
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
}
@media (min-width: 768px) {
  .stat .stat-num { font-size: 2.75rem; }
}

/* ---------- Forms ---------- */

.form-field {
  display: block;
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(124, 58, 237, 0.18);
  border-radius: 0.75rem;
  background: #fff;
  color: var(--ink-900);
  font-size: 0.9375rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.form-field:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 4px var(--ring);
}

/* ---------- Mobile menu ---------- */

.mobile-menu {
  display: none;
  border-top: 1px solid rgba(124, 58, 237, 0.1);
  background: #fff;
}
.mobile-menu.open { display: block; }
.mobile-menu a {
  display: block;
  padding: 0.85rem 1.25rem;
  color: var(--ink-700);
  font-weight: 500;
  border-bottom: 1px solid rgba(124, 58, 237, 0.06);
}
.mobile-menu a.active { color: var(--brand-700); }

/* ---------- Utility ---------- */

.divider-soft {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(124, 58, 237, 0.18), transparent);
}

.scrollbar-hidden::-webkit-scrollbar { display: none; }
.scrollbar-hidden { -ms-overflow-style: none; scrollbar-width: none; }

/* Tighten Tailwind prose-ish for long-form paragraphs */
.lede {
  color: var(--ink-500);
  font-size: 1.0625rem;
  line-height: 1.7;
}
@media (min-width: 768px) {
  .lede { font-size: 1.125rem; }
}

/* ---------- Blog ---------- */

.blog-card {
  background: #fff;
  border: 1px solid rgba(124, 58, 237, 0.1);
  border-radius: 1.25rem;
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  display: flex;
  flex-direction: column;
}
.blog-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 24px 40px -20px rgba(76, 29, 149, 0.28);
  border-color: rgba(124, 58, 237, 0.18);
}
.blog-card .thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
}
.blog-card .thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(76, 29, 149, 0.25), rgba(167, 139, 250, 0));
}
.blog-card .thumb-bg {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 30% 30%, rgba(255,255,255,0.4) 0%, transparent 40%),
    linear-gradient(135deg, var(--c1, #6d28d9), var(--c2, #4c1d95));
}
.blog-card .thumb-pattern {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.12) 1px, transparent 1px);
  background-size: 32px 32px;
  opacity: 0.5;
}
.blog-card .thumb-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.85);
  z-index: 1;
}

.category-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.375rem 0.875rem;
  border-radius: 9999px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ink-700);
  background: #fff;
  border: 1px solid rgba(124, 58, 237, 0.18);
  cursor: pointer;
  transition: all 0.2s ease;
}
.category-pill:hover { color: var(--brand-700); border-color: var(--brand-300); }
.category-pill.active {
  background: linear-gradient(135deg, #6d28d9, #4c1d95);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 6px 18px -8px rgba(76, 29, 149, 0.5);
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  background: var(--brand-50);
  color: var(--brand-700);
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid var(--brand-100);
}
.tag:hover { background: var(--brand-100); }

.pagination-btn {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.625rem;
  border: 1px solid rgba(124, 58, 237, 0.15);
  color: var(--ink-700);
  background: #fff;
  font-weight: 600;
  font-size: 0.9375rem;
  transition: all 0.2s ease;
}
.pagination-btn:hover {
  border-color: var(--brand-300);
  color: var(--brand-700);
}
.pagination-btn.active {
  background: linear-gradient(135deg, #6d28d9, #4c1d95);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 8px 18px -8px rgba(76, 29, 149, 0.5);
}
.pagination-btn[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}

/* TOC */

.toc {
  position: sticky;
  top: 100px;
}
.toc-link {
  display: block;
  padding: 0.5rem 0.75rem;
  border-left: 2px solid transparent;
  color: var(--ink-500);
  font-size: 0.9rem;
  line-height: 1.4;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.toc-link:hover { color: var(--brand-700); }
.toc-link.active {
  color: var(--brand-700);
  border-left-color: var(--brand-600);
  background: linear-gradient(90deg, var(--brand-50), transparent);
  font-weight: 600;
}

/* Article prose */

.prose-content {
  color: var(--ink-700);
  font-size: 1.0625rem;
  line-height: 1.75;
}
.prose-content > * + * { margin-top: 1.25rem; }
.prose-content h2 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--ink-900);
  margin-top: 2.5rem;
  scroll-margin-top: 100px;
}
.prose-content h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--ink-900);
  margin-top: 1.75rem;
}
.prose-content p { color: var(--ink-700); }
.prose-content a {
  color: var(--brand-700);
  text-decoration: underline;
  text-decoration-color: rgba(124, 58, 237, 0.35);
  text-underline-offset: 3px;
}
.prose-content a:hover { text-decoration-color: var(--brand-700); }
.prose-content ul, .prose-content ol {
  padding-left: 1.5rem;
}
.prose-content ul { list-style: disc; }
.prose-content ol { list-style: decimal; }
.prose-content li + li { margin-top: 0.5rem; }
.prose-content blockquote {
  padding: 1.25rem 1.5rem;
  border-left: 4px solid var(--brand-400);
  background: linear-gradient(90deg, var(--brand-50), transparent);
  border-radius: 0.5rem;
  font-style: italic;
  color: var(--ink-700);
}
.prose-content code {
  background: var(--brand-50);
  color: var(--brand-800);
  padding: 0.125rem 0.375rem;
  border-radius: 0.375rem;
  font-size: 0.9em;
  font-family: 'SF Mono', Menlo, Monaco, Consolas, monospace;
}
.prose-content figure {
  margin: 2rem 0;
}
.prose-content figcaption {
  text-align: center;
  font-size: 0.875rem;
  color: var(--ink-500);
  margin-top: 0.5rem;
}

/* Reading progress bar */
.read-progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, #6d28d9, #a78bfa);
  z-index: 100;
  transition: width 0.1s ease;
}

/* Search box */
.search-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.5rem 0.5rem 1.25rem;
  background: #fff;
  border: 1px solid rgba(124, 58, 237, 0.18);
  border-radius: 9999px;
  box-shadow: 0 12px 28px -18px rgba(76, 29, 149, 0.25);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.search-box:focus-within {
  border-color: var(--brand-400);
  box-shadow: 0 0 0 4px var(--ring);
}
.search-box input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 0.9375rem;
  color: var(--ink-900);
}
.search-box input::placeholder { color: var(--ink-500); }

/* ============== Chatbot widget ============== */

.chatbot-fab {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 60px;
  height: 60px;
  border-radius: 9999px;
  border: 0;
  background: linear-gradient(135deg, #6d28d9 0%, #4c1d95 100%);
  color: #fff;
  cursor: pointer;
  z-index: 60;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 18px 30px -10px rgba(76, 29, 149, 0.55),
    0 0 0 4px rgba(255, 255, 255, 0.55);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  -webkit-tap-highlight-color: transparent;
}
.chatbot-fab:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow:
    0 24px 40px -10px rgba(76, 29, 149, 0.7),
    0 0 0 4px rgba(255, 255, 255, 0.55);
}
.chatbot-fab:active { transform: scale(0.96); }
.chatbot-fab .fab-icon {
  position: absolute;
  transition: transform 0.3s cubic-bezier(.4,0,.2,1), opacity 0.25s ease;
}
.chatbot-fab .fab-icon-close { transform: rotate(-90deg) scale(0.4); opacity: 0; }
.chatbot-fab.is-open .fab-icon-open { transform: rotate(90deg) scale(0.4); opacity: 0; }
.chatbot-fab.is-open .fab-icon-close { transform: rotate(0deg) scale(1); opacity: 1; }

.chatbot-notif {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 12px;
  height: 12px;
  border-radius: 9999px;
  background: #ef4444;
  border: 2px solid #fff;
  animation: chat-pulse-dot 2s ease-in-out infinite;
}
@keyframes chat-pulse-dot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5); }
  50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}
.chatbot-fab.is-open .chatbot-notif,
.chatbot-fab.is-seen .chatbot-notif { display: none; }

.chatbot-panel {
  position: fixed;
  bottom: 6.5rem;
  right: 1.5rem;
  width: min(380px, calc(100vw - 2rem));
  height: min(620px, calc(100vh - 9rem));
  background: #fff;
  border-radius: 1.25rem;
  border: 1px solid rgba(124, 58, 237, 0.12);
  box-shadow:
    0 35px 60px -20px rgba(76, 29, 149, 0.4),
    0 12px 24px -10px rgba(76, 29, 149, 0.2);
  z-index: 70;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(20px) scale(0.97);
  pointer-events: none;
  transition:
    opacity 0.28s cubic-bezier(.2,.7,.2,1),
    transform 0.28s cubic-bezier(.2,.7,.2,1);
  overflow: hidden;
}
.chatbot-panel.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

@media (max-width: 520px) {
  .chatbot-fab { width: 56px; height: 56px; bottom: 1rem; right: 1rem; }
  .chatbot-panel {
    bottom: 0.75rem;
    right: 0.75rem;
    left: 0.75rem;
    width: auto;
    height: min(80vh, 620px);
  }
}

/* Header */
.chat-header {
  position: relative;
  padding: 0.95rem 1.1rem;
  background: linear-gradient(135deg, #4c1d95 0%, #6d28d9 60%, #8b5cf6 100%);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  overflow: hidden;
}
.chat-header::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.07) 1px, transparent 1px);
  background-size: 18px 18px;
  -webkit-mask-image: radial-gradient(circle at 0% 100%, #000 0%, transparent 70%);
          mask-image: radial-gradient(circle at 0% 100%, #000 0%, transparent 70%);
  opacity: 0.5;
  pointer-events: none;
}
.chat-header > * { position: relative; z-index: 1; }

.chat-avatar-lg {
  width: 38px;
  height: 38px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.chat-title-block { line-height: 1.15; }
.chat-title { font-weight: 600; font-size: 0.95rem; }
.chat-subtitle {
  font-size: 0.7rem;
  opacity: 0.9;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  margin-top: 2px;
}
.chat-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 9999px;
  background: #34d399;
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.3);
}

.chat-header-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.chat-icon-btn {
  background: rgba(255, 255, 255, 0.15);
  border: 0;
  color: #fff;
  width: 30px;
  height: 30px;
  border-radius: 9999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}
.chat-icon-btn:hover { background: rgba(255, 255, 255, 0.28); }

/* Body */
.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.1rem;
  background: linear-gradient(180deg, #faf9ff 0%, #ffffff 70%);
  scroll-behavior: smooth;
}
.chat-body::-webkit-scrollbar { width: 6px; }
.chat-body::-webkit-scrollbar-thumb { background: rgba(124, 58, 237, 0.2); border-radius: 999px; }

/* Welcome screen */
.chat-welcome { text-align: center; padding: 0.5rem 0 0.25rem; }
.chat-welcome-avatar {
  width: 48px;
  height: 48px;
  border-radius: 9999px;
  background: linear-gradient(135deg, #a78bfa, #4c1d95);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  margin: 0 auto 0.6rem;
  box-shadow: 0 8px 18px -6px rgba(76, 29, 149, 0.5);
}
.chat-welcome h4 {
  font-weight: 600;
  font-size: 1rem;
  color: var(--ink-900);
}
.chat-welcome p {
  font-size: 0.825rem;
  color: var(--ink-500);
  margin-top: 0.25rem;
}
.chat-section-label {
  text-align: left;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-500);
  margin: 1rem 0 0.5rem;
}
.topic-chips {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.topic-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 0.75rem;
  border-radius: 0.85rem;
  background: #fff;
  border: 1px solid rgba(124, 58, 237, 0.18);
  color: var(--ink-700);
  font-size: 0.8125rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: all 0.18s ease;
  line-height: 1.25;
}
.topic-chip:hover {
  border-color: var(--brand-400);
  background: var(--brand-50);
  color: var(--brand-800);
  transform: translateY(-1px);
  box-shadow: 0 8px 16px -10px rgba(76, 29, 149, 0.3);
}
.topic-chip svg { color: var(--brand-600); flex-shrink: 0; }

/* Messages */
.chat-message {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  animation: chat-msg-in 0.32s ease both;
}
@keyframes chat-msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.chat-message.user { justify-content: flex-end; }
.chat-bubble {
  max-width: 80%;
  padding: 0.6rem 0.85rem;
  border-radius: 1rem;
  font-size: 0.875rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.chat-message.bot .chat-bubble {
  background: #fff;
  border: 1px solid rgba(124, 58, 237, 0.12);
  color: var(--ink-700);
  border-top-left-radius: 6px;
  box-shadow: 0 4px 14px -8px rgba(76, 29, 149, 0.18);
}
.chat-message.user .chat-bubble {
  background: linear-gradient(135deg, #6d28d9, #4c1d95);
  color: #fff;
  border-top-right-radius: 6px;
}
.chat-message .caret {
  display: inline-block;
  width: 2px;
  height: 0.85em;
  background: var(--brand-600);
  margin-left: 2px;
  vertical-align: middle;
  animation: chat-caret 1s steps(2, end) infinite;
}
@keyframes chat-caret { 0%, 50% { opacity: 1; } 51%, 100% { opacity: 0; } }
.chat-bot-avatar {
  width: 28px;
  height: 28px;
  border-radius: 9999px;
  background: linear-gradient(135deg, #a78bfa, #6d28d9);
  color: #fff;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
}

/* Typing indicator */
.chat-typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.6rem 0.85rem;
}
.chat-typing span {
  width: 6px;
  height: 6px;
  border-radius: 9999px;
  background: var(--brand-400);
  animation: chat-bounce 1.2s infinite ease-in-out;
}
.chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.chat-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes chat-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.45; }
  40% { transform: translateY(-4px); opacity: 1; }
}

/* Input */
.chat-input-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 0.75rem;
  border-top: 1px solid rgba(124, 58, 237, 0.1);
  background: #fff;
}
.chat-input {
  flex: 1;
  border: 1px solid rgba(124, 58, 237, 0.2);
  background: #fafaff;
  border-radius: 9999px;
  padding: 0.6rem 1rem;
  font-size: 0.875rem;
  color: var(--ink-900);
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.chat-input:focus {
  border-color: var(--brand-400);
  background: #fff;
  box-shadow: 0 0 0 3px var(--ring);
}
.chat-input::placeholder { color: var(--ink-500); }

.chat-send {
  width: 38px;
  height: 38px;
  border-radius: 9999px;
  border: 0;
  background: linear-gradient(135deg, #6d28d9, #4c1d95);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  box-shadow: 0 10px 22px -10px rgba(76, 29, 149, 0.55);
}
.chat-send:hover { transform: translateY(-1px) scale(1.04); }
.chat-send:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.chat-footer-note {
  text-align: center;
  font-size: 0.6875rem;
  color: var(--ink-500);
  padding: 0.35rem 0.75rem 0.55rem;
  background: #fff;
}
.chat-footer-note .text-gradient { font-weight: 600; }
