/* ══════════════════════════════════════════════════════════════
   feedback-widget.css — Shared Contact / Feedback floating button
   Included on: public site, AG site, portal login, client/agent dashboard
   ══════════════════════════════════════════════════════════════ */

/* ── Floating button ─────────────────────────────────────────── */
#fw-btn {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 290;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(
    145deg,
    rgba(23,23,68,0.98)  0%,
    rgba(36,25,87,0.98)  55%,
    rgba(49,32,109,0.98) 100%
  );
  border: 1px solid rgba(196,181,253,0.34);
  box-shadow:
    0 8px 24px rgba(14,10,45,0.42),
    inset 0 1px 0 rgba(255,255,255,0.08);
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
  will-change: transform;
  /* Safari tap highlight */
  -webkit-tap-highlight-color: transparent;
  /* Allow pseudo-element glow to extend beyond button bounds */
  isolation: isolate;
  overflow: visible;
  /* hidden initially — shown once JS initialises */
  opacity: 0;
  pointer-events: none;
}
#fw-btn.fw-ready {
  opacity: 1;
  pointer-events: auto;
}
#fw-btn:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 8px 28px rgba(61,79,199,0.55), 0 0 0 2px rgba(255,255,255,0.18) inset;
}
#fw-btn:active {
  transform: scale(0.95);
}
#fw-btn:focus-visible {
  outline: 3px solid #a5b4fc;
  outline-offset: 3px;
}

/* ── Green smoky glow — pseudo-elements ─────────────────────── */
#fw-btn::before,
#fw-btn::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  z-index: -1;
}

/* Steady inner glow — no scale, gentle opacity shift only */
#fw-btn::before {
  inset: -9px;
  background:
    radial-gradient(
      ellipse at 50% 38%,
      rgba(167,243,208,0.38) 0%,
      rgba(110,231,183,0.28) 30%,
      rgba(52,211,153,0.15)  52%,
      rgba(16,185,129,0.06)  68%,
      transparent            80%
    );
  filter: blur(8px);
  opacity: 0.78;
  animation: fw-steady-glow 4s ease-in-out infinite;
}

/* Rising smoke layer — floats upward and fades */
#fw-btn::after {
  inset: -18px -15px -4px;
  border-radius: 50%;
  background:
    radial-gradient(
      ellipse at 50% 58%,
      rgba(167,243,208,0.25) 0%,
      rgba(110,231,183,0.18) 28%,
      rgba(52,211,153,0.09)  48%,
      transparent            72%
    );
  filter: blur(12px);
  opacity: 0;
  transform-origin: 50% 80%;
  animation: fw-smoke-rise 4.8s linear infinite;
}

/* Hover: strengthen glow, keep existing button lift + shadow */
#fw-btn:hover::before {
  opacity: 1;
  filter: blur(9px);
}
#fw-btn:hover::after {
  /* smoke rise continues; animation-play-state left at running */
  filter: blur(11px);
}

/* Animations */
@keyframes fw-steady-glow {
  0%, 100% { opacity: 0.72; }
  50%       { opacity: 0.86; }
}

@keyframes fw-smoke-rise {
  0%   { opacity: 0;    transform: translateY(0)     translateX(-1px) scale(0.88); }
  18%  { opacity: 0.55;                                                              }
  55%  { opacity: 0.42; transform: translateY(-11px) translateX(2px)  scale(1.02); }
  100% { opacity: 0;    transform: translateY(-26px) translateX(-2px) scale(1.18); }
}

/* Mobile: smoke extends upward only, not below button */
@media (max-width: 768px) {
  #fw-btn::before {
    top: -10px;
    right: -7px;
    bottom: 0;
    left: -7px;
    filter: blur(7px);
  }
  #fw-btn::after {
    top: -21px;
    right: -12px;
    bottom: 0;
    left: -12px;
    filter: blur(10px);
    transform-origin: 50% 82%;
  }
}

/* Reduced motion: freeze at mid-opacity, no animation */
@media (prefers-reduced-motion: reduce) {
  #fw-btn::before,
  #fw-btn::after {
    animation: none;
  }
  #fw-btn::before {
    opacity: 0.76;
    transform: none;
  }
  #fw-btn::after {
    opacity: 0.24;
    transform: translateY(-7px) scale(1);
  }
}

/* Hide while any backdrop/drawer/modal is open */
#fw-btn.fw-hidden {
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Sticky-bar aware mobile position */
@media (max-width: 768px) {
  #fw-btn {
    right: 16px;
    width: 52px;
    height: 52px;
    /* Default: no sticky bar */
    bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  }
  #fw-btn.fw-above-sticky {
    /* Above the 64px sticky bar */
    bottom: calc(64px + 14px + env(safe-area-inset-bottom, 0px));
  }
}

/* ── Tooltip ──────────────────────────────────────────────────── */
#fw-btn [role="tooltip"] {
  position: absolute;
  right: calc(100% + 10px);
  bottom: 50%;
  transform: translateY(50%);
  white-space: nowrap;
  background: rgba(24,24,48,0.92);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 6px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  font-family: 'Inter', -apple-system, sans-serif;
}
#fw-btn:hover [role="tooltip"],
#fw-btn:focus-visible [role="tooltip"] {
  opacity: 1;
}

