/* ═══════════════════════════════════════════════════════════════════════
   mintbot.css — MintBot Chat Widget
   Matches MintFolder design system (light, --accent: #00D4AA)
   ═══════════════════════════════════════════════════════════════════════ */

/* ── CSS Variables (inherit from b2b-chrome or define fallbacks) ────── */
:root {
  --mb-accent: #00886f;
  --mb-accent-dim: rgba(0,136,111,0.10);
  --mb-accent-glow: rgba(0,136,111,0.28);
  --mb-bg: #f7fbf9;
  --mb-bg2: #ffffff;
  --mb-bg-card: #eef8f4;
  --mb-text: #14231f;
  --mb-text2: rgba(20,35,31,0.76);
  --mb-text3: rgba(20,35,31,0.56);
  --mb-border: rgba(0,128,101,0.12);
  --mb-border2: rgba(0,128,101,0.18);
  --mb-ease: cubic-bezier(0.25,0.46,0.45,0.94);
  --mb-spring: cubic-bezier(0.34,1.56,0.64,1);
  --mb-font: -apple-system, 'SF Pro Text', 'Segoe UI', system-ui, sans-serif;
  --mb-radius: 16px;
  --mb-width: 380px;
  --mb-height: 520px;
}

/* ── Floating Toggle Button ──────────────────────────────────────────── */
#mintbot-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99998;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2px solid var(--mb-accent);
  background: linear-gradient(135deg, #ffffff 0%, #eef8f4 100%);
  color: #00886f;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 12px 32px rgba(15,42,36,0.18),
    0 0 24px var(--mb-accent-dim),
    inset 0 0 0 1px rgba(255,255,255,0.7);
  transition: transform 0.3s var(--mb-spring), box-shadow 0.3s var(--mb-ease), background 0.3s ease, border-color 0.3s ease;
  font-size: 0;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  animation: mintbot-pulse 3s ease-in-out infinite;
}
@keyframes mintbot-pulse {
  0%, 100% { box-shadow: 0 12px 32px rgba(15,42,36,0.18), 0 0 24px var(--mb-accent-dim); }
  50% { box-shadow: 0 16px 40px rgba(15,42,36,0.20), 0 0 40px var(--mb-accent-glow), 0 0 60px rgba(0,212,170,0.08); }
}
#mintbot-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 16px 42px rgba(15,42,36,0.22), 0 0 40px var(--mb-accent-glow);
  animation: none;
}
/* Bot face icon (closed) */
#mintbot-toggle svg.icon-chat {
  width: 32px;
  height: 32px;
  fill: none;
  stroke: #00886f;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: opacity 0.2s ease, transform 0.3s var(--mb-spring);
}
/* X icon (open) */
#mintbot-toggle svg.icon-close {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: #fff;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: opacity 0.2s ease, transform 0.3s var(--mb-spring);
}
#mintbot-toggle[data-open="true"] svg.icon-chat { display: none; }
#mintbot-toggle[data-open="true"] svg.icon-close { display: block; }
#mintbot-toggle[data-open="false"] svg.icon-chat { display: block; }
#mintbot-toggle[data-open="false"] svg.icon-close { display: none; }

/* Open state — solid accent background with white X */
#mintbot-toggle[data-open="true"] {
  background: linear-gradient(135deg, var(--mb-accent) 0%, #0d9488 100%);
  border-color: transparent;
  animation: none;
  box-shadow: 0 4px 24px rgba(0,212,170,0.3), 0 0 30px rgba(0,212,170,0.15);
}
#mintbot-toggle[data-open="true"]:hover {
  transform: scale(1.1) rotate(90deg);
  box-shadow: 0 6px 32px rgba(0,212,170,0.4), 0 0 40px rgba(0,212,170,0.2);
}

/* Notification badge */
#mintbot-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--mb-accent);
  color: var(--mb-bg);
  font-size: 11px;
  font-weight: 700;
  font-family: var(--mb-font);
  display: none;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
#mintbot-badge.show { display: flex; }

/* Tooltip — hidden permanently */
#mintbot-tooltip {
  display: none !important;
}

