/* MyTaxFile Online — Widgets (lead modal, chatbot, callback bar, WhatsApp) */

/* ============ Inline callback bar (hero) ============ */
.callback-bar {
  display: flex; gap: 8px;
  background: #fff;
  border: 1px solid var(--stroke-strong);
  border-radius: 14px;
  padding: 6px;
  box-shadow: var(--shadow-sm);
  max-width: 480px;
  margin-top: 18px;
}
.callback-bar input {
  flex: 1; border: 0; background: transparent;
  padding: 10px 12px; font-size: 15px; color: var(--ink-900);
  min-width: 0;
}
.callback-bar input:focus { outline: none; }
.callback-bar .btn {
  padding: 12px 16px; font-size: 14px;
}
.callback-bar.success { border-color: var(--accent-500); background: var(--accent-50); }
.callback-bar.success input { color: var(--accent-600); }

@media (max-width: 560px) {
  .callback-bar { flex-direction: column; padding: 12px; max-width: 100%; gap: 10px; }
  .callback-bar input { padding: 12px 14px; }
  .callback-bar .btn { width: 100%; min-height: 48px; }
}

/* ============ Lead modal ============ */
.mtf-modal {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(11,16,32,.55); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  opacity: 0; visibility: hidden;
  transition: opacity .2s ease, visibility .2s ease;
}
.mtf-modal.open { opacity: 1; visibility: visible; }
.mtf-modal-card {
  background: #fff; border-radius: 20px;
  width: min(100%, 460px);
  padding: 28px;
  box-shadow: var(--shadow-lg);
  transform: translateY(8px) scale(.99);
  transition: transform .2s cubic-bezier(.2,.8,.2,1);
  position: relative;
}
.mtf-modal.open .mtf-modal-card { transform: translateY(0) scale(1); }
.mtf-modal-close {
  position: absolute; top: 12px; right: 12px;
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--bg-100); color: var(--ink-700);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 20px; cursor: pointer;
}
.mtf-modal-close:hover { background: var(--ink-100); }

.mtf-modal-card h3 {
  font-size: 22px; font-weight: 700; color: var(--ink-900);
  letter-spacing: -.015em; margin-bottom: 6px;
}
.mtf-modal-card p.lead-sub {
  color: var(--ink-500); font-size: 14.5px; margin-bottom: 18px;
}
.mtf-modal-card .field { margin-bottom: 12px; }
.mtf-modal-card .field label { font-size: 13.5px; font-weight: 600; color: var(--ink-700); margin-bottom: 4px; display: block; }
.mtf-modal-card .input,
.mtf-modal-card .textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--stroke-strong);
  font-size: 15px; color: var(--ink-900);
  background: #fff;
}
.mtf-modal-card .input:focus,
.mtf-modal-card .textarea:focus {
  outline: none; border-color: var(--brand-500);
  box-shadow: 0 0 0 4px rgba(45,91,255,.14);
}
.mtf-modal-card .textarea { resize: vertical; min-height: 84px; }
.mtf-modal-card .row-buttons {
  display: flex; gap: 10px; margin-top: 8px;
}
.mtf-modal-card .row-buttons .btn { flex: 1; min-height: 48px; }
.mtf-modal-card .or {
  text-align: center; margin: 14px 0 8px;
  font-size: 12.5px; color: var(--ink-400);
  position: relative;
}
.mtf-modal-card .or::before,
.mtf-modal-card .or::after {
  content: ""; position: absolute; top: 50%;
  width: calc(50% - 30px); height: 1px;
  background: var(--stroke);
}
.mtf-modal-card .or::before { left: 0; }
.mtf-modal-card .or::after  { right: 0; }
.mtf-modal-card .privacy-note {
  margin-top: 12px; font-size: 12px; color: var(--ink-400);
  text-align: center;
}

.mtf-modal-success {
  text-align: center; padding: 18px 0;
}
.mtf-modal-success .ok-mark {
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--accent-500); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 28px; margin-bottom: 14px;
  box-shadow: 0 8px 24px rgba(34,197,139,.3);
}
.mtf-modal-success h4 { font-size: 22px; color: var(--ink-900); font-weight: 700; margin-bottom: 8px; }
.mtf-modal-success p { color: var(--ink-500); font-size: 14.5px; margin-bottom: 16px; }

/* ============ Chatbot ============ */
.mtf-chat-fab {
  position: fixed; right: 20px; bottom: 20px; z-index: 80;
  width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-600), var(--accent-500));
  color: #fff; font-size: 24px;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-lg);
  cursor: pointer; border: 0;
  transition: transform .15s ease;
}
.mtf-chat-fab:hover { transform: scale(1.05); }
.mtf-chat-fab .pulse {
  position: absolute; inset: 0; border-radius: 50%;
  background: rgba(45,91,255,.35); animation: chat-pulse 2.2s ease-out infinite;
  pointer-events: none;
}
@keyframes chat-pulse { 0% { transform: scale(1); opacity: .6; } 100% { transform: scale(1.6); opacity: 0; } }