/* ── Modal overlay ────────────────────────────────────────────── */
#fw-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0,0,0,0.55);
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  /* Prevent body scroll from bleeding */
  overscroll-behavior: contain;
}
#fw-overlay.fw-open {
  display: flex;
}

/* ── Modal card ───────────────────────────────────────────────── */
#fw-modal {
  position: relative;
  z-index: 1001;
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 440px;
  max-height: calc(100dvh - 32px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0,0,0,0.28), 0 4px 16px rgba(0,0,0,0.12);
}

/* ── Modal header ─────────────────────────────────────────────── */
#fw-modal-head {
  flex-shrink: 0;
  background: linear-gradient(135deg, hsl(240,49%,32%) 0%, hsl(271,53%,28%) 100%);
  color: #fff;
  padding: 22px 24px 18px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
#fw-modal-head svg {
  flex-shrink: 0;
  margin-top: 2px;
}
#fw-modal-title-wrap {
  flex: 1;
}
#fw-modal-title {
  margin: 0 0 4px;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #fff;
  font-family: 'Inter', -apple-system, sans-serif;
}
#fw-modal-sub {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.45;
  color: rgba(255,255,255,0.78);
  font-family: 'Inter', -apple-system, sans-serif;
}
#fw-close-btn {
  flex-shrink: 0;
  background: rgba(255,255,255,0.15);
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  cursor: pointer;
  color: #fff;
  font-size: 18px;
  line-height: 30px;
  text-align: center;
  padding: 0;
  transition: background 0.14s;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: -2px;
  -webkit-tap-highlight-color: transparent;
}
#fw-close-btn:hover { background: rgba(255,255,255,0.25); }
#fw-close-btn:focus-visible { outline: 2px solid #a5b4fc; outline-offset: 2px; }

/* ── Modal body ───────────────────────────────────────────────── */
#fw-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  background: #fff;
  -webkit-overflow-scrolling: touch;
}

/* ── Form fields ──────────────────────────────────────────────── */
.fw-field {
  margin-bottom: 16px;
}
.fw-label {
  display: block;
  font-size: 0.83rem;
  font-weight: 600;
  color: #1a1a2e;
  margin-bottom: 6px;
  font-family: 'Inter', -apple-system, sans-serif;
}
.fw-label .fw-req {
  color: hsl(240,49%,42%);
  margin-left: 2px;
}
.fw-input,
.fw-textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 16px; /* ≥16px prevents iPhone Safari auto-zoom */
  font-family: 'Inter', -apple-system, sans-serif;
  color: #111827;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
  -webkit-appearance: none;
}
.fw-textarea {
  resize: vertical;
  min-height: 110px;
}
.fw-input:focus,
.fw-textarea:focus {
  outline: none;
  border-color: hsl(240,49%,42%);
  box-shadow: 0 0 0 3px hsl(240,49%,93%);
}
.fw-field-error .fw-input,
.fw-field-error .fw-textarea {
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220,38,38,0.12);
}
.fw-error-msg {
  display: none;
  font-size: 0.77rem;
  color: #dc2626;
  margin-top: 4px;
  font-family: 'Inter', -apple-system, sans-serif;
}
.fw-field-error .fw-error-msg { display: block; }

/* Honeypot — visually and pointer hidden */
.fw-pot { position: absolute; left: -9999px; top: -9999px; opacity: 0; pointer-events: none; tab-index: -1; }

/* ── Modal footer ─────────────────────────────────────────────── */
#fw-modal-foot {
  flex-shrink: 0;
  padding: 0 24px 20px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  background: #fff;
}
.fw-btn-cancel {
  padding: 9px 18px;
  border: 1.5px solid #d1d5db;
  background: #fff;
  color: #374151;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Inter', -apple-system, sans-serif;
  transition: background 0.14s, border-color 0.14s;
  -webkit-tap-highlight-color: transparent;
}
.fw-btn-cancel:hover { background: #f9fafb; border-color: #9ca3af; }
.fw-btn-cancel:focus-visible { outline: 2px solid hsl(240,49%,42%); outline-offset: 2px; }

.fw-btn-send {
  padding: 9px 20px;
  border: none;
  background: linear-gradient(135deg, hsl(240,49%,40%) 0%, hsl(271,53%,35%) 100%);
  color: #fff;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  font-family: 'Inter', -apple-system, sans-serif;
  transition: opacity 0.15s, transform 0.12s;
  -webkit-tap-highlight-color: transparent;
  min-width: 120px;
}
.fw-btn-send:hover:not(:disabled) { opacity: 0.9; transform: translateY(-1px); }
.fw-btn-send:active:not(:disabled) { transform: scale(0.97); }
.fw-btn-send:disabled { opacity: 0.55; cursor: not-allowed; }
.fw-btn-send:focus-visible { outline: 2px solid #a5b4fc; outline-offset: 2px; }

/* ── Toast ────────────────────────────────────────────────────── */
#fw-toast {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  right: 24px;
  z-index: 2000;
  padding: 11px 18px;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  font-family: 'Inter', -apple-system, sans-serif;
  color: #fff;
  pointer-events: none;
  transform: translateY(12px);
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  max-width: 300px;
}
#fw-toast.fw-toast-show {
  opacity: 1;
  transform: translateY(0);
}
#fw-toast.fw-toast-success { background: #16a34a; }
#fw-toast.fw-toast-error   { background: #dc2626; }

@media (max-width: 480px) {
  #fw-toast { right: 12px; left: 12px; max-width: none; }
}
