/* ==========================================================================
   Crystal FoodTech & FlowNexa AI Platform — CSS Stylesheet
   Color Tokens, Responsive Layouts, Dynamic Dark/Light Modes & Chat Drawer UI
   ========================================================================== */

:root {
  /* Brand Color Tokens (Crystal FoodTech & FlowNexa) */
  --cft-blue: #0f4c81;
  --cft-blue-hover: #0c3e6a;
  --cft-blue-light: #eef6fc;
  --cft-orange: #ea8c33;
  --cft-orange-hover: #d97b22;
  --cft-orange-light: #fff6ed;
  
  --bg-page: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #ffffff;
  --bg-topbar: #0a1f33;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --border-color: #e2e8f0;
  
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 14px rgba(15, 76, 129, 0.08);
  --shadow-lg: 0 12px 32px rgba(15, 76, 129, 0.12);
  --shadow-drawer: 0 20px 50px rgba(10, 31, 51, 0.25);
  
  --brand-gradient: linear-gradient(135deg, var(--cft-blue) 0%, #1b6ca8 100%);
  --orange-gradient: linear-gradient(135deg, var(--cft-orange) 0%, #f59e0b 100%);
}

[data-theme="dark"] {
  --bg-page: #0b131e;
  --bg-surface: #132030;
  --bg-surface-elevated: #1a2b40;
  --bg-topbar: #060c14;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-light: #64748b;
  --border-color: #243447;
  
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 14px rgba(0,0,0,0.4);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.5);
  --shadow-drawer: 0 25px 60px rgba(0,0,0,0.7);
}

/* Base Resets & Global Styles */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-family: var(--font-sans);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.6;
}

body {
  overflow-x: hidden;
  min-height: 100vh;
}

a {
  color: var(--cft-blue);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--cft-orange);
}

/* Top Contact Bar */
.top-bar {
  background: var(--bg-topbar);
  color: #cbd5e1;
  font-size: 13px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.top-bar-container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.top-info-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.top-info-item strong {
  color: var(--cft-orange);
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.top-link {
  color: #94a3b8;
  font-weight: 500;
}

.top-link:hover {
  color: #ffffff;
}

.lang-switch {
  display: flex;
  gap: 4px;
  background: rgba(255,255,255,0.1);
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.lang-option {
  padding: 2px 6px;
  border-radius: 4px;
  color: #94a3b8;
}

.lang-option.active {
  background: var(--cft-orange);
  color: #ffffff;
}

/* Site Header & Navbar */
.site-header {
  position: sticky;
  top: 0;
  z-index: 90;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  transition: background 0.3s ease;
}

.header-container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cft-logo-icon {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
}

.cft-logo-icon.small {
  width: 28px;
  height: 28px;
}

.cft-logo-icon svg {
  width: 100%;
  height: 100%;
}

.brand-text-group {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.2px;
  color: var(--cft-blue);
  line-height: 1.2;
}

[data-theme="dark"] .brand-title {
  color: #60a5fa;
}

.brand-subtitle {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--cft-orange);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 24px;
}

.site-nav a {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  padding: 6px 0;
  position: relative;
}

.site-nav a:hover {
  color: var(--cft-blue);
}

[data-theme="dark"] .site-nav a:hover {
  color: #60a5fa;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Theme Toggle Button */
.theme-toggle {
  background: var(--bg-page);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.theme-toggle:hover {
  background: var(--border-color);
}

[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="light"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: block; }

/* Buttons */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
}

.button-primary {
  background: var(--orange-gradient);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(234, 140, 51, 0.3);
}

.button-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(234, 140, 51, 0.45);
  color: #ffffff;
}

.button-secondary {
  background: var(--cft-blue-light);
  color: var(--cft-blue);
  border: 1px solid rgba(15, 76, 129, 0.2);
}

.button-secondary:hover {
  background: var(--cft-blue);
  color: #ffffff;
}

.button-small {
  padding: 8px 14px;
  font-size: 13px;
}

/* Hero Section */
.hero {
  position: relative;
  padding: 60px 0 80px;
  background: linear-gradient(180deg, var(--bg-surface) 0%, var(--bg-page) 100%);
  border-bottom: 1px solid var(--border-color);
}

.hero-container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 40px;
  align-items: center;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: var(--cft-orange-light);
  border: 1px solid rgba(234, 140, 51, 0.2);
  color: var(--cft-orange);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 16px;
}

.pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cft-orange);
  box-shadow: 0 0 8px var(--cft-orange);
}

.hero-copy h1 {
  font-size: 42px;
  font-weight: 800;
  line-height: 1.15;
  color: var(--text-main);
  margin-bottom: 18px;
  letter-spacing: -0.5px;
}

