:root {
  --primary-color: #2655a9;
  --primary-light: #406fc4;
  --primary-viher: #67c339;

  --bg-color: #ffffff;
  --bg-glass: rgba(250, 251, 252, 0.97);
  --bg-header: rgba(255, 255, 255, 0.85);
  --text-main: #1a1a1a;
  --text-light: #6b6b6b;
  --text-hint: #9a9a9a;

  --input-bg: rgba(245, 246, 248, 0.9);
  --input-border: #e5e7eb;
  --input-focus-bg: rgba(255, 255, 255, 0.98);

  --bubble-bot-bg: #f5f6f8;
  --bubble-bot-shadow: 0 1px 4px rgba(0,0,0,0.04);
  --bubble-user-color: #1a1a1a;

  --menu-bg: rgba(255, 255, 255, 0.98);
  --menu-shadow: 0 8px 32px rgba(0,0,0,0.12);
  --menu-hover: #f3f4f6;

  --cta-gradient: linear-gradient(135deg, #1a3a6a, #2a5298);
  --cta-text: #1a3a6a;

  --shadow-container: 0 16px 48px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
  --radius-container: 20px;
  --radius-bubble: 14px;

  --font-family: 'Montserrat', system-ui, -apple-system, sans-serif;
  --font-header: 'Montserrat', system-ui, -apple-system, sans-serif;
}

[data-theme="dark"] {
  --bg-color: #141416;
  --bg-glass: rgba(20, 20, 22, 0.97);
  --bg-header: rgba(20, 20, 22, 0.9);
  --text-main: #f0f0f0;
  --text-light: #a0a0a0;
  --text-hint: #666666;

  --input-bg: rgba(40, 40, 45, 0.9);
  --input-border: #333336;
  --input-focus-bg: rgba(50, 50, 55, 0.98);

  --bubble-bot-bg: #1e1e22;
  --bubble-bot-shadow: 0 1px 4px rgba(0,0,0,0.15);
  --bubble-user-color: #f0f0f0;

  --menu-bg: rgba(30, 30, 35, 0.98);
  --menu-shadow: 0 8px 32px rgba(0,0,0,0.4);
  --menu-hover: #2a2a30;

  --shadow-container: 0 16px 48px rgba(0,0,0,0.3), 0 2px 8px rgba(0,0,0,0.15);
}

body { font-family: var(--font-family); margin: 0; }

.tauoton-hidden-init { display: none !important; opacity: 0 !important; }

/* ─── LAUNCHER ─── */

.chat-launcher {
  position: fixed; bottom: 24px; right: 24px; width: 58px; height: 58px;
  border-radius: 50%; border: none;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 40%, var(--primary-color) 60%, var(--primary-light) 100%);
  background-size: 300% 300%;
  animation: shimmer 6s ease-in-out infinite, heartbeat 5s infinite ease-in-out;
  box-shadow: 0 4px 16px rgba(38, 85, 169, 0.35);
  cursor: pointer; z-index: 2147483647;
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.2s;
}
.chat-launcher:hover { opacity: 0.9; }
.chat-launcher.is-active { animation: shimmer 6s ease-in-out infinite; }

