/* ════════════════════════════════════════════════════════════
   Lead Comply — Dan AI Compliance Consultant
   Chat Widget Styles — chat-widget.css
   Version 3.0 — Chatbase-style mobile-first UI
   ════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@700;800&family=DM+Sans:wght@300;400;500;600&display=swap');

/* ── TOKENS ── */
:root {
  --lc-navy:     #0B1E4A;
  --lc-navy2:    #1A3470;
  --lc-teal:     #00D4C2;
  --lc-teal-d:   #00A89A;
  --lc-teal-f:   #E8FFFE;
  --lc-white:    #FFFFFF;
  --lc-bg:       #F7F8FC;
  --lc-slate:    #8294A8;
  --lc-text:     #1E2D45;
  --lc-border:   rgba(11,30,74,.08);
  --lc-font-h:   'Syne', Georgia, serif;
  --lc-font-b:   'DM Sans', 'Helvetica Neue', sans-serif;

  /* Desktop dimensions */
  --lc-w:        380px;
  --lc-h:        600px;
  --lc-radius:   18px;
  --lc-launcher: 60px;
}

/* ══════════════════════════════════════════════
   WIDGET ROOT
   ══════════════════════════════════════════════ */
#lc-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999999;
  font-family: var(--lc-font-b);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ══════════════════════════════════════════════
   LAUNCHER BUTTON
   ══════════════════════════════════════════════ */
#lc-launcher {
  width: var(--lc-launcher);
  height: var(--lc-launcher);
  border-radius: 50%;
  background: linear-gradient(135deg, var(--lc-navy) 0%, var(--lc-navy2) 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 24px rgba(11,30,74,.30), 0 1px 6px rgba(11,30,74,.15);
  transition: transform 0.25s cubic-bezier(.34,1.56,.64,1),
              box-shadow 0.25s ease;
  position: relative;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

#lc-launcher:hover  { transform: scale(1.08); }
#lc-launcher:active { transform: scale(0.93); }

/* Icon swap */
#lc-launcher .lc-icon-chat,
#lc-launcher .lc-icon-close {
  position: absolute;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
#lc-launcher .lc-icon-close {
  opacity: 0;
  transform: scale(0.5) rotate(45deg);
}
#lc-launcher.open .lc-icon-chat {
  opacity: 0;
  transform: scale(0.5) rotate(-45deg);
}
#lc-launcher.open .lc-icon-close {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

/* Notification dot */
#lc-notify-dot {
  position: absolute;
  top: 1px;
  right: 1px;
  width: 13px;
  height: 13px;
  background: var(--lc-teal);
  border-radius: 50%;
  border: 2px solid #fff;
  display: none;
  animation: lc-pulse 2s infinite;
}

@keyframes lc-pulse {
  0%,100% { transform: scale(1); }
  50%      { transform: scale(1.2); }
}

/* ══════════════════════════════════════════════
   CHAT WINDOW — DESKTOP
   ══════════════════════════════════════════════ */
#lc-window {
  position: absolute;
  bottom: calc(var(--lc-launcher) + 12px);
  right: 0;
  width: var(--lc-w);
  height: var(--lc-h);
  background: var(--lc-white);
  border-radius: var(--lc-radius);
  box-shadow: 0 8px 40px rgba(11,30,74,.18), 0 2px 10px rgba(11,30,74,.10);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* Hidden state */
  opacity: 0;
  transform: translateY(16px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.25s ease,
              transform 0.3s cubic-bezier(.34,1.4,.64,1),
              height 0.3s ease;
  border: 1px solid var(--lc-border);
  transform-origin: bottom right;
}

#lc-window.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* ══════════════════════════════════════════════
   HEADER
   ══════════════════════════════════════════════ */
#lc-header {
  background: var(--lc-navy);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

#lc-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0,212,194,.15);
  border: 1.5px solid rgba(0,212,194,.3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

#lc-header-info { flex: 1; min-width: 0; }

#lc-agent-name {
  font-family: var(--lc-font-h);
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

#lc-agent-role {
  font-size: 11px;
  color: rgba(255,255,255,.55);
  margin-top: 1px;
}

/* Online indicator */
#lc-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--lc-teal);
  font-weight: 500;
  flex-shrink: 0;
}
#lc-status::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--lc-teal);
  display: block;
  animation: lc-pulse 2.5s infinite;
}

#lc-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,.10);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: rgba(255,255,255,.7);
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
#lc-close-btn:hover  { background: rgba(255,255,255,.2); color: #fff; }
#lc-close-btn:active { background: rgba(255,255,255,.25); }

/* ══════════════════════════════════════════════
   MESSAGES AREA
   ══════════════════════════════════════════════ */
#lc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--lc-bg);
  scroll-behavior: smooth;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* Hide scrollbar — Chatbase style */
#lc-messages::-webkit-scrollbar { display: none; }
#lc-messages { -ms-overflow-style: none; scrollbar-width: none; }

