/* =====================================================
   ROOT VARIABLES — reusable design tokens
===================================================== */
:root{
  --color-primary: #0057FF;
  --color-secondary: #00C2FF;
  --color-bg: #F5F7FB;
  --color-white: #FFFFFF;
  --color-text: #1A1F36;
  --color-text-muted: #6B7280;
  --color-border: #E5E9F2;
  --color-error: #E53E3E;
  --color-success: #22C55E;

  --gradient-primary: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);

  --font-heading: 'Poppins', sans-serif;
  --font-body: 'Inter', sans-serif;

  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 999px;

  --shadow-soft: 0 8px 30px rgba(0, 32, 128, 0.10);
  --shadow-card: 0 4px 16px rgba(0, 32, 128, 0.08);
  --shadow-launcher: 0 10px 30px rgba(0, 87, 255, 0.35);

  --transition-fast: 0.2s ease;
  --transition-med: 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

/* =====================================================
   RESET & BASE
===================================================== */
*, *::before, *::after{ box-sizing: border-box; }

html{ scroll-behavior: smooth; }

body{
  margin: 0;
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3{ font-family: var(--font-heading); margin: 0 0 0.5em; }

a{ color: inherit; text-decoration: none; }

button{ font-family: inherit; cursor: pointer; }

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

/* Focus visibility for accessibility */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible{
  outline: 3px solid var(--color-secondary);
  outline-offset: 2px;
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce){
  *{ animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* =====================================================
   DEMO SITE STYLES (behind the chat widget)
===================================================== */
.site-header{
  background: var(--color-white);
  box-shadow: var(--shadow-card);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
}

.logo{
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--color-primary);
}
.logo span{ color: var(--color-secondary); }

.main-nav{ display: flex; gap: 28px; }
.main-nav a{ font-weight: 500; color: var(--color-text); transition: color var(--transition-fast); }
.main-nav a:hover{ color: var(--color-primary); }

.hero{
  text-align: center;
  padding: 100px 24px;
  background: var(--gradient-primary);
  color: var(--color-white);
}
.hero h1{ font-size: clamp(1.8rem, 4vw, 3rem); max-width: 780px; margin-inline: auto 0.6em; }
.hero p{ max-width: 560px; margin: 0 auto 2em; opacity: 0.92; }

.btn-primary{
  background: var(--color-white);
  color: var(--color-primary);
  border: none;
  padding: 14px 32px;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 1rem;
  box-shadow: var(--shadow-soft);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.btn-primary:hover{ transform: translateY(-2px); box-shadow: 0 12px 28px rgba(0,0,0,0.18); }

.services{ padding: 80px 24px; }
.services h2{ text-align: center; font-size: 2rem; margin-bottom: 40px; }

.service-grid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
}

.service-card{
  background: var(--color-white);
  border-radius: var(--radius-md);
  padding: 32px 24px;
  text-align: center;
  box-shadow: var(--shadow-card);
  transition: transform var(--transition-fast);
}
.service-card:hover{ transform: translateY(-6px); }
.service-card i{ font-size: 2rem; color: var(--color-primary); margin-bottom: 14px; }
.service-card h3{ font-size: 1.15rem; }
.service-card p{ color: var(--color-text-muted); font-size: 0.92rem; margin: 0; }

.site-footer{
  background: var(--color-text);
  color: rgba(255,255,255,0.7);
  text-align: center;
  padding: 28px 24px;
  font-size: 0.9rem;
}

/* =====================================================
   FLOATING CHAT LAUNCHER
===================================================== */
.chat-launcher{
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: var(--gradient-primary);
  color: var(--color-white);
  border: none;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-launcher);
  z-index: 1000;
  transition: transform var(--transition-fast);
  animation: launcherPulse 2.4s ease-in-out infinite;
}
.chat-launcher:hover{ transform: scale(1.08); }
.chat-launcher.is-hidden{ transform: scale(0); opacity: 0; pointer-events: none; }

@keyframes launcherPulse{
  0%, 100%{ box-shadow: 0 10px 30px rgba(0, 87, 255, 0.35); }
  50%{ box-shadow: 0 10px 40px rgba(0, 87, 255, 0.55); }
}

.chat-launcher-badge{
  position: absolute;
  top: -2px;
  right: -2px;
  background: var(--color-error);
  color: var(--color-white);
  font-size: 0.7rem;
  font-weight: 700;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--color-white);
}