@keyframes shimmer {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
@keyframes heartbeat {
  0% { transform: scale(1); }
  5% { transform: scale(1.06); }
  7% { transform: scale(1); }
  10% { transform: scale(1.06); }
  12% { transform: scale(1); }
  100% { transform: scale(1); }
}

.launcher-icon { width: 26px; height: 26px; stroke: white; fill: none; transition: opacity 0.2s; position: absolute; }
.icon-chat { opacity: 1; }
.icon-close { opacity: 0; }
.chat-launcher.is-active .icon-chat { opacity: 0; }
.chat-launcher.is-active .icon-close { opacity: 1; }

/* ─── ARROW ─── */

.tauoton-arrow-btn {
  position: fixed; right: 36px; width: 26px; height: 26px;
  bottom: 90px;
  background: var(--primary-color); border-radius: 50%;
  display: none; justify-content: center; align-items: center;
  cursor: pointer; z-index: 2147483648;
  transition: bottom 0.4s cubic-bezier(0.4, 0, 0.2, 1), transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s;
  opacity: 0;
}
.tauoton-arrow-btn:hover { opacity: 0.85 !important; }
.tauoton-arrow-btn.fade-in { opacity: 1; }
.tauoton-arrow-btn.is-open { transform: rotate(180deg); }
.tauoton-arrow-svg { width: 14px; height: 14px; fill: #ffffff; }

/* ─── PROMPTER ─── */

.tauoton-prompter {
  position: fixed; bottom: 94px; right: 20px;
  width: auto; max-width: 280px;
  display: none; flex-direction: column; align-items: flex-end; gap: 10px;
  z-index: 2147483646;
  opacity: 0; transform: translateY(16px);
  transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1), transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}
.tauoton-prompter.visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
.tauoton-prompter.hidden-force { display: none !important; }

.prompter-bubble {
  background: var(--bg-color);
  border-radius: 16px; border-bottom-right-radius: 4px;
  padding: 16px 20px;
  border: 0.5px solid var(--input-border);
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  font-family: var(--font-header); font-size: 14px; font-weight: 400;
  color: var(--text-main); line-height: 1.5;
  width: 100%; max-width: 280px; box-sizing: border-box;
  cursor: pointer;
  transition: opacity 0.2s;
}
.prompter-bubble:hover { opacity: 0.85; }

.prompter-chat-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--bg-color);
  border: 0.5px solid var(--input-border);
  padding: 10px 22px; border-radius: 100px;
  font-family: var(--font-header); font-size: 13px; font-weight: 500;
  color: var(--text-main); cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  transition: opacity 0.2s;
}
.prompter-chat-btn:hover { opacity: 0.85; }

.prompter-status-dot {
  width: 7px; height: 7px; background: #2ecc71; border-radius: 50%;
  position: relative; flex-shrink: 0;
}
.prompter-status-dot::after {
  content: ''; position: absolute; inset: -2px;
  border-radius: 50%; border: 1px solid #2ecc71; opacity: 0;
  animation: pulse 1.5s infinite ease-out;
}
@keyframes pulse { 0% { transform: scale(0.8); opacity: 1; } 100% { transform: scale(2.2); opacity: 0; } }

.prompter-cta {
  width: 100%; max-width: 280px; box-sizing: border-box;
  background: var(--cta-gradient);
  border-radius: 14px; padding: 18px 20px;
  cursor: pointer; position: relative; overflow: hidden;
  box-shadow: 0 4px 16px rgba(26, 58, 106, 0.25);
  transition: opacity 0.2s;
}
.prompter-cta:hover { opacity: 0.92; }
.prompter-cta::before {
  content: ''; position: absolute; top: -30px; right: -20px;
  width: 90px; height: 90px; background: rgba(255,255,255,0.06); border-radius: 50%;
}
.prompter-cta-title { font-family: var(--font-header); font-size: 14px; font-weight: 500; color: #fff; margin-bottom: 3px; }
.prompter-cta-desc { font-size: 11px; color: rgba(255,255,255,0.5); line-height: 1.4; margin-bottom: 14px; }
.prompter-cta-button {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(255,255,255,0.95); color: var(--cta-text);
  padding: 8px 18px; border-radius: 100px;
  font-family: var(--font-header); font-size: 12px; font-weight: 500;
}
.prompter-cta-arrow {
  display: none; font-size: 18px; color: rgba(255,255,255,0.6);
  position: absolute; right: 18px; top: 50%; transform: translateY(-50%);
}

/* ─── CONTAINER ─── */

.chat-container {
  position: fixed; bottom: 100px; right: 24px; width: 420px; height: 620px; max-height: 82vh;
  background: var(--bg-glass); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius-container);
  box-shadow: var(--shadow-container);
  border: 0.5px solid rgba(255,255,255,0.15);
  display: none; flex-direction: column; overflow: hidden;
  z-index: 2147483647;
  opacity: 0; pointer-events: none; transform: translateY(16px) scale(0.98);
  transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.chat-container.active { display: flex; opacity: 1; pointer-events: all; transform: translateY(0) scale(1); }

/* ─── HEADER ─── */

.chat-header {
  padding: 14px 16px 12px;
  display: flex; align-items: center; gap: 8px;
  border-bottom: 0.5px solid var(--input-border);
  background: var(--bg-header); backdrop-filter: blur(10px);
  flex-shrink: 0; position: relative; z-index: 30;
}

.header-back-btn {
  width: 32px; height: 32px; border-radius: 50%; border: none;
  background: transparent; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-light); padding: 0;
  opacity: 0; pointer-events: none; width: 0; overflow: hidden;
  transition: opacity 0.25s, width 0.25s, margin 0.25s;
  margin-right: 0;
}
.header-back-btn.visible { opacity: 1; pointer-events: auto; width: 32px; margin-right: 4px; }
.header-back-btn:hover { opacity: 0.7; }
.header-back-btn svg { width: 20px; height: 20px; }