/* ── Chat Window ─────────────────────────────────────────────────────── */
#mintbot-window {
  position: fixed;
  bottom: 92px;
  right: 24px;
  z-index: 99999;
  width: var(--mb-width);
  height: var(--mb-height);
  max-height: calc(100vh - 120px);
  border-radius: var(--mb-radius);
  border: 1px solid var(--mb-border2);
  background: var(--mb-bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(15,42,36,0.18), 0 0 40px var(--mb-accent-dim);
  transform: translateY(16px) scale(0.95);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s var(--mb-spring), opacity 0.25s var(--mb-ease);
  font-family: var(--mb-font);
}
#mintbot-window.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

/* ── Header ──────────────────────────────────────────────────────────── */
#mintbot-header {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  background: linear-gradient(135deg, #ffffff 0%, #eef8f4 100%);
  border-bottom: 1px solid var(--mb-border);
  gap: 10px;
  flex-shrink: 0;
}
#mintbot-header-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--mb-accent);
  box-shadow: 0 0 8px var(--mb-accent-glow);
  flex-shrink: 0;
}
#mintbot-header-info {
  flex: 1;
  min-width: 0;
}
#mintbot-header-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--mb-text);
  line-height: 1.2;
}
#mintbot-header-sub {
  font-size: 12px;
  color: var(--mb-text3);
  line-height: 1.3;
}
.mintbot-header-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--mb-text3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.mintbot-header-btn:hover {
  background: var(--mb-accent-dim);
  color: var(--mb-accent);
}
.mintbot-header-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
}

/* ── DSGVO Notice ────────────────────────────────────────────────────── */
#mintbot-dsgvo {
  padding: 8px 16px;
  background:#dff8ef;
  border-bottom: 1px solid var(--mb-border);
  font-size: 11px;
  color: var(--mb-text3);
  line-height: 1.4;
  flex-shrink: 0;
}
#mintbot-dsgvo a {
  color: #00886f;
  text-decoration: none;
}
#mintbot-dsgvo a:hover { text-decoration: underline; }

/* ── Messages Area ───────────────────────────────────────────────────── */
#mintbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}
#mintbot-messages::-webkit-scrollbar { width: 4px; }
#mintbot-messages::-webkit-scrollbar-track { background: transparent; }
#mintbot-messages::-webkit-scrollbar-thumb { background: var(--mb-border2); border-radius: 4px; }