/* ── MESSAGE ROWS ── */
.lc-msg {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  animation: lc-fadeup 0.2s ease forwards;
}
.lc-msg.user { flex-direction: row-reverse; }

@keyframes lc-fadeup {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── AVATAR DOT — Chatbase style (small circle) ── */
.lc-msg-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2px;
}
.lc-msg.assistant .lc-msg-avatar {
  background: var(--lc-navy);
}
.lc-msg.user .lc-msg-avatar {
  background: var(--lc-teal-d);
}

/* ── BUBBLES ── */
.lc-msg-bubble {
  max-width: 80%;
  padding: 10px 14px;
  line-height: 1.6;
  font-size: 14px;
  color: var(--lc-text);
  word-break: break-word;
}

/* Bot bubble — white card */
.lc-msg.assistant .lc-msg-bubble {
  background: var(--lc-white);
  border-radius: 4px 16px 16px 16px;
  box-shadow: 0 1px 3px rgba(11,30,74,.07);
}

/* User bubble — navy */
.lc-msg.user .lc-msg-bubble {
  background: var(--lc-navy);
  color: var(--lc-white);
  border-radius: 16px 4px 16px 16px;
}

.lc-msg-bubble p { margin: 0 0 6px; }
.lc-msg-bubble p:last-child { margin-bottom: 0; }
.lc-msg-bubble strong { font-weight: 600; }
.lc-msg-bubble a { color: var(--lc-teal-d); }
.lc-msg.user .lc-msg-bubble a { color: var(--lc-teal); }
.lc-msg-bubble code {
  background: rgba(0,0,0,.06);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 12px;
  font-family: monospace;
}

/* ── TYPING INDICATOR ── */
#lc-typing {
  display: none;
  align-items: flex-end;
  gap: 8px;
  padding: 0 14px 4px;
}
#lc-typing.show { display: flex; }

.lc-typing-dots {
  background: var(--lc-white);
  border-radius: 4px 16px 16px 16px;
  padding: 10px 16px;
  display: flex;
  gap: 4px;
  align-items: center;
  box-shadow: 0 1px 3px rgba(11,30,74,.07);
}
.lc-dot {
  width: 6px;
  height: 6px;
  background: var(--lc-slate);
  border-radius: 50%;
  animation: lc-bounce 1.2s infinite;
}
.lc-dot:nth-child(2) { animation-delay: .2s; }
.lc-dot:nth-child(3) { animation-delay: .4s; }

@keyframes lc-bounce {
  0%,60%,100% { transform: translateY(0); }
  30%          { transform: translateY(-6px); }
}

/* ── SEARCH INDICATOR ── */
#lc-search-ind {
  font-size: 11px;
  color: var(--lc-slate);
  padding: 3px 0 5px;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* ── BOOKING CARD ── */
.lc-booking-card {
  background: var(--lc-navy);
  border-radius: 14px;
  padding: 16px;
  margin-top: 10px;
}
.lc-booking-title {
  font-family: var(--lc-font-h);
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}
.lc-booking-desc {
  font-size: 12px;
  color: rgba(255,255,255,.6);
  margin-bottom: 12px;
}
.lc-booking-features {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 14px;
}
.lc-booking-feature {
  font-size: 12px;
  color: rgba(255,255,255,.75);
  display: flex;
  align-items: center;
  gap: 6px;
}
.lc-booking-feature::before {
  content: '✓';
  color: var(--lc-teal);
  font-weight: 700;
  font-size: 11px;
  flex-shrink: 0;
}
.lc-book-btn {
  display: block;
  width: 100%;
  padding: 11px;
  background: var(--lc-teal);
  color: var(--lc-navy);
  font-family: var(--lc-font-h);
  font-size: 13px;
  font-weight: 700;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: background 0.15s, transform 0.1s;
  letter-spacing: .02em;
  -webkit-tap-highlight-color: transparent;
}
.lc-book-btn:hover  { background: var(--lc-teal-d); color: #fff; }
.lc-book-btn:active { transform: scale(0.98); }

/* ── BOOKING SUCCESS ── */
.lc-booking-success {
  background: #DCFCE7;
  border: 1px solid #BBF7D0;
  border-radius: 12px;
  padding: 14px;
  text-align: center;
  margin-top: 8px;
}

/* ── QUICK REPLIES — Chatbase chip style ── */
#lc-quick-replies {
  padding: 6px 14px 2px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex-shrink: 0;
  background: var(--lc-bg);
}
.lc-quick-btn {
  font-size: 12px;
  font-weight: 500;
  padding: 6px 13px;
  border-radius: 20px;
  border: 1.5px solid rgba(11,30,74,.14);
  background: var(--lc-white);
  color: var(--lc-navy);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  font-family: var(--lc-font-b);
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.lc-quick-btn:hover,
.lc-quick-btn:active {
  background: var(--lc-navy);
  color: #fff;
  border-color: var(--lc-navy);
}

/* ══════════════════════════════════════════════
   INPUT AREA — Chatbase pill style
   ══════════════════════════════════════════════ */
#lc-input-area {
  padding: 10px 12px 12px;
  background: var(--lc-white);
  border-top: 1px solid var(--lc-border);
  flex-shrink: 0;
}