/* =====================================================
   CHAT WINDOW — Glassmorphism card
===================================================== */
.chat-window{
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: min(640px, calc(100vh - 48px));
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1001;

  /* Closed state */
  opacity: 0;
  transform: translateY(24px) scale(0.96);
  pointer-events: none;
  visibility: hidden;
  transition: opacity var(--transition-med), transform var(--transition-med), visibility var(--transition-med);
}

.chat-window.is-open{
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  visibility: visible;
}

/* Header */
.chat-header{
  background: var(--gradient-primary);
  color: var(--color-white);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.chat-header-info{ display: flex; align-items: center; gap: 12px; }
.chat-avatar{
  width: 40px; height: 40px;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
}
.chat-header h2{ font-size: 1rem; margin: 0; }
.chat-status{ font-size: 0.78rem; opacity: 0.9; display: flex; align-items: center; gap: 6px; }
.status-dot{
  width: 8px; height: 8px; border-radius: 50%;
  background: #4ADE80;
  display: inline-block;
  animation: dotBlink 1.8s ease-in-out infinite;
}
@keyframes dotBlink{ 0%,100%{ opacity: 1; } 50%{ opacity: 0.4; } }

.chat-close-btn{
  background: rgba(255,255,255,0.15);
  border: none;
  color: var(--color-white);
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition-fast);
}
.chat-close-btn:hover{ background: rgba(255,255,255,0.3); }

/* Progress bar */
.chat-progress{
  height: 4px;
  background: var(--color-border);
  flex-shrink: 0;
}
.chat-progress-bar{
  height: 100%;
  width: 14%;
  background: var(--gradient-primary);
  transition: width var(--transition-med);
}
.chat-progress-label{
  font-size: 0.75rem;
  color: var(--color-text-muted);
  text-align: right;
  margin: 6px 18px 0;
  flex-shrink: 0;
}

/* Messages area */
.chat-body{
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}
.chat-body::-webkit-scrollbar{ width: 6px; }
.chat-body::-webkit-scrollbar-thumb{ background: var(--color-border); border-radius: var(--radius-full); }

/* Message bubbles */
.msg{
  max-width: 82%;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  line-height: 1.5;
  animation: slideUpFade 0.35s ease both;
  word-wrap: break-word;
  white-space: pre-line;
}
@keyframes slideUpFade{
  from{ opacity: 0; transform: translateY(10px); }
  to{ opacity: 1; transform: translateY(0); }
}

.msg-bot{
  align-self: flex-start;
  background: var(--color-white);
  color: var(--color-text);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow-card);
}
.msg-user{
  align-self: flex-end;
  background: var(--gradient-primary);
  color: var(--color-white);
  border-bottom-right-radius: 4px;
}

/* Typing indicator */
.msg-typing{
  align-self: flex-start;
  background: var(--color-white);
  box-shadow: var(--shadow-card);
  border-bottom-left-radius: 4px;
  padding: 14px 16px;
  display: flex;
  gap: 4px;
}
.msg-typing span{
  width: 7px; height: 7px;
  background: var(--color-text-muted);
  border-radius: 50%;
  display: inline-block;
  animation: typingBounce 1.2s infinite ease-in-out;
}
.msg-typing span:nth-child(2){ animation-delay: 0.15s; }
.msg-typing span:nth-child(3){ animation-delay: 0.3s; }
@keyframes typingBounce{
  0%, 60%, 100%{ transform: translateY(0); opacity: 0.5; }
  30%{ transform: translateY(-5px); opacity: 1; }
}

/* Quick reply buttons */
.chat-quick-replies{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 18px 12px;
  flex-shrink: 0;
}
.chat-quick-replies:empty{ display: none; }

.quick-reply-btn{
  background: var(--color-white);
  border: 1.5px solid var(--color-primary);
  color: var(--color-primary);
  padding: 9px 16px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 500;
  transition: all var(--transition-fast);
  animation: slideUpFade 0.3s ease both;
}
.quick-reply-btn:hover{
  background: var(--gradient-primary);
  color: var(--color-white);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}
