/* ================================================================
   FOURRTS HOMEO CHAT WIDGET v5.0 — WHITE THEME
   Clean, readable, professional. No dark backgrounds.
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ── Reset ───────────────────────────────────────────────── */
#fc-root,
#fc-root * {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ── Root ────────────────────────────────────────────────── */
#fc-root {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2147483647;
}

/* ════════════════════════════════════════════════════════════
   FAB BUTTON
   ════════════════════════════════════════════════════════════ */
#fc-fab {
  position: relative;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(145deg, #10b981, #059669);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 24px rgba(16,185,129,0.45), 0 2px 8px rgba(0,0,0,0.15);
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.25s ease;
  outline: none;
}

#fc-fab:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 12px 32px rgba(16,185,129,0.5), 0 4px 12px rgba(0,0,0,0.2);
}

#fc-fab:active { transform: scale(0.96); }

#fc-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  background: #ef4444;
  color: white;
  font-size: 10px;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2.5px solid white;
}

/* ════════════════════════════════════════════════════════════
   CHAT WINDOW — WHITE BACKGROUND
   ════════════════════════════════════════════════════════════ */
#fc-window {
  position: absolute;
  bottom: 72px;
  right: 0;
  width: 380px;
  max-width: calc(100vw - 16px);
  border-radius: 20px;
  background: #ffffff;
  box-shadow: 0 20px 60px rgba(0,0,0,0.18), 0 4px 16px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: calc(100vh - 110px);
  border: 1px solid #e5e7eb;
  animation: fcSlideIn 0.35s cubic-bezier(0.34,1.3,0.64,1) both;
}

@keyframes fcSlideIn {
  from { opacity: 0; transform: scale(0.85) translateY(16px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ── Header ──────────────────────────────────────────────── */
#fc-header {
  background: linear-gradient(145deg, #0f2a1e, #1a3d2b);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

#fc-hdr-left {
  display: flex;
  align-items: center;
  gap: 11px;
}

#fc-hdr-av {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  border: 2px solid rgba(16,185,129,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
}

#fc-logo-img { width: 28px; height: 28px; object-fit: contain; }

#fc-logo-text {
  width: 100%;
  height: 100%;
  background: #10b981;
  color: white;
  font-size: 18px;
  font-weight: 700;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

#fc-online-dot {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 11px;
  height: 11px;
  background: #22c55e;
  border-radius: 50%;
  border: 2px solid #1a3d2b;
}

#fc-hdr-name {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.01em;
}

#fc-hdr-sub {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: rgba(255,255,255,0.65);
  margin-top: 2px;
}

#fc-hdr-pulse {
  width: 7px;
  height: 7px;
  background: #22c55e;
  border-radius: 50%;
  flex-shrink: 0;
  animation: fcPulse 2.5s infinite;
}

@keyframes fcPulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(34,197,94,0.5); }
  50%      { box-shadow: 0 0 0 5px rgba(34,197,94,0); }
}

#fc-hdr-btns {
  display: flex;
  align-items: center;
  gap: 5px;
}

/* ── Header buttons — clean, no yellow ─────────────────── */
.fc-hbtn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.8);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: background 0.15s, color 0.15s, transform 0.15s;
}

.fc-hbtn:hover {
  background: rgba(255,255,255,0.2);
  color: #ffffff;
  transform: translateY(-1px);
}

.fc-hbtn-close:hover {
  background: rgba(239,68,68,0.25);
  color: #fca5a5;
}

/* ── Quick Action Cards (Call / Email / Reviews) ─────────── */
#fc-quick-bar {
  display: flex;
  gap: 10px;
  padding: 14px 16px;
  background: #f8fafb;
  border-bottom: 1px solid #f0f0f0;
  flex-shrink: 0;
}

.fc-quick-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 12px 8px;
  background: #ffffff;
  border: 1.5px solid #e8ecf0;
  border-radius: 12px;
  text-decoration: none;
  color: #1a2332;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  position: relative;
  overflow: hidden;
}

.fc-quick-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: 12px 12px 0 0;
}

#fc-qcard-call::before   { background: linear-gradient(90deg, #10b981, #34d399); }
#fc-qcard-email::before  { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
#fc-qcard-reviews::before{ background: linear-gradient(90deg, #f59e0b, #fbbf24); }

.fc-quick-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.12);
  border-color: #d1d5db;
  color: #1a2332;
  text-decoration: none;
}