#lc-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--lc-bg);
  border: 1.5px solid var(--lc-border);
  border-radius: 24px;
  padding: 8px 8px 8px 16px;
  transition: border-color 0.15s;
}
#lc-input-row:focus-within {
  border-color: rgba(0,168,154,.4);
  background: var(--lc-white);
}

#lc-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 14px;
  font-family: var(--lc-font-b);
  color: var(--lc-text);
  resize: none;
  min-height: 22px;
  max-height: 100px;
  line-height: 1.5;
  padding: 0;
}
#lc-input::placeholder { color: var(--lc-slate); }

#lc-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--lc-navy);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}
#lc-send-btn:hover  { background: var(--lc-navy2); }
#lc-send-btn:active { transform: scale(0.92); }
#lc-send-btn:disabled {
  background: rgba(11,30,74,.15);
  cursor: not-allowed;
  transform: none;
}

/* ── FOOTER ── */
#lc-footer {
  padding: 5px 14px 7px;
  text-align: center;
  font-size: 10.5px;
  color: var(--lc-slate);
  background: var(--lc-white);
}
#lc-footer a {
  color: var(--lc-teal-d);
  text-decoration: none;
  font-weight: 500;
}

/* ── WELCOME CARD ── */
.lc-welcome {
  background: linear-gradient(135deg,
    rgba(0,212,194,.09) 0%, rgba(11,30,74,.04) 100%);
  border: 1px solid rgba(0,212,194,.18);
  border-radius: 14px;
  padding: 14px 16px;
  text-align: center;
}
.lc-welcome-title {
  font-family: var(--lc-font-h);
  font-size: 14px;
  font-weight: 700;
  color: var(--lc-navy);
  margin-bottom: 4px;
}
.lc-welcome-text {
  font-size: 12px;
  color: #4A5F78;
  line-height: 1.55;
}

/* ══════════════════════════════════════════════
   MOBILE — CHATBASE FULL-SCREEN TAKEOVER
   ══════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* Launcher stays bottom-right — same as desktop */
  #lc-widget {
    bottom: 20px;
    right: 16px;
  }

  /* Chat window: slide up from bottom, full screen */
  #lc-window {
    /* Full viewport */
    position: fixed;
    inset: 0;            /* top:0 right:0 bottom:0 left:0 */
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    box-shadow: none;
    border: none;

    /* Slide-up animation */
    transform: translateY(100%);
    opacity: 1;           /* always opaque — slide handles visibility */
    transition: transform 0.35s cubic-bezier(.4,0,.2,1);
  }

  #lc-window.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: all;
  }

  /* Header — taller touch area */
  #lc-header {
    padding: 16px 16px;
    padding-top: max(16px, env(safe-area-inset-top));
  }

  #lc-avatar { width: 38px; height: 38px; }

  #lc-agent-name { font-size: 15px; }

  #lc-close-btn {
    width: 36px;
    height: 36px;
  }

  /* Messages — fills available space */
  #lc-messages {
    padding: 14px 12px 8px;
    gap: 10px;
  }

  /* Bubbles — slightly wider on mobile */
  .lc-msg-bubble {
    max-width: 86%;
    font-size: 14.5px;
  }

  /* Quick replies — horizontally scrollable on mobile */
  #lc-quick-replies {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 8px 12px 4px;
    scrollbar-width: none;
  }
  #lc-quick-replies::-webkit-scrollbar { display: none; }

  .lc-quick-btn {
    flex-shrink: 0;
    font-size: 13px;
    padding: 7px 15px;
  }

  /* Input row — comfortable thumb reach */
  #lc-input-area {
    padding: 10px 12px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }

  #lc-input { font-size: 16px; } /* Prevents iOS zoom on focus */

  #lc-send-btn { width: 40px; height: 40px; }

  /* Footer — safe area aware */
  #lc-footer {
    font-size: 11px;
  }

  /* Launcher stays on top of full-screen chat */
  #lc-launcher {
    z-index: 1000000;
  }

  /* Hide launcher when chat is open on mobile — header X button is sufficient */
  #lc-launcher.open {
    display: none;
  }
}

/* Extra small phones */
@media (max-width: 380px) {
  .lc-msg-bubble { font-size: 14px; }
  #lc-agent-name { font-size: 14px; }
}

/* ══════════════════════════════════════════════
   BLINK CURSOR ANIMATION
   ══════════════════════════════════════════════ */
@keyframes lc-blink {
  0%,100% { opacity: 1; }
  50%      { opacity: 0; }
}

@keyframes lc-spin {
  to { transform: rotate(360deg); }
}