.quick-reply-btn:disabled{ opacity: 0.5; pointer-events: none; }

/* Text input area */
.chat-input-area{
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 12px 14px;
  border-top: 1px solid var(--color-border);
  background: rgba(255,255,255,0.6);
  flex-shrink: 0;
}
.chat-input{
  flex: 1;
  resize: none;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-family: inherit;
  font-size: 0.92rem;
  max-height: 100px;
  transition: border-color var(--transition-fast);
}
.chat-input:focus{ border-color: var(--color-primary); outline: none; }

.chat-send-btn{
  width: 42px; height: 42px;
  border-radius: 50%;
  border: none;
  background: var(--gradient-primary);
  color: var(--color-white);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: transform var(--transition-fast), opacity var(--transition-fast);
}
.chat-send-btn:hover{ transform: scale(1.08); }
.chat-send-btn:disabled{ opacity: 0.5; pointer-events: none; }

/* Hidden state helper */
[hidden]{ display: none !important; }

/* =====================================================
   CONTACT FORM
===================================================== */
.chat-contact-form{
  padding: 16px 18px;
  overflow-y: auto;
  border-top: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: slideUpFade 0.35s ease both;
}
.chat-contact-form h3{ font-size: 0.98rem; margin-bottom: 4px; }

.form-group{ display: flex; flex-direction: column; gap: 4px; }
.form-group label{ font-size: 0.82rem; font-weight: 500; color: var(--color-text); }
.required{ color: var(--color-error); }
.optional{ color: var(--color-text-muted); font-weight: 400; }

.form-group input{
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: inherit;
  font-size: 0.9rem;
  transition: border-color var(--transition-fast);
}
.form-group input:focus{ border-color: var(--color-primary); outline: none; }
.form-group input.is-invalid{ border-color: var(--color-error); }

.form-error{
  font-size: 0.75rem;
  color: var(--color-error);
  min-height: 14px;
}

.honeypot{
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.chat-submit-btn{
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-md);
  margin-top: 4px;
}
.chat-submit-btn:disabled{ opacity: 0.5; cursor: not-allowed; }

/* =====================================================
   STATUS OVERLAY (Sending / Success)
===================================================== */
.chat-status-overlay{
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  animation: fadeIn 0.3s ease both;
}
@keyframes fadeIn{ from{ opacity: 0; } to{ opacity: 1; } }

.status-content{ text-align: center; }
.spinner{
  width: 46px; height: 46px;
  border: 4px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  margin: 0 auto 14px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin{ to{ transform: rotate(360deg); } }

.success-icon{
  font-size: 3rem;
  color: var(--color-success);
  margin-bottom: 10px;
  display: block;
  animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes popIn{
  from{ transform: scale(0); opacity: 0; }
  to{ transform: scale(1); opacity: 1; }
}

.status-content p{ font-weight: 500; color: var(--color-text); margin: 0; }

/* =====================================================
   THANK YOU SCREEN
===================================================== */
.chat-thankyou{
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px;
  gap: 8px;
  animation: fadeIn 0.4s ease both;
}
.thankyou-icon{
  font-size: 3.5rem;
  color: var(--color-success);
  margin-bottom: 8px;
  animation: popIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.chat-thankyou h3{ font-size: 1.3rem; }
.chat-thankyou p{ color: var(--color-text-muted); margin-bottom: 18px; }
.chat-thankyou .btn-primary{
  background: var(--gradient-primary);
  color: var(--color-white);
}

/* =====================================================
   RESPONSIVE — Mobile full-screen chat
===================================================== */
@media (max-width: 480px){
  .chat-window{
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-width: 100vw;
    height: 100dvh;
    border-radius: 0;
  }
  .chat-launcher{ bottom: 16px; right: 16px; }
}

@media (max-width: 600px){
  .header-inner{ flex-direction: column; gap: 10px; padding: 14px; }
  .main-nav{ gap: 18px; }
  .hero{ padding: 70px 20px; }
}

/* Landscape mobile: shrink chat height so it doesn't overflow */
@media (max-height: 480px) and (orientation: landscape){
  .chat-window{ height: 100dvh; }
}