.gradient-text {
  background: linear-gradient(135deg, var(--cft-blue) 0%, var(--cft-orange) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-copy .intro {
  font-size: 16px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 28px;
}

.hero-actions {
  display: flex;
  gap: 14px;
  margin-bottom: 24px;
}

.hero-points {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

/* Assistant Window Mockup */
.assistant-window {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.window-bar {
  background: var(--cft-blue);
  color: #ffffff;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.window-dots {
  display: flex;
  gap: 6px;
}

.window-dots i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
}

.window-bar p {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.window-content {
  padding: 20px;
}

.content-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: var(--cft-orange);
  background: var(--cft-orange-light);
  padding: 4px 8px;
  border-radius: 4px;
  margin-bottom: 14px;
}

.window-message {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  margin-bottom: 12px;
}

.user-demo {
  background: var(--cft-blue-light);
  color: var(--cft-blue);
  font-weight: 600;
  border: 1px solid rgba(15, 76, 129, 0.15);
}

.route-pipeline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 14px 0;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}

.route-step {
  background: var(--bg-page);
  padding: 4px 10px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.route-line {
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

.bot-demo {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.bot-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--cft-blue);
  margin-bottom: 6px;
}

.bot-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
}

.bot-demo small {
  display: block;
  font-size: 11px;
  color: var(--text-light);
  margin-top: 8px;
}

.window-open-btn {
  width: 100%;
  margin-top: 12px;
  padding: 10px;
  background: var(--orange-gradient);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.window-open-btn:hover {
  opacity: 0.92;
}

/* Trust Strip */
.trust-strip {
  background: var(--cft-blue);
  color: #ffffff;
  padding: 24px 0;
}

.trust-container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.trust-strip p {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: rgba(255,255,255,0.7);
}

.trust-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
}

.trust-tags span {
  background: rgba(255,255,255,0.12);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}

/* Section Shared Layouts */
.section {
  padding: 70px 0;
}

.section-container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
}

.eyebrow {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1.2px;
  color: var(--cft-orange);
  margin-bottom: 8px;
}

.section-header h2 {
  font-size: 32px;
  font-weight: 800;
  line-height: 1.2;
  color: var(--text-main);
  margin-bottom: 12px;
}

.section-desc {
  max-width: 680px;
  margin: 0 auto 36px;
  color: var(--text-muted);
  font-size: 15px;
}

.text-center {
  text-align: center;
}

/* About Section */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: center;
}

.body-copy {
  font-size: 15px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.about-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 24px;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 16px;
  border-radius: var(--radius-md);
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.stat-num {
  display: block;
  font-size: 26px;
  font-weight: 800;
  color: var(--cft-blue);
}

[data-theme="dark"] .stat-num {
  color: #60a5fa;
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.about-image-card {
  background: var(--brand-gradient);
  color: #ffffff;
  padding: 36px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  position: relative;
}

.about-card-badge {
  display: inline-block;
  background: var(--cft-orange);
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 4px;
  margin-bottom: 16px;
}

.about-card-content h3 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 12px;
}

.about-card-content p {
  font-size: 14px;
  color: rgba(255,255,255,0.88);
  margin-bottom: 18px;
}

.check-list {
  list-style: none;
  font-size: 13.5px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.check-list li::before {
  content: "✓ ";
  color: var(--cft-orange);
  font-weight: 800;
}

/* Product Cards Grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 20px;
  margin-top: 30px;
}

.product-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: all 0.25s ease;
  box-shadow: var(--shadow-sm);
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--cft-blue);
}

.product-card.highlighted {
  border: 2px solid var(--cft-orange);
  background: linear-gradient(180deg, var(--cft-orange-light) 0%, var(--bg-surface) 100%);
}

[data-theme="dark"] .product-card.highlighted {
  background: linear-gradient(180deg, rgba(234, 140, 51, 0.15) 0%, var(--bg-surface) 100%);
}

.product-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--bg-page);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

.product-badge.featured {
  background: var(--cft-orange);
  color: #ffffff;
  border: none;
}

.product-number {
  font-size: 14px;
  font-weight: 800;
  color: var(--cft-blue);
  margin-bottom: 8px;
}

[data-theme="dark"] .product-number {
  color: #60a5fa;
}

.product-card h3 {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 10px;
  color: var(--text-main);
}

.product-card p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  flex: 1;
  margin-bottom: 16px;
}

.product-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px dashed var(--border-color);
}

.badge-tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-light);
}

.chip-query-btn {
  background: transparent;
  border: none;
  color: var(--cft-blue);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.chip-query-btn:hover {
  color: var(--cft-orange);
}

/* Why Choose Us Grid */
.why-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 36px;
}

.why-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 30px 24px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease;
}