/* Message bubbles */
.mb-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--mb-text);
  word-wrap: break-word;
  animation: mb-fade-in 0.3s var(--mb-ease);
}
@keyframes mb-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.mb-msg.bot {
  align-self: flex-start;
  background: #ffffff;
  border: 1px solid var(--mb-border);
  border-bottom-left-radius: 4px;
}
.mb-msg.user {
  align-self: flex-end;
  background: var(--mb-accent);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

/* Markdown in bot messages */
.mb-msg.bot strong { color: var(--mb-accent); font-weight: 600; }
.mb-msg.bot a { color: var(--mb-accent); text-decoration: underline; }
.mb-msg.bot ul, .mb-msg.bot ol { padding-left: 18px; margin: 6px 0; }
.mb-msg.bot li { margin: 2px 0; }
.mb-msg.bot p { margin: 4px 0; }
.mb-msg.bot code {
  background: var(--mb-accent-dim);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 13px;
}

/* Timestamp */
.mb-time {
  font-size: 10px;
  color: var(--mb-text3);
  margin-top: 2px;
  opacity: 0.7;
}
.mb-msg.user + .mb-time { text-align: right; }

/* CTA button in messages */
.mb-cta {
  display: inline-block;
  margin-top: 8px;
  padding: 6px 16px;
  border-radius: 8px;
  background: var(--mb-accent);
  color: var(--mb-bg) !important;
  text-decoration: none !important;
  font-size: 13px;
  font-weight: 600;
  transition: box-shadow 0.2s;
}
.mb-cta:hover {
  box-shadow: 0 0 16px var(--mb-accent-glow);
}

/* Typing indicator */
.mb-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: var(--mb-bg-card);
  border: 1px solid var(--mb-border);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  max-width: 80px;
}
.mb-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--mb-text3);
  animation: mb-typing-bounce 1.4s infinite ease-in-out;
}
.mb-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.mb-typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes mb-typing-bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* ── Suggestion Chips ────────────────────────────────────────────────── */
.mb-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  animation: mb-fade-in 0.3s var(--mb-ease);
}
.mb-chip {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid rgba(0,136,111,0.26);
  background: #e6f7f1;
  color: #006b58;
  font-size: 13px;
  font-family: var(--mb-font);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.mb-chip:hover {
  background: #d3f3e8;
  border-color: var(--mb-accent);
}

/* ── Input Area ──────────────────────────────────────────────────────── */
#mintbot-input-area {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-top: 1px solid var(--mb-border);
  background: #ffffff;
  gap: 8px;
  flex-shrink: 0;
}
#mintbot-input {
  flex: 1;
  background: #f7fbf9;
  border: 1px solid var(--mb-border2);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--mb-text);
  font-size: 14px;
  font-family: var(--mb-font);
  outline: none;
  resize: none;
  max-height: 80px;
  line-height: 1.4;
  transition: border-color 0.15s;
}
#mintbot-input::placeholder { color: var(--mb-text3); }
#mintbot-input:focus { border-color: var(--mb-accent-glow); }
#mintbot-send {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: none;
  background: var(--mb-accent);
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: box-shadow 0.2s, opacity 0.2s;
  flex-shrink: 0;
}
#mintbot-send:hover { box-shadow: 0 0 16px var(--mb-accent-glow); }
#mintbot-send:disabled { opacity: 0.4; cursor: not-allowed; }
#mintbot-send svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Lead Form (overlay inside chat) ─────────────────────────────────── */
.mb-lead-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: var(--mb-bg-card);
  border: 1px solid var(--mb-border2);
  border-radius: 12px;
  animation: mb-fade-in 0.3s var(--mb-ease);
}
.mb-lead-form input {
  background: var(--mb-bg2);
  border: 1px solid var(--mb-border2);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--mb-text);
  font-size: 13px;
  font-family: var(--mb-font);
  outline: none;
}
.mb-lead-form input::placeholder { color: var(--mb-text3); }
.mb-lead-form input:focus { border-color: var(--mb-accent-glow); }
.mb-lead-form button {
  padding: 8px 16px;
  border-radius: 8px;
  border: none;
  background: var(--mb-accent);
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--mb-font);
  cursor: pointer;
}

/* ── Mobile: full-screen overlay ─────────────────────────────────────── */
@media (max-width: 600px) {
  #mintbot-window {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    max-height: 100vh;
    border-radius: 0;
    bottom: 0;
    right: 0;
  }
  #mintbot-window.open {
    transform: translateY(0) scale(1);
  }
  #mintbot-toggle {
    width: 52px;
    height: 52px;
    bottom: 88px;
    bottom: max(88px, calc(env(safe-area-inset-bottom) + 88px));
    right: 12px;
  }
  #mintbot-toggle svg.icon-chat {
    width: 28px;
    height: 28px;
  }
}

/* ── RTL Support (Arabic) ─────────────────────────────────────────────── */
[dir="rtl"] #mintbot-window,
.mintbot-rtl #mintbot-window {
  direction: rtl;
  text-align: right;
}
[dir="rtl"] #mintbot-toggle,
.mintbot-rtl #mintbot-toggle {
  right: auto;
  left: 24px;
}
[dir="rtl"] #mintbot-window,
.mintbot-rtl #mintbot-window {
  right: auto;
  left: 24px;
}
[dir="rtl"] .mb-msg.user,
.mintbot-rtl .mb-msg.user {
  align-self: flex-start;
  border-bottom-right-radius: 14px;
  border-bottom-left-radius: 4px;
}
[dir="rtl"] .mb-msg.bot,
.mintbot-rtl .mb-msg.bot {
  align-self: flex-end;
  border-bottom-left-radius: 14px;
  border-bottom-right-radius: 4px;
}
[dir="rtl"] #mintbot-tooltip,
.mintbot-rtl #mintbot-tooltip {
  right: auto;
  left: 0;
}
@media (max-width: 600px) {
  [dir="rtl"] #mintbot-toggle,
  .mintbot-rtl #mintbot-toggle {
    left: 16px;
    right: auto;
  }
  [dir="rtl"] #mintbot-window,
  .mintbot-rtl #mintbot-window {
    left: 0;
    right: 0;
  }
}

/* ── Print: hide widget ──────────────────────────────────────────────── */
@media print {
  #mintbot-toggle, #mintbot-window { display: none !important; }
}