.header-brand { flex: 1; }
.brand-logo { height: 42px; width: auto; display: block; }

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

.header-status { display: flex; align-items: center; gap: 5px; margin-right: 8px; }
.status-dot {
  width: 6px; height: 6px; background: #2ecc71; border-radius: 50%;
  position: relative; flex-shrink: 0;
}
.status-dot::after {
  content: ''; position: absolute; inset: -2px;
  border-radius: 50%; border: 1px solid #2ecc71; opacity: 0;
  animation: pulse 1.5s infinite ease-out;
}
.status-label { font-size: 10px; color: var(--text-hint); font-family: var(--font-family); }

.header-icon-btn {
  background: transparent; border: none; cursor: pointer;
  padding: 8px; border-radius: 50%; display: flex;
  color: var(--text-hint); transition: opacity 0.2s;
}
.header-icon-btn:hover { opacity: 0.6; }

/* ─── MENU ─── */

.chat-menu {
  position: absolute; top: 56px; right: 16px; width: 220px;
  background: var(--menu-bg); border-radius: 14px;
  box-shadow: var(--menu-shadow); backdrop-filter: blur(12px);
  display: none; flex-direction: column; padding: 6px;
  z-index: 100; border: 0.5px solid var(--input-border);
}
.chat-menu.active { display: flex; animation: menuIn 0.2s ease-out; }
@keyframes menuIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

.menu-item {
  background: transparent; border: none; width: 100%;
  padding: 10px 12px; box-sizing: border-box;
  text-align: left; font-family: var(--font-family); font-size: 13px;
  color: var(--text-main); border-radius: 8px; cursor: pointer;
  display: flex; align-items: center; gap: 10px;
  transition: background 0.15s; font-weight: 400;
}
.menu-item:hover { background: var(--menu-hover); }
.menu-item svg { width: 16px; height: 16px; opacity: 0.5; flex-shrink: 0; }

.switch-row { display: flex; justify-content: space-between; align-items: center; cursor: pointer; }
.switch-label { display: flex; align-items: center; gap: 10px; }
.toggle-switch { position: relative; display: inline-block; width: 34px; height: 20px; pointer-events: none; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; cursor: pointer; inset: 0;
  background: #ccc; transition: .3s; border-radius: 20px;
}
.toggle-slider:before {
  position: absolute; content: ""; height: 14px; width: 14px; left: 3px; bottom: 3px;
  background: white; transition: .3s; border-radius: 50%;
}
input:checked + .toggle-slider { background: var(--primary-color); }
input:checked + .toggle-slider:before { transform: translateX(14px); }

/* ─── VIEWS ─── */

.view-container { flex: 1; position: relative; overflow: hidden; }

