/* AI Lead Chat Widget — Front-end Styles */

#alc-root * { box-sizing: border-box; margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }

/* Toggle button */
#alc-toggle {
  position: fixed;
  bottom: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  transition: transform 0.2s, box-shadow 0.2s;
  z-index: 99998;
}
#alc-toggle:hover { transform: scale(1.07); box-shadow: 0 6px 24px rgba(0,0,0,0.25); }
#alc-toggle svg { transition: transform 0.25s, opacity 0.2s; }
#alc-toggle.open .alc-icon-chat { opacity: 0; transform: rotate(45deg) scale(0); }
#alc-toggle.open .alc-icon-close { opacity: 1; transform: rotate(0deg) scale(1); }
#alc-toggle .alc-icon-close { position: absolute; opacity: 0; transform: rotate(-45deg) scale(0); }

/* Unread dot */
#alc-unread {
  position: absolute;
  top: 0; right: 0;
  width: 14px; height: 14px;
  background: #ff4444;
  border-radius: 50%;
  border: 2px solid #fff;
  display: none;
}
#alc-unread.show { display: block; }

/* Chat window */
#alc-window {
  position: fixed;
  bottom: 92px;
  width: 360px;
  max-height: 520px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 99997;
  transform: translateY(16px) scale(0.96);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.22s cubic-bezier(.22,1,.36,1), opacity 0.2s;
}
#alc-window.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: all;
}

/* Header */
#alc-header {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
#alc-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
#alc-header-info { flex: 1; }
#alc-agent-name { font-size: 14px; font-weight: 600; color: #fff; }
#alc-agent-status { font-size: 11px; color: rgba(255,255,255,0.8); display: flex; align-items: center; gap: 4px; }
#alc-agent-status::before { content:''; width:7px; height:7px; border-radius:50%; background:#4ade80; display:inline-block; }
#alc-header-close { background: none; border: none; cursor: pointer; color: rgba(255,255,255,0.8); font-size: 18px; line-height: 1; padding: 4px; }
#alc-header-close:hover { color: #fff; }

/* Messages */
#alc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f8f9fb;
  scroll-behavior: smooth;
}

.alc-msg {
  max-width: 82%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  animation: alc-pop 0.18s ease;
}
@keyframes alc-pop { from { opacity:0; transform: translateY(6px); } to { opacity:1; transform:none; } }

.alc-msg-bot {
  background: #fff;
  color: #1a1a1a;
  border: 1px solid #ebebeb;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}
.alc-msg-user {
  color: #fff;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}

/* Typing indicator */
.alc-typing {
  display: flex;
  gap: 5px;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid #ebebeb;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  width: 54px;
}
.alc-typing span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #bbb;
  animation: alc-bounce 1.2s infinite;
}
.alc-typing span:nth-child(2) { animation-delay: 0.15s; }
.alc-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes alc-bounce {
  0%,60%,100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* Lead captured banner */
#alc-lead-banner {
  background: #f0fdf4;
  border-top: 1px solid #bbf7d0;
  padding: 10px 16px;
  font-size: 12px;
  color: #166534;
  text-align: center;
  flex-shrink: 0;
  display: none;
}
#alc-lead-banner.show { display: block; }

/* Input area */
#alc-input-area {
  padding: 10px 12px;
  border-top: 1px solid #f0f0f0;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-shrink: 0;
  background: #fff;
}
#alc-input {
  flex: 1;
  border: 1px solid #e0e0e0;
  border-radius: 20px;
  padding: 9px 14px;
  font-size: 14px;
  outline: none;
  resize: none;
  max-height: 100px;
  line-height: 1.4;
  font-family: inherit;
  color: #1a1a1a;
  background: #f8f9fb;
  transition: border-color 0.15s;
}
#alc-input:focus { border-color: var(--alc-color, #1a6fff); background: #fff; }
#alc-input::placeholder { color: #aaa; }