.fc-quick-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#fc-qcard-call .fc-quick-icon   { background: #ecfdf5; color: #10b981; }
#fc-qcard-email .fc-quick-icon  { background: #eff6ff; color: #3b82f6; }
#fc-qcard-reviews .fc-quick-icon{ background: #fffbeb; color: #f59e0b; }

/* ── Messages Area — WHITE BACKGROUND, DARK TEXT ─────────── */
#fc-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: #f8fafb;
  scroll-behavior: smooth;
  min-height: 200px;
}

#fc-msgs::-webkit-scrollbar { width: 4px; }
#fc-msgs::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 4px;
}

/* ── Message Groups ──────────────────────────────────────── */
.fc-grp {
  display: flex;
  flex-direction: column;
  max-width: 80%;
  gap: 3px;
  animation: fcMsgIn 0.28s ease both;
}

@keyframes fcMsgIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fc-grp.fc-bot   { align-self: flex-start; }
.fc-grp.fc-user  { align-self: flex-end; }
.fc-grp.fc-agent { align-self: flex-start; }

.fc-av-row { display: flex; align-items: flex-end; gap: 8px; }

.fc-mini-av {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e8f5ee;
  border: 1.5px solid #c6e8d4;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.fc-mini-av img { width: 18px; height: 18px; object-fit: contain; }

/* ── Bubbles — PROPER CONTRAST ───────────────────────────── */
.fc-bbl {
  padding: 11px 14px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.65;
  word-break: break-word;
  white-space: pre-line;
}

/* BOT — white bubble, dark text (fully readable) */
.fc-bot .fc-bbl {
  background: #ffffff;
  color: #1a2332;
  border-radius: 4px 16px 16px 16px;
  border: 1.5px solid #e8ecf0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

/* USER — green gradient, white text */
.fc-user .fc-bbl {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  border-radius: 16px 16px 4px 16px;
  box-shadow: 0 3px 12px rgba(16,185,129,0.3);
}

/* AGENT — amber tint, dark text */
.fc-agent .fc-bbl {
  background: #fffbeb;
  color: #78350f;
  border-radius: 4px 16px 16px 16px;
  border: 1.5px solid #fde68a;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.fc-agent-lbl {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #d97706;
  margin-bottom: 3px;
  padding-left: 36px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.fc-agent-lbl::before {
  content: '';
  width: 6px; height: 6px;
  background: #f59e0b;
  border-radius: 50%;
  animation: fcPulse 1.5s infinite;
}

.fc-time {
  font-size: 10.5px;
  color: #9ca3af;
  padding: 0 4px;
  display: flex;
  align-items: center;
  gap: 3px;
}

.fc-user .fc-time { justify-content: flex-end; }
.fc-tick { color: #10b981; font-size: 11px; }

/* ── Link Buttons — RECTANGULAR, 2D depth, readable ─────── */
.fc-links {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 9px;
  padding-left: 36px;
}

.fc-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 13px;
  background: #ffffff;
  border: 1.5px solid #10b981;
  color: #059669;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(16,185,129,0.12),
              0 1px 0 rgba(0,0,0,0.04),
              inset 0 -1px 0 rgba(0,0,0,0.04);
}

.fc-link-btn:hover {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  border-color: #059669;
  transform: translateY(-2px);
  box-shadow: 0 5px 14px rgba(16,185,129,0.3);
  text-decoration: none;
}

.fc-link-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(0,0,0,0.12), inset 0 1px 3px rgba(0,0,0,0.08);
}

/* ── Quick Reply Chips — RECTANGULAR, not pills ──────────── */
.fc-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 9px;
  padding-left: 36px;
}

.fc-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 13px;
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  color: #374151;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07),
              inset 0 -1px 0 rgba(0,0,0,0.04);
}

.fc-chip:hover {
  background: #f0fdf4;
  border-color: #10b981;
  color: #059669;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16,185,129,0.15);
}

.fc-chip:active {
  transform: translateY(0);
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

/* ── Typing Indicator ────────────────────────────────────── */
.fc-typing-wrap {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  align-self: flex-start;
}

.fc-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  background: #ffffff;
  border: 1.5px solid #e8ecf0;
  border-radius: 4px 16px 16px 16px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.fc-typing-dot {
  width: 6px;
  height: 6px;
  background: #10b981;
  border-radius: 50%;
  animation: fcTyping 1.3s ease-in-out infinite;
  opacity: 0.5;
}

.fc-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.fc-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes fcTyping {
  0%,60%,100% { transform: translateY(0); opacity: 0.4; }
  30%          { transform: translateY(-6px); opacity: 1; }
}

/* ── Lead Form ───────────────────────────────────────────── */
#fc-lead {
  background: #ffffff;
  border-top: 1px solid #f0f0f0;
  flex-shrink: 0;
  max-height: 280px;
  overflow-y: auto;
}

