/* ================================================
   LiveChat Pro v2 – Widget Styles
   ================================================ */

:root {
  --lcp-header:   #111827;
  --lcp-accent:   #6366f1;
  --lcp-wa:       #25D366;
  --lcp-white:    #ffffff;
  --lcp-bg:       #f8fafc;
  --lcp-border:   #e2e8f0;
  --lcp-text:     #1e293b;
  --lcp-muted:    #64748b;
  --lcp-radius:   18px;
  --lcp-shadow:   0 24px 64px rgba(0,0,0,.18), 0 6px 20px rgba(0,0,0,.1);
  --lcp-w:        370px;
  --lcp-h:        560px;
  --lcp-z:        999999;
}

/* ── Root ── */
#lcp-root {
  position: fixed;
  z-index: var(--lcp-z);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--lcp-text);
}
#lcp-root.lcp-pos-bottom-right { bottom: 24px; right: 24px; }
#lcp-root.lcp-pos-bottom-left  { bottom: 24px; left:  24px; }

/* ── Launcher bubble ── */
#lcp-launcher {
  width: 60px; height: 60px;
  border-radius: 50%;
  background: var(--lcp-accent);
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 24px rgba(99,102,241,.5);
  transition: transform .2s, box-shadow .2s;
  position: relative;
  outline: none;
}
#lcp-launcher:hover  { transform: scale(1.09); box-shadow: 0 10px 32px rgba(99,102,241,.65); }
#lcp-launcher:active { transform: scale(.95); }