#alc-send {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: transform 0.15s, opacity 0.15s;
}
#alc-send:hover { transform: scale(1.08); }
#alc-send:disabled { opacity: 0.4; cursor: default; transform: none; }
#alc-send svg { color: #fff; }

/* Hours badge */
#alc-hours { font-size: 11px; color: #888; text-align: center; padding: 4px 16px 8px; background: #f8f9fb; }

/* Powered by */
#alc-powered { font-size: 10px; text-align: center; color: #bbb; padding: 4px 0 8px; background: #fff; }

/* Position variants */
.alc-pos-right { right: 24px; }
.alc-pos-left  { left: 24px; }
#alc-window.alc-pos-right { right: 24px; }
#alc-window.alc-pos-left  { left: 24px; }

@media (max-width: 420px) {
  #alc-window { width: calc(100vw - 16px); right: 8px !important; left: 8px !important; bottom: 80px; }
  #alc-toggle { bottom: 16px; right: 16px !important; left: auto !important; }
}

/* ── Exit-intent / Timer Overlay ────────────────────────── */
#alc-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 99996;
  align-items: center;
  justify-content: center;
}
#alc-overlay.open { display: flex; }
#alc-popup {
  border-radius: 16px;
  padding: 36px 32px;
  max-width: 420px;
  width: 90%;
  text-align: center;
  position: relative;
  animation: alc-pop-in 0.25s cubic-bezier(.22,1,.36,1);
}
@keyframes alc-pop-in { from { opacity:0; transform: scale(0.9) translateY(10px); } to { opacity:1; transform: none; } }
#alc-overlay-close {
  position: absolute; top: 12px; right: 14px;
  background: none; border: none; color: rgba(255,255,255,0.7); font-size: 22px; cursor: pointer; line-height: 1;
}
#alc-overlay-close:hover { color: #fff; }
#alc-popup-title { font-size: 22px; font-weight: 700; color: #fff; margin-bottom: 10px; }
#alc-popup-sub   { font-size: 14px; color: rgba(255,255,255,0.85); margin-bottom: 24px; line-height: 1.5; }
#alc-popup-cta {
  padding: 12px 28px; border: none; border-radius: 30px;
  font-size: 15px; font-weight: 600; cursor: pointer;
  transition: transform 0.15s, opacity 0.15s;
}
#alc-popup-cta:hover { transform: scale(1.04); }

/* ── Contact Form ────────────────────────────────────────── */
.alc-contact-form { max-width: 520px; margin: 0 auto; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }
.alc-form-title   { font-size: 22px; font-weight: 700; margin: 0 0 6px; }
.alc-form-sub     { font-size: 14px; color: #555; margin: 0 0 20px; }
.alc-form-field   { margin-bottom: 14px; }
.alc-form-field label  { display: block; font-size: 13px; font-weight: 500; color: #333; margin-bottom: 5px; }
.alc-form-field input,
.alc-form-field textarea {
  width: 100%; box-sizing: border-box;
  border: 1px solid #d1d5db; border-radius: 8px;
  padding: 9px 12px; font-size: 14px; font-family: inherit;
  transition: border-color 0.15s;
}
.alc-form-field input:focus,
.alc-form-field textarea:focus { outline: none; border-color: var(--alc-color, #1a6fff); }
.alc-form-field textarea { resize: vertical; }
.alc-required     { color: #dc2626; }
.alc-form-submit  {
  width: 100%; padding: 11px; border: none; border-radius: 8px;
  color: #fff; font-size: 15px; font-weight: 600; cursor: pointer;
  transition: opacity 0.15s;
}
.alc-form-submit:hover { opacity: 0.9; }
.alc-form-submit:disabled { opacity: 0.5; cursor: default; }
.alc-form-msg     { font-size: 13px; margin-top: 8px; min-height: 18px; }
.alc-form-success { text-align: center; padding: 24px; }
.alc-form-success p { font-size: 16px; color: #166534; font-weight: 500; }

/* ── Tab navigation (admin) ─── already in admin.css ─────── */