.view-section {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  display: flex; flex-direction: column;
  opacity: 0; pointer-events: none; transform: translateX(16px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.view-section.active { opacity: 1; pointer-events: auto; transform: translateX(0); z-index: 1; }

/* ─── WELCOME ─── */

.welcome-screen {
  flex: 1; overflow-y: auto; overflow-x: hidden; padding: 20px 20px 16px;
  display: flex; flex-direction: column;
  transition: opacity 0.3s ease, transform 0.3s ease;
  overscroll-behavior-y: contain;
}
.welcome-screen.hidden { opacity: 0; transform: translateY(-16px); pointer-events: none; position: absolute; }

.welcome-header { margin-bottom: 24px; }
.welcome-title {
  font-family: var(--font-header); font-size: 22px; font-weight: 600;
  color: var(--text-main); line-height: 1.25; margin: 0 0 8px;
}
.welcome-subtitle {
  font-size: 13px; color: var(--text-light); line-height: 1.55; margin: 0;
}

.welcome-cta {
  background: var(--cta-gradient);
  border-radius: 16px; padding: 22px; margin-bottom: 24px;
  cursor: pointer; position: relative; overflow: hidden;
  transition: opacity 0.2s;
}
.welcome-cta:hover { opacity: 0.92; }
.welcome-cta::before {
  content: ''; position: absolute; top: -30px; right: -20px;
  width: 100px; height: 100px; background: rgba(255,255,255,0.06); border-radius: 50%;
}
.welcome-cta-content { position: relative; z-index: 1; }
.welcome-cta-title { font-family: var(--font-header); font-size: 16px; font-weight: 500; color: #fff; margin-bottom: 4px; }
.welcome-cta-desc { font-size: 12px; color: rgba(255,255,255,0.5); line-height: 1.5; margin-bottom: 16px; }
.welcome-cta-btn {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(255,255,255,0.95); color: var(--cta-text);
  padding: 10px 22px; border-radius: 100px;
  font-family: var(--font-header); font-size: 13px; font-weight: 500;
  position: relative; z-index: 1;
}

/* ─── QUICK REPLIES ─── */

.qr-label {
  font-size: 10px; font-weight: 600; color: var(--text-hint);
  text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 8px;
}
.qr-list { display: flex; flex-direction: column; }
.qr-btn {
  background: transparent; color: var(--text-main); border: none;
  border-bottom: 0.5px solid var(--input-border);
  padding: 14px 4px; font-family: var(--font-family); font-size: 13px;
  font-weight: 400; line-height: 1.4; cursor: pointer; text-align: left;
  display: flex; justify-content: space-between; align-items: center;
  transition: color 0.2s, opacity 0.2s;
}
.qr-btn:last-child { border-bottom: none; }
.qr-btn:hover { color: var(--primary-color); }
.qr-arrow { font-size: 14px; color: var(--text-hint); margin-left: 12px; transition: color 0.2s; }
.qr-btn:hover .qr-arrow { color: var(--primary-color); }

/* ─── CHAT ─── */

.chat-messages {
  flex: 1; overflow-y: auto; padding: 20px 20px 12px;
  display: flex; flex-direction: column; gap: 10px;
  scroll-behavior: smooth; overscroll-behavior-y: contain;
  opacity: 0; pointer-events: none; height: 0;
  transition: opacity 0.35s ease;
}
.chat-messages.active { opacity: 1; pointer-events: auto; height: auto; flex: 1; }

.bubble {
  padding: 12px 16px; border-radius: var(--radius-bubble); max-width: 85%;
  font-size: 14px; line-height: 1.6; position: relative; word-wrap: break-word;
}
.bubble.bot {
  align-self: flex-start; background: var(--bubble-bot-bg); color: var(--text-main);
  border-bottom-left-radius: 4px; box-shadow: var(--bubble-bot-shadow);
}
.bubble.user {
  align-self: flex-end; background: transparent; color: var(--bubble-user-color);
  border-bottom-right-radius: 4px; padding-right: 0; text-align: right;
}
.bubble p { margin: 0 0 8px 0; }
.bubble p:last-child { margin-bottom: 0; }
.bubble a { color: inherit; text-decoration: underline; }
.bubble em, .bubble i { font-style: normal; font-weight: 600; }
.bubble.bot h1, .bubble.bot h2, .bubble.bot h3 { margin: 0 0 8px; font-family: var(--font-header); }
.bubble.bot ul, .bubble.bot ol { margin: 8px 0 10px 18px; padding: 0; }
.bubble.bot li { margin: 4px 0; }

.bubble.typing {
  padding: 14px 18px; background: var(--bubble-bot-bg); border-bottom-left-radius: 4px;
  align-self: flex-start; display: flex; align-items: center; gap: 5px;
  width: fit-content; min-height: 20px; box-shadow: var(--bubble-bot-shadow);
}
.typing-dot {
  width: 5px; height: 5px; background: #bbb; border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out both;
}
.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }
@keyframes typingBounce { 0%, 80%, 100% { transform: scale(0); } 40% { transform: scale(1); } }

.action-container { align-self: flex-start; margin-top: -4px; margin-bottom: 4px; }
.tauoton-action-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 20px; border-radius: 100px; border: none;
  font-family: var(--font-header); font-size: 13px; font-weight: 500;
  background: var(--primary-color); color: #fff;
  cursor: pointer; transition: opacity 0.2s;
}
.tauoton-action-btn:hover { opacity: 0.85; }

/* ─── BOTTOM BAR ─── */

.bottom-bar {
  padding: 10px 14px; flex-shrink: 0;
  border-top: 0.5px solid var(--input-border);
  background: var(--bg-color);
}

.chat-input-form { margin: 0; }
.input-pill {
  display: flex; align-items: center;
  background: var(--input-bg); border-radius: 100px;
  padding: 5px 5px 5px 18px;
  border: 0.5px solid var(--input-border);
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.input-pill:focus-within {
  border-color: #acacac; background: var(--input-focus-bg);
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}
.chat-input {
  flex: 1; border: none; background: transparent; padding: 0;
  height: 36px; font-family: var(--font-family); font-size: 16px;
  outline: none; color: var(--text-main);
}
.chat-input::placeholder { color: var(--text-hint); font-size: 14px; }

.send-btn {
  width: 36px; height: 36px; border-radius: 50%; border: none;
  background: transparent; color: var(--primary-color);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s;
}
.send-btn:hover { opacity: 0.7; transform: rotate(25deg); }
.send-btn svg { width: 18px; height: 18px; }

.return-btn {
  display: none; width: 100%;
  align-items: center; justify-content: center; gap: 8px;
  background: var(--input-bg); border: 0.5px solid var(--input-border);
  border-radius: 100px; padding: 13px 18px;
  font-family: var(--font-header); font-size: 14px; font-weight: 500;
  color: var(--primary-color); cursor: pointer;
  transition: opacity 0.2s;
}
.return-btn:hover { opacity: 0.8; }
.return-btn svg { width: 16px; height: 16px; }

/* ─── BOTTOM NAV ─── */

.bottom-nav {
  display: grid; grid-template-columns: repeat(3, 1fr);
  padding: 6px 16px 8px; flex-shrink: 0;
  border-top: 0.5px solid var(--input-border);
  background: var(--bg-color);
}
.nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 0; border: none; background: transparent;
  border-radius: 8px; cursor: pointer;
  color: var(--text-hint); transition: color 0.2s, opacity 0.2s;
  font-family: var(--font-family);
}
.nav-item:hover { opacity: 0.7; }
.nav-item.active { color: var(--text-main); }
.nav-item svg { width: 18px; height: 18px; }
.nav-item span { font-size: 10px; font-weight: 500; }

/* ─── FOOTER ─── */

.global-footer {
  padding: 6px 20px 12px; text-align: center;
  font-size: 9px; color: var(--text-hint); line-height: 1.5;
  flex-shrink: 0; background: var(--bg-color);
}
.global-footer a { color: inherit; text-decoration: none; transition: opacity 0.2s; }
.global-footer a:hover { opacity: 0.7; }
.brand-highlight { font-weight: 600; color: var(--text-light); }
.provider-link { text-decoration: none !important; }

/* ─── MOBILE ─── */

@media (max-width: 480px) {
  .chat-container {
    position: fixed !important;
    top: 4px !important; bottom: 4px !important; left: 4px !important; right: 4px !important;
    width: auto !important; height: auto !important; max-height: none !important;
    border-radius: 16px !important; transform: none !important;
  }
  .chat-launcher.is-active { display: none !important; }
  .chat-launcher { right: 16px; bottom: 20px; width: 52px; height: 52px; }
  .chat-input { font-size: 16px; }

  .tauoton-prompter { right: 12px; bottom: 84px; max-width: 240px; }
  .tauoton-arrow-btn { right: 28px; }

  .prompter-bubble { padding: 14px 16px; font-size: 13px; max-width: 240px; }
  .prompter-chat-btn { padding: 8px 16px; font-size: 12px; }
  .prompter-cta { max-width: 240px; padding: 14px 16px; }
  .prompter-cta-desc { margin-bottom: 0; }
  .prompter-cta-button { display: none; }
  .prompter-cta-arrow { display: block; }

  .welcome-title { font-size: 20px; }

  body.tauoton-no-scroll { position: fixed; width: 100%; overflow: hidden; }
}
