/* ========= Base Variables (Light mode) ========= */
:root {
  /* Colors */
  --white: #ffffff;
  --black: #0f172a;
  --accent: #2b63b7;
  --accent-bright: #3a7aff;
  --accent-soft: rgba(43, 99, 183, 0.09);

  /* Semantic backgrounds */
  --page-bg: #eef3f8;
  --panel-bg: #fbfdff;
  --card-bg: #ffffff;

  /* Sidebar gradient */
  --sidebar-top: #2b63b7;
  --sidebar-bottom: #1f4b99;

  /* Feedback */
  --muted: #6b7280;
  --success: #16a34a;
  --warning: #f59e0b;
  --danger: #ef4444;

  /* Borders */
  --border: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.12);

  /* Chat / badges */
  --bg-chat-user: #e8f2ff;
  --bg-chat-bot: #e9fbe8;

  /* Typography & layout */
  --base-font: 16px;
  --font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --h1: 1.5rem;
  --h2: 1.125rem;
  --text: 0.9375rem;

  /* Spacing */
  --xs: .4rem;
  --sm: .75rem;
  --md: 1.25rem;
  --lg: 1.75rem;

  /* Sizing */
  --sidebar-width: 250px;
  --radius-lg: 14px;
  --radius-sm: 10px;
  --radius-xs: 8px;

  /* Shadow hierarchy */
  --shadow-1: 0 1px 6px rgba(15, 23, 42, 0.04);
  --shadow-2: 0 6px 18px rgba(15, 23, 42, 0.06);
  --shadow-3: 0 12px 30px rgba(15, 23, 42, 0.08);

  /* Motion */
  --ease: cubic-bezier(.2, .9, .2, 1);
  --fast: 150ms;
  --normal: 250ms;

  /* Utility */
  --z-top: 1000;
  --z-chat: 1051;
}

/* ========= Global Resets ========= */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  background: var(--page-bg);
  font-family: var(--font-family);
  font-size: var(--text);
  color: var(--black);
  margin: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background var(--normal) var(--ease), color var(--normal) var(--ease);
}

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

img {
  max-width: 100%;
  display: block;
}

:focus {
  outline: none;
}

:focus-visible {
  outline: 3px solid rgba(43, 99, 183, 0.25);
  outline-offset: 2px;
}




/* Buttons & Inputs */


.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem .75rem;
  border-radius: 10px;
  border: 1px solid transparent;
  color: inherit;
  cursor: pointer;
  transition: box-shadow var(--fast) var(--ease), transform var(--fast) var(--ease), background var(--fast) var(--ease);
}


.btn-primary {
  background: linear-gradient(90deg, var(--accent), var(--accent-bright));
  color: var(--white);
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(43, 99, 183, 0.12);
}

.btn:active {
  transform: translateY(1px);
}


/* ========= Chat Preview ========= */

.chat-row {
  display: flex;
  gap: .5rem;
}


.chat-bubble {
  max-width: 855rem .85rem;
  padding: .55rem .85rem;
  border-radius: var(--radius-sm);
  background: var(--bg-chat-bot);
  font-size: 0.9rem;
  box-shadow: var(--shadow-1);
}

.user-message .chat-bubble {
  background: var(--bg-chat-user);
}

/* Utility helpers */
.text-muted {
  color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}

/* ========= Floating Chat ========= */
/* Toggle styles moved to be near chatbot-window for better context */

/* Chatbot Window */
.chatbot-window {
  width: 400px;
  height: 40rem;
  position: fixed;
  bottom: 30px;
  right: 25px;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: var(--z-chat);
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), visibility 0.3s;
}

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

.chat-toggle {
  position: fixed;
  bottom: 25px;
  right: 25px;
  width: 60px;
  height: 60px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  cursor: pointer;
  z-index: var(--z-chat);
  font-size: 1.5rem;
  box-shadow: var(--shadow-2);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
  animation: bounce 2s infinite;
}

.chat-toggle.hidden {
  transform: scale(0) rotate(90deg);
  opacity: 0;
  pointer-events: none;
  animation: none;
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-5px);
  }
}