#fc-lead-inner { padding: 14px 16px; }

#fc-lead-hdr {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #f3f4f6;
}

#fc-lead-hdr span { font-size: 22px; flex-shrink: 0; }

#fc-lead-hdr strong {
  display: block;
  font-size: 13.5px;
  font-weight: 700;
  color: #1a2332;
}

#fc-lead-hdr p {
  font-size: 12px;
  color: #6b7280;
  margin-top: 2px;
}

#fc-lead-fields { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }

.fc-lf-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.fc-lf-group { display: flex; flex-direction: column; gap: 4px; }

.fc-lf-group label {
  font-size: 11px;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.fc-lf-group input {
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 12.5px;
  color: #1a2332;
  font-family: 'Inter', sans-serif;
  background: #f9fafb;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  width: 100%;
}

.fc-lf-group input:focus {
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16,185,129,0.12);
  background: #ffffff;
}

.fc-lf-group input::placeholder { color: #c4c9d0; font-size: 12px; }

#fc-lead-submit {
  width: 100%;
  background: linear-gradient(135deg, #10b981, #059669);
  border: none;
  border-radius: 10px;
  color: white;
  font-size: 13.5px;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  padding: 11px;
  cursor: pointer;
  margin-bottom: 6px;
  box-shadow: 0 3px 12px rgba(16,185,129,0.3);
  transition: opacity 0.2s, transform 0.15s;
}

#fc-lead-submit:hover { opacity: 0.9; transform: translateY(-1px); }

#fc-lead-skip {
  width: 100%;
  background: none;
  border: none;
  font-size: 12px;
  color: #9ca3af;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  padding: 4px;
  transition: color 0.2s;
}

#fc-lead-skip:hover { color: #6b7280; }

/* ── Input Area ──────────────────────────────────────────── */
#fc-input-wrap {
  background: #ffffff;
  border-top: 1px solid #f0f0f0;
  flex-shrink: 0;
}

#fc-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 12px 8px;
}

#fc-emoji-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.15s;
  line-height: 1;
}

#fc-emoji-btn:hover { transform: scale(1.2); }

#fc-input {
  flex: 1;
  min-width: 0;
  border: 1.5px solid #e2e8f0;
  border-radius: 24px;
  padding: 10px 16px;
  font-size: 13.5px;
  color: #1a2332;
  font-family: 'Inter', sans-serif;
  background: #f9fafb;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

#fc-input::placeholder { color: #c4c9d0; }

#fc-input:focus {
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16,185,129,0.1);
  background: #ffffff;
}

#fc-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981, #059669);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 3px 12px rgba(16,185,129,0.35);
  transition: transform 0.2s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.2s;
  outline: none;
}

#fc-send:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 18px rgba(16,185,129,0.45);
}

#fc-send:active { transform: scale(0.95); }

#fc-input-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 12px 9px;
  font-size: 10.5px;
  color: #b0b8c5;
}

#fc-input-footer strong { color: #9ca3af; }

/* ── Emoji Picker ────────────────────────────────────────── */
#fc-emoji-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  padding: 10px 12px;
  background: #ffffff;
  border-top: 1px solid #f0f0f0;
  border-bottom: 1px solid #f0f0f0;
}

.fc-em {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.15s;
  line-height: 1;
}

.fc-em:hover { background: #f3f4f6; transform: scale(1.2); }

/* ════════════════════════════════════════════════════════════
   MOBILE — FULL SCREEN
   ════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
  #fc-root { bottom: 16px; right: 16px; }

  #fc-window {
    position: fixed !important;
    inset: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    border-radius: 0 !important;
    bottom: 0 !important;
    right: 0 !important;
    animation: fcMobileUp 0.35s cubic-bezier(0.34,1.2,0.64,1) both;
  }

  @keyframes fcMobileUp {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
  }

  #fc-header { padding-top: calc(14px + env(safe-area-inset-top, 0px)); }
  .fc-lf-row { grid-template-columns: 1fr; }
  .fc-grp { max-width: 88%; }
  .fc-links, .fc-chips { padding-left: 0; }
}

/* ── Reduced motion ──────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  #fc-window, #fc-fab, .fc-grp, .fc-typing-dot, #fc-hdr-pulse {
    animation: none !important;
    transition: none !important;
  }
}