.why-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.why-icon {
  font-size: 32px;
  margin-bottom: 14px;
}

.why-card h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--cft-blue);
}

[data-theme="dark"] .why-card h3 {
  color: #60a5fa;
}

.why-card p {
  font-size: 14px;
  color: var(--text-muted);
}

/* Affiliates Grid */
.affiliates-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 30px;
}

.affiliate-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 24px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.affiliate-card .flag {
  font-size: 28px;
  display: block;
  margin-bottom: 10px;
}

.affiliate-card h4 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-main);
}

.affiliate-card p {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.affiliate-link {
  font-size: 12px;
  font-weight: 700;
}

/* News Section */
.news-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 30px;
}

.news-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 24px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.news-date {
  font-size: 11px;
  font-weight: 800;
  color: var(--cft-orange);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.news-card h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text-main);
  line-height: 1.35;
}

.news-card p {
  font-size: 13px;
  color: var(--text-muted);
  flex: 1;
  margin-bottom: 14px;
}

.read-more {
  font-size: 12px;
  font-weight: 700;
}

/* Sample Request CTA */
.sample-cta-box {
  background: var(--brand-gradient);
  color: #ffffff;
  padding: 48px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.sample-cta-box .eyebrow {
  color: var(--cft-orange);
}

.sample-cta-box h2 {
  font-size: 30px;
  font-weight: 800;
  margin-bottom: 12px;
}

.sample-cta-box p {
  max-width: 640px;
  margin: 0 auto 24px;
  font-size: 15px;
  color: rgba(255,255,255,0.9);
}

.cta-button-group {
  display: flex;
  justify-content: center;
  gap: 16px;
}

.light-btn {
  background: var(--cft-orange);
  color: #ffffff;
}

.light-outline {
  background: transparent;
  color: #ffffff;
  border: 1px solid rgba(255,255,255,0.4);
}

.light-outline:hover {
  background: rgba(255,255,255,0.15);
}

/* Official Footer */
.site-footer {
  background: #060e18;
  color: #94a3b8;
  padding-top: 60px;
  border-top: 1px solid #1e293b;
}

.footer-container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px 40px;
  display: grid;
  grid-template-columns: 1.2fr 1fr 0.8fr 0.8fr;
  gap: 40px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.footer-brand-title {
  font-size: 16px;
  font-weight: 800;
  color: #ffffff;
}

.footer-company-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--cft-orange);
  margin-bottom: 10px;
}

.footer-desc {
  font-size: 13px;
  line-height: 1.5;
}

.footer-col h4 {
  font-size: 14px;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 16px;
  letter-spacing: 0.5px;
}

.footer-contact-list, .footer-links {
  list-style: none;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-contact-list a, .footer-links a {
  color: #94a3b8;
}

.footer-contact-list a:hover, .footer-links a:hover {
  color: #ffffff;
}

.footer-bottom {
  background: #03070d;
  padding: 18px 0;
  border-top: 1px solid rgba(255,255,255,0.05);
  font-size: 12px;
}

.footer-bottom-container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-bottom-links {
  display: flex;
  gap: 10px;
}

/* ==========================================================================
   WIDER & EXPANDABLE AI CHAT PANEL (REQ 2)
   ========================================================================== */

/* Floating FAB Trigger */
.chat-launcher {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 99;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border: none;
  border-radius: var(--radius-full);
  background: var(--orange-gradient);
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(234, 140, 51, 0.4);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.chat-launcher:hover {
  transform: scale(1.04) translateY(-2px);
  box-shadow: 0 14px 32px rgba(234, 140, 51, 0.55);
}

.chat-launcher-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.chat-launcher-badge {
  position: absolute;
  top: -4px;
  right: -6px;
  background: #ffffff;
  color: var(--cft-orange);
  font-size: 9px;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 6px;
}

/* Backdrop Overlay for Expanded Chat Mode */
.chat-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(10, 20, 30, 0.6);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.chat-backdrop.is-active {
  opacity: 1;
  pointer-events: auto;
}

/* Chat Drawer Panel */
.chat-panel {
  position: fixed;
  z-index: 101;
  right: 24px;
  bottom: 24px;
  /* EXPANDED DEFAULT WIDTH: 640px instead of narrow 380px/540px */
  width: min(640px, calc(100vw - 32px));
  height: min(780px, calc(100vh - 48px));
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-drawer);
  transform: translateY(20px) scale(0.96);
  transform-origin: bottom right;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), 
              opacity 0.25s ease,
              width 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              height 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.chat-panel.is-open {
  transform: none;
  opacity: 1;
  pointer-events: auto;
}

/* EXPANDED MODAL MODE (When Maximize button is toggled) */
.chat-panel.is-expanded {
  right: auto;
  bottom: auto;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) !important;
  width: min(1080px, calc(100vw - 40px));
  height: min(880px, calc(100vh - 40px));
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
}