.chatbot-header {
  background: linear-gradient(90deg, var(--accent), var(--accent-bright));
  color: var(--white);
  padding: var(--sm) var(--md);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
}


.chatbot-messages {
  flex: 1;
  padding: var(--sm);
  display: flex;
  flex-direction: column;
  gap: var(--xs);
  overflow-y: auto;
  background: var(--panel-bg);
}

.user-message {
  flex-direction: row;
}

.bot-message {
  flex-direction: row-reverse;
}

.chatbot-input {
  display: flex;
  border-top: 1px solid var(--border);
  padding: .5rem;
  background: var(--card-bg);
}

.chatbot-input input {
  flex: 1;
  padding: .5rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.chatbot-input button {
  margin-left: .5rem;
  background: var(--accent);
  color: var(--white);
  border: none;
  border-radius: var(--radius-sm);
  padding: 0 .75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chatbot-input button:hover {
  filter: brightness(.95);
}

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

.chatbot-messages::-webkit-scrollbar-thumb {
  background: var(--accent-soft);
  border-radius: 3px;
}

@media(max-width:480px) {
  .chatbot-window {
    width: 92%;
    bottom: 80px;
    right: 4%;
  }

  .chat-toggle {
    bottom: 18px;
    right: 18px;
  }
}

/* Chatbot Dark Mode (Scoped) */
.chatbot-window.dark-mode {
  --panel-bg: #0f172a;
  --card-bg: #1e293b;
  --border: rgba(255, 255, 255, 0.1);
  --bg-chat-user: #334155;
  --bg-chat-bot: #1e293b;
  color: #f1f5f9;
}

.chatbot-window.dark-mode .chatbot-messages {
  background: var(--panel-bg);
}

.chatbot-window.dark-mode .chatbot-input {
  background: var(--card-bg);
  border-top-color: var(--border);
}

.chatbot-window.dark-mode .chatbot-input input {
  background: #334155;
  border-color: var(--border);
  color: #fff;
}

.chatbot-window.dark-mode .chat-bubble {
  color: #f1f5f9;
}

.chatbot-window.dark-mode .user-message .chat-bubble {
  background: var(--bg-chat-user);
}

.chatbot-window.dark-mode .bot-message .chat-bubble {
  background: var(--bg-chat-bot);
  border: 1px solid var(--border);
}

.chatbot-window.dark-mode .text-muted {
  color: #94a3b8 !important;
}

/* Suggestions */
.chatbot-window.dark-mode .chat-suggestions button {
  background: #334155;
  border-color: #475569;
  color: #e2e8f0;
}
.chatbot-window.dark-mode .chat-suggestions button:hover {
  background: #475569;
}

/* Header Action Buttons */
.chatbot-header button {
  opacity: 0.8;
  transition: opacity 0.2s;
}
.chatbot-header button:hover {
  opacity: 1;
}

.chat-suggestions button {
  margin-bottom: .5rem;
}

/* Lead capture card */
.lead-card .chat-bubble {
  width: 100%;
  background: var(--card-bg);
  border: 1px solid var(--border-strong);
}

.lead-card {
  flex-direction: row;
}

.lead-card-title {
  font-weight: 600;
  margin-bottom: .6rem;
}

.lead-form {
  display: flex;
  flex-direction: column;
  gap: .65rem;
}

.lead-field label {
  display: block;
  font-size: .8rem;
  color: var(--muted);
  margin-bottom: .25rem;
}

.lead-field input,
.lead-field select {
  width: 100%;
  padding: .5rem .65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--white);
}

.lead-form .lead-submit {
  width: 100%;
}

.field-error {
  min-height: 1rem;
  font-size: .75rem;
  color: var(--danger);
}

.chatbot-window.dark-mode .lead-card .chat-bubble {
  background: var(--card-bg);
  border-color: var(--border);
}

.chatbot-window.dark-mode .lead-field input,
.chatbot-window.dark-mode .lead-field select {
  background: #334155;
  border-color: var(--border);
  color: #fff;
}

.lead-consent{display:flex;gap:.5rem;align-items:flex-start;font-size:.8rem;line-height:1.3;margin:.25rem 0 .75rem;cursor:pointer}
.lead-consent input{margin-top:.15rem;flex:0 0 auto}