.mtf-chat-panel {
  position: fixed; right: 20px; bottom: 90px; z-index: 80;
  width: min(380px, calc(100vw - 32px));
  height: min(560px, calc(100vh - 130px));
  background: #fff;
  border-radius: 20px;
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow-lg);
  display: none; flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
}
.mtf-chat-panel.open { display: flex; animation: chat-pop .18s ease-out; }
@keyframes chat-pop { from { transform: scale(.96) translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }

.mtf-chat-head {
  background: linear-gradient(135deg, #0B1020 0%, #14288A 100%);
  color: #fff;
  padding: 18px 18px 22px;
  position: relative;
}
.mtf-chat-head::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0;
  height: 12px; background: linear-gradient(180deg, transparent, #fff);
  border-radius: 0;
}
.mtf-chat-head .row { gap: 10px; }
.mtf-chat-head .ai-ico {
  width: 36px; height: 36px; border-radius: 10px;
  background: rgba(255,255,255,.14);
  display: inline-flex; align-items: center; justify-content: center; font-size: 18px;
}
.mtf-chat-head h4 { color: #fff; margin: 0; font-size: 16px; font-weight: 700; }
.mtf-chat-head p { color: rgba(255,255,255,.72); font-size: 12.5px; margin: 0; }
.mtf-chat-head .close-x {
  position: absolute; top: 12px; right: 12px;
  width: 32px; height: 32px; border-radius: 8px;
  background: rgba(255,255,255,.12); color: #fff; font-size: 16px;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}

.mtf-chat-body {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 8px;
  background: var(--bg-50);
}
.mtf-chat-msg {
  max-width: 84%; padding: 10px 14px; border-radius: 14px;
  font-size: 14px; line-height: 1.5;
}
.mtf-chat-msg.bot {
  align-self: flex-start; background: #fff; border: 1px solid var(--stroke);
  color: var(--ink-700); border-bottom-left-radius: 4px;
}
.mtf-chat-msg.user {
  align-self: flex-end; background: var(--brand-600); color: #fff;
  border-bottom-right-radius: 4px;
}
.mtf-chat-typing {
  align-self: flex-start; padding: 12px 16px; background: #fff; border-radius: 14px; border: 1px solid var(--stroke);
  display: inline-flex; gap: 4px;
}
.mtf-chat-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-300); animation: dot 1.2s infinite; }
.mtf-chat-typing span:nth-child(2) { animation-delay: .15s; }
.mtf-chat-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 60%, 100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-3px); opacity: 1; } }

.mtf-chat-prompts {
  display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 8px; background: var(--bg-50);
}
.mtf-chat-prompts button {
  padding: 8px 12px; border-radius: 999px;
  background: #fff; border: 1px solid var(--stroke);
  font-size: 12.5px; color: var(--ink-700); font-weight: 500;
}
.mtf-chat-prompts button:hover { border-color: var(--brand-300); color: var(--brand-700); }

.mtf-chat-foot {
  padding: 10px 12px; border-top: 1px solid var(--stroke); background: #fff;
  display: flex; gap: 8px;
}
.mtf-chat-foot input {
  flex: 1; padding: 10px 12px; border: 1px solid var(--stroke);
  border-radius: 10px; font-size: 14px; color: var(--ink-900);
}
.mtf-chat-foot input:focus { outline: none; border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(45,91,255,.14); }
.mtf-chat-foot button {
  background: var(--brand-600); color: #fff;
  padding: 10px 14px; border-radius: 10px; font-weight: 600; font-size: 14px;
}
.mtf-chat-foot button:disabled { opacity: .55; cursor: not-allowed; }

.mtf-chat-leadbar {
  border-top: 1px solid var(--stroke); padding: 10px 12px; background: var(--brand-50);
  display: flex; gap: 8px; align-items: center;
}
.mtf-chat-leadbar input {
  flex: 1; padding: 8px 12px; font-size: 13px; border: 1px solid var(--stroke); border-radius: 8px;
}
.mtf-chat-leadbar button {
  background: var(--brand-700); color: #fff;
  padding: 8px 12px; border-radius: 8px; font-size: 13px; font-weight: 600;
}

/* ============ WhatsApp button (small floating, paired with chat) ============ */
.mtf-wa-link {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-radius: 10px;
  background: #25D366; color: #fff;
  font-weight: 600; font-size: 14px;
  box-shadow: var(--shadow-sm);
}
.mtf-wa-link:hover { background: #1FBA5A; }

/* On mobile, push chat FAB above bottom-tabs */
@media (max-width: 960px) {
  body.app-on-mobile .mtf-chat-fab,
  body.app-on-mobile .mtf-chat-panel { bottom: calc(72px + env(safe-area-inset-bottom)); }
}
@media (max-width: 560px) {
  .mtf-chat-fab { right: 14px; bottom: 14px; width: 52px; height: 52px; font-size: 22px; }
  body.app-on-mobile .mtf-chat-fab { bottom: calc(70px + env(safe-area-inset-bottom)); }
  .mtf-chat-panel { right: 8px; left: 8px; bottom: 76px; width: auto; height: 75vh; }
  body.app-on-mobile .mtf-chat-panel { bottom: calc(78px + env(safe-area-inset-bottom)); height: 70vh; }
}

/* Hide chat on auth pages (less clutter) */
body.no-chat .mtf-chat-fab,
body.no-chat .mtf-chat-panel { display: none !important; }