/* Chat Header */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--brand-gradient);
  color: #ffffff;
  border-top-left-radius: calc(var(--radius-lg) - 1px);
  border-top-right-radius: calc(var(--radius-lg) - 1px);
  flex-shrink: 0;
}

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

.chat-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-indicator {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

.chat-header strong {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.2px;
}

.chat-header small {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.85);
  margin-top: 2px;
}

.chat-header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-expand-btn, .close-chat {
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease;
  font-size: 20px;
}

.chat-expand-btn:hover, .close-chat:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Scrollable Messages Area */
.chat-messages {
  flex: 1;
  padding: 22px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--bg-page);
  scrollbar-width: thin;
}

.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

/* Chat Message Bubbles */
.message {
  max-width: 92%;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 14.5px;
  line-height: 1.6;
  word-break: break-word;
}

.message.bot {
  align-self: flex-start;
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.bot-msg-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--cft-blue);
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 4px;
}

[data-theme="dark"] .bot-msg-header {
  color: #60a5fa;
}

.message.user {
  align-self: flex-end;
  background: var(--orange-gradient);
  color: #ffffff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 12px rgba(234, 140, 51, 0.25);
}

.message.pending {
  opacity: 0.85;
}

.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 0;
}

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

[data-theme="dark"] .typing-indicator .dot {
  background: #60a5fa;
}

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

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

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

/* Funnel Suggestion Chips */
.chat-funnel-chips {
  display: flex;
  gap: 8px;
  padding: 12px 18px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  overflow-x: auto;
  flex-shrink: 0;
  scrollbar-width: thin;
}

.chat-panel.is-expanded .chat-funnel-chips {
  flex-wrap: wrap;
  overflow-x: visible;
}

.funnel-chip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--cft-blue);
  background: var(--cft-blue-light);
  border: 1px solid rgba(15, 76, 129, 0.15);
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

[data-theme="dark"] .funnel-chip {
  color: #60a5fa;
  background: rgba(96, 165, 250, 0.1);
  border-color: rgba(96, 165, 250, 0.2);
}

.funnel-chip:hover {
  background: var(--cft-orange);
  color: #ffffff;
  border-color: var(--cft-orange);
  transform: translateY(-1px);
}

/* Chat Input Form */
.chat-form {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  border-bottom-left-radius: calc(var(--radius-lg) - 1px);
  border-bottom-right-radius: calc(var(--radius-lg) - 1px);
  flex-shrink: 0;
}

.chat-form input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-page);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease;
}

.chat-form input:focus {
  border-color: var(--cft-blue);
}

.chat-form button {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--orange-gradient);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.chat-form button:hover {
  transform: scale(1.05);
}

/* Embedded Lead Form Card inside Chat */
.embedded-lead-card {
  background: var(--bg-surface-elevated) !important;
  border: 1.5px solid var(--cft-orange) !important;
  padding: 16px !important;
  box-shadow: 0 6px 18px rgba(234, 140, 51, 0.15) !important;
}

.lead-form-inline {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.form-group-inline {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group-inline label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-main);
}

.form-group-inline input, .form-group-inline select {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-page);
  color: var(--text-main);
  font-size: 13px;
  outline: none;
}

.form-group-inline input:focus, .form-group-inline select:focus {
  border-color: var(--cft-blue);
}

.submit-lead-btn {
  margin-top: 6px;
  padding: 10px;
  background: var(--orange-gradient);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.submit-lead-btn:hover {
  opacity: 0.92;
}

.chat-note {
  font-size: 11px;
  color: var(--text-light);
  text-align: center;
  padding: 6px 0 10px;
  background: var(--bg-surface);
  margin: 0;
}

/* Media Queries for Mobile Responsiveness */
@media (max-width: 992px) {
  .hero-container, .about-grid {
    grid-template-columns: 1fr;
  }
  
  .why-grid, .affiliates-grid, .news-grid, .footer-container {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .site-nav { display: none; }
  .why-grid, .affiliates-grid, .news-grid, .footer-container {
    grid-template-columns: 1fr;
  }
  
  .chat-panel {
    right: 10px;
    bottom: 10px;
    width: calc(100vw - 20px);
    height: calc(100vh - 20px);
  }
  
  .chat-panel.is-expanded {
    width: calc(100vw - 16px);
    height: calc(100vh - 16px);
  }
}