.lcp-ico { display: flex; align-items: center; justify-content: center; }
.lcp-ico svg { width: 26px; height: 26px; color: #fff; display: block; }

.lcp-badge {
  position: absolute; top: 1px; right: 1px;
  background: #ef4444; color: #fff;
  font-size: 11px; font-weight: 700;
  min-width: 18px; height: 18px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px; border: 2px solid #fff;
  animation: lcpPop .3s cubic-bezier(.34,1.56,.64,1);
}
@keyframes lcpPop { from { transform: scale(0); } to { transform: scale(1); } }

/* ── Panel ── */
.lcp-panel {
  position: absolute;
  bottom: 72px;
  width: var(--lcp-w);
  height: var(--lcp-h);
  background: var(--lcp-white);
  border-radius: var(--lcp-radius);
  box-shadow: var(--lcp-shadow);
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: lcpSlide .28s cubic-bezier(.34,1.4,.64,1);
}
#lcp-root.lcp-pos-bottom-right .lcp-panel { right: 0; transform-origin: bottom right; }
#lcp-root.lcp-pos-bottom-left  .lcp-panel { left:  0; transform-origin: bottom left;  }

@keyframes lcpSlide {
  from { opacity: 0; transform: scale(.86) translateY(16px); }
  to   { opacity: 1; transform: scale(1)   translateY(0); }
}

/* ── Header ── */
.lcp-hdr {
  background: var(--lcp-header);
  padding: 15px 16px;
  display: flex; align-items: center; gap: 11px;
  flex-shrink: 0;
}
.lcp-hdr-av {
  position: relative;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--lcp-accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 800; color: #fff;
  flex-shrink: 0;
}
.lcp-dot {
  position: absolute; bottom: 1px; right: 1px;
  width: 11px; height: 11px; border-radius: 50%;
  background: #22c55e; border: 2px solid var(--lcp-header);
}
.lcp-hdr-name { color: #fff; font-weight: 700; font-size: 15px; }
.lcp-hdr-sub  { color: rgba(255,255,255,.6); font-size: 11.5px; }
.lcp-hdr-close {
  margin-left: auto;
  background: transparent; border: none; cursor: pointer;
  color: rgba(255,255,255,.65); padding: 5px;
  border-radius: 7px; display: flex; align-items: center;
  transition: background .15s, color .15s; outline: none;
}
.lcp-hdr-close:hover { background: rgba(255,255,255,.12); color: #fff; }
.lcp-hdr-close svg { width: 17px; height: 17px; }

/* ── Screens ── */
.lcp-screen { display: none; flex-direction: column; flex: 1; overflow: hidden; }
.lcp-s-active { display: flex; }

/* ── Pre-chat screen ── */
#lcp-s-prechat { background: var(--lcp-bg); overflow-y: auto; }
.lcp-prechat-body { padding: 28px 22px 22px; }
.lcp-wave { font-size: 40px; margin-bottom: 10px; }
.lcp-prechat-body h2 { font-size: 20px; font-weight: 800; margin: 0 0 6px; color: var(--lcp-text); }
.lcp-prechat-body p  { color: var(--lcp-muted); margin: 0 0 20px; }

.lcp-lbl {
  display: block; font-size: 11.5px; font-weight: 700;
  color: var(--lcp-muted); text-transform: uppercase;
  letter-spacing: .06em; margin-bottom: 5px;
}
.lcp-lbl span { font-weight: 400; text-transform: none; letter-spacing: 0; }
.lcp-req { color: #ef4444; }

.lcp-inp {
  width: 100%; box-sizing: border-box;
  padding: 10px 13px; border: 1.5px solid var(--lcp-border);
  border-radius: 10px; font-size: 14px; color: var(--lcp-text);
  background: #fff; font-family: inherit;
  transition: border .15s, box-shadow .15s; outline: none;
  margin-bottom: 14px;
}
.lcp-inp:focus { border-color: var(--lcp-accent); box-shadow: 0 0 0 3px rgba(99,102,241,.15); }
.lcp-textarea  { resize: none; }

.lcp-btn-primary {
  width: 100%; padding: 12px; border: none; border-radius: 10px;
  background: var(--lcp-accent); color: #fff;
  font-size: 15px; font-weight: 700; cursor: pointer;
  font-family: inherit; transition: opacity .15s, transform .1s;
  outline: none;
}
.lcp-btn-primary:hover  { opacity: .88; }
.lcp-btn-primary:active { transform: scale(.98); }

/* ── Chat screen ── */
#lcp-s-chat { background: var(--lcp-bg); }

.lcp-msgs {
  flex: 1; overflow-y: auto; padding: 14px 13px 8px;
  display: flex; flex-direction: column; gap: 10px;
  scroll-behavior: smooth;
}
.lcp-msgs::-webkit-scrollbar { width: 3px; }
.lcp-msgs::-webkit-scrollbar-thumb { background: var(--lcp-border); border-radius: 3px; }

/* Message rows */
.lcp-msg-row { display: flex; gap: 8px; max-width: 90%; animation: lcpMsgIn .2s ease; }
@keyframes lcpMsgIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.lcp-msg-row.lcp-from-visitor { align-self: flex-end; flex-direction: row-reverse; }
.lcp-msg-row.lcp-from-bot,
.lcp-msg-row.lcp-from-agent   { align-self: flex-start; }

.lcp-av {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--lcp-accent); color: #fff;
  font-size: 11px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: auto;
}
.lcp-from-visitor .lcp-av { background: #ddd6fe; color: #4f46e5; }

.lcp-bubble {
  padding: 9px 13px; border-radius: 14px;
  font-size: 13.5px; line-height: 1.5; word-break: break-word;
}
.lcp-from-visitor .lcp-bubble {
  background: var(--lcp-accent); color: #fff;
  border-bottom-right-radius: 3px;
}
.lcp-from-bot .lcp-bubble,
.lcp-from-agent .lcp-bubble {
  background: #fff; color: var(--lcp-text);
  border: 1px solid var(--lcp-border);
  border-bottom-left-radius: 3px;
}
.lcp-msg-time {
  font-size: 10px; color: var(--lcp-muted);
  padding: 2px 4px 0; text-align: right;
}
.lcp-from-bot .lcp-msg-time,
.lcp-from-agent .lcp-msg-time { text-align: left; }

/* Typing dots */
.lcp-typing .lcp-bubble {
  display: flex; gap: 4px; align-items: center;
  padding: 12px 14px;
}
.lcp-typing .lcp-bubble span {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--lcp-muted);
  animation: lcpDot 1.3s infinite;
}
.lcp-typing .lcp-bubble span:nth-child(2) { animation-delay: .2s; }
.lcp-typing .lcp-bubble span:nth-child(3) { animation-delay: .4s; }
@keyframes lcpDot {
  0%,80%,100% { transform: translateY(0); }
  40%          { transform: translateY(-5px); }
}

/* ── WhatsApp inline form ── */
.lcp-wa-form {
  margin: 0 12px 10px;
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
  border: 1.5px solid #86efac;
  border-radius: 12px; padding: 12px 14px;
  animation: lcpMsgIn .25s ease;
}
.lcp-wa-form-inner {
  display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
}
.lcp-wa-icon {
  width: 34px; height: 34px; border-radius: 50%;
  background: #25D366; display: flex;
  align-items: center; justify-content: center; flex-shrink: 0;
}
.lcp-wa-icon svg { width: 18px; height: 18px; color: #fff; }
.lcp-wa-form-text strong { display: block; color: #166534; font-size: 13.5px; }
.lcp-wa-form-text span   { color: #15803d; font-size: 12px; }
.lcp-wa-inputs { display: flex; gap: 8px; }
.lcp-wa-inputs .lcp-inp {
  flex: 1; margin-bottom: 0; font-size: 13px; padding: 8px 11px;
}
.lcp-btn-wa {
  background: #25D366; color: #fff; border: none;
  border-radius: 9px; padding: 8px 14px;
  font-size: 13px; font-weight: 700; cursor: pointer;
  white-space: nowrap; font-family: inherit;
  transition: background .15s; outline: none;
}
.lcp-btn-wa:hover { background: #16a34a; }

/* ── Input row ── */
.lcp-input-row {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 9px 11px; border-top: 1px solid var(--lcp-border);
  background: #fff; flex-shrink: 0;
}
.lcp-msg-inp {
  flex: 1; border: 1.5px solid var(--lcp-border); border-radius: 10px;
  padding: 9px 12px; font-size: 14px; resize: none; outline: none;
  font-family: inherit; max-height: 96px; overflow-y: auto;
  transition: border .15s, box-shadow .15s; color: var(--lcp-text);
  line-height: 1.4; background: #fff;
}
.lcp-msg-inp:focus { border-color: var(--lcp-accent); box-shadow: 0 0 0 3px rgba(99,102,241,.14); }

.lcp-send-btn {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--lcp-accent); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: opacity .15s, transform .1s; outline: none;
}
.lcp-send-btn svg { width: 16px; height: 16px; color: #fff; }
.lcp-send-btn:hover  { opacity: .88; }
.lcp-send-btn:active { transform: scale(.93); }

.lcp-footer-note { text-align: center; font-size: 11px; color: #cbd5e1; padding: 3px 0 7px; }

/* ── Centre screen (WA sent confirmation) ── */
#lcp-s-wa-sent { background: var(--lcp-bg); }
.lcp-center-screen {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 32px 28px; text-align: center;
}
.lcp-big-icon { font-size: 56px; margin-bottom: 16px; }
.lcp-center-screen h2 { font-size: 20px; font-weight: 800; margin: 0 0 10px; }
.lcp-center-screen p  { color: var(--lcp-muted); margin: 0 0 24px; max-width: 280px; }

@keyframes lcpSpinIn {
  from { transform: scale(0) rotate(-45deg); opacity: 0; }
  to   { transform: scale(1) rotate(0); opacity: 1; }
}
.lcp-spin-in { animation: lcpSpinIn .4s cubic-bezier(.34,1.56,.64,1); }

/* ── Mobile ── */
@media (max-width: 430px) {
  :root { --lcp-w: calc(100vw - 18px); --lcp-h: 72vh; }
  #lcp-root.lcp-pos-bottom-right { right: 9px; }
  #lcp-root.lcp-pos-bottom-left  { left:  9px; }
}
