/* ============================================================
   Saif Live Chat — Frontend widget (modern warm redesign)
   ============================================================ */
.lcl-widget {
  position: fixed; right: 20px; bottom: 20px; z-index: 2147483000;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}
.lcl-launcher {
  width: 62px; height: 62px; border-radius: 50%; border: 0;
  background: #1e40af; color: #fff;
  box-shadow: 0 12px 32px -8px rgba(30,64,175,.72), 0 4px 10px rgba(17,24,39,.22);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: transform .18s ease, box-shadow .18s ease;
}
.lcl-launcher:hover { background:#1d4ed8; transform: translateY(-2px) scale(1.03); box-shadow: 0 16px 36px -8px rgba(30,64,175,.78); }

.lcl-panel {
  position: absolute; bottom: 82px; right: 0;
  width: 380px; max-width: calc(100vw - 24px);
  height: 580px; max-height: calc(100vh - 120px);
  background: #fff; border-radius: 22px;
  box-shadow: 0 30px 80px -20px rgba(15,23,42,.35), 0 8px 24px -8px rgba(15,23,42,.15);
  display: none; flex-direction: column; overflow: hidden;
  transform-origin: bottom right;
  animation: lcl-pop .22s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes lcl-pop { from { opacity: 0; transform: scale(.92) translateY(10px); } to { opacity: 1; transform: none; } }
.lcl-widget[data-open="1"] .lcl-panel { display: flex; }

/* Header — clean white with agent card */
.lcl-header {
  background: #fff; color: #111827;
  padding: 16px 18px 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  border-bottom: 1px solid #f1f2f4;
}
.lcl-agent { display: flex; align-items: center; gap: 12px; min-width: 0; }
.lcl-agent .lcl-avatar {
  width: 42px; height: 42px; border-radius: 50%; object-fit: cover;
  border: 2px solid #fff; box-shadow: 0 0 0 2px #4f46e5;
}
.lcl-agent-info { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.lcl-agent-name {
  color: #111827; font-weight: 700; font-size: 15px; text-decoration: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.01em;
}
.lcl-agent-name:hover { text-decoration: underline; }
.lcl-agent-status { font-size: 12px; color: #10b981; display: inline-flex; align-items: center; gap: 6px; font-weight: 500; margin-top: 2px; }
.lcl-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #10b981;
  box-shadow: 0 0 0 2px rgba(16,185,129,.25);
  animation: lcl-pulse 1.8s ease-in-out infinite;
}
@keyframes lcl-pulse { 0%,100% { box-shadow: 0 0 0 2px rgba(16,185,129,.3);} 50% { box-shadow: 0 0 0 7px rgba(16,185,129,0);} }
.lcl-close {
  background: #f3f4f6; border: 0; color: #6b7280; font-size: 20px; cursor: pointer;
  line-height: 1; width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; transition: background .15s;
}
.lcl-close:hover { background: #e5e7eb; color: #111827; }

/* Messages area */
.lcl-messages {
  flex: 1; overflow-y: auto; padding: 18px 16px 12px;
  background: #fafafa;
  display: flex; flex-direction: column; gap: 12px;
  scroll-behavior: smooth;
}
.lcl-messages::-webkit-scrollbar { width: 6px; }
.lcl-messages::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }

.lcl-msg { display: flex; gap: 8px; align-items: flex-end; max-width: 86%; }
.lcl-msg-visitor { align-self: flex-end; flex-direction: row-reverse; }
.lcl-msg-admin   { align-self: flex-start; }
.lcl-avatar {
  width: 30px; height: 30px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
  border: 1px solid #f1f2f4;
}
.lcl-avatar-fallback {
  display: inline-flex; align-items: center; justify-content: center;
  background: #4f46e5; color: #fff; font-size: 12px; font-weight: 700; border: 0;
}
.lcl-msg-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.lcl-msg-visitor .lcl-msg-body { align-items: flex-end; }
.lcl-msg-name { font-size: 11px; color: #9ca3af; text-decoration: none; padding: 0 6px; font-weight: 500; }
.lcl-msg-name:hover { text-decoration: underline; color: #4f46e5; }
.lcl-bubble {
  padding: 10px 14px; border-radius: 18px; font-size: 14px; line-height: 1.45;
  word-wrap: break-word; box-shadow: 0 1px 2px rgba(15,23,42,.04);
}
.lcl-msg-visitor .lcl-bubble {
  background: #4f46e5; color: #fff; border-bottom-right-radius: 6px;
}
.lcl-msg-admin .lcl-bubble {
  background: #fff; color: #111827; border: 1px solid #eef0f3; border-bottom-left-radius: 6px;
}

/* Typing indicator */
.lcl-typing-row { align-self: flex-start; padding-left: 38px; }
.lcl-typing {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px;
  background: #fff; border: 1px solid #eef0f3;
  border-radius: 18px; border-bottom-left-radius: 6px;
}
.lcl-typing::before {
  content: "typing"; font-size: 11px; color: #6b7280; font-weight: 600;
  margin-right: 4px; letter-spacing: .02em;
}
.lcl-typing span { width: 6px; height: 6px; border-radius: 50%; background: #9ca3af; animation: lcl-bounce 1.2s infinite; }
.lcl-typing span:nth-child(2) { animation-delay: .15s; }
.lcl-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes lcl-bounce { 0%,60%,100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }

/* Identity form (required email + social) */
.lcl-identity {
  display: none; flex-direction: column; gap: 10px;
  padding: 18px; border-top: 1px solid #f1f2f4; background: #fff;
}
.lcl-identity-title { margin: 0 0 4px; font-size: 14px; color: #111827; font-weight: 700; letter-spacing: -.01em; }
.lcl-identity input {
  border: 1px solid #e5e7eb; border-radius: 12px; padding: 11px 14px;
  font-size: 14px; outline: none; background: #f9fafb; transition: all .15s;
}
.lcl-identity input:focus { border-color: #4f46e5; background: #fff; box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
.lcl-id-submit {
  background: #1e40af; color: #fff; border: 0; border-radius: 12px;
  padding: 12px; font-weight: 700; cursor: pointer; font-size: 14px; letter-spacing:.01em;
  box-shadow: 0 6px 18px -6px rgba(30,64,175,.72);
  transition: background .15s, box-shadow .15s;
}
.lcl-id-submit:hover { background:#1d4ed8; box-shadow: 0 8px 20px -6px rgba(30,64,175,.78); }

/* Message composer */
.lcl-form {
  display: flex; gap: 8px; padding: 14px 16px;
  border-top: 1px solid #f1f2f4; background: #fff; align-items: center;
}
.lcl-input {
  flex: 1; border: 1px solid #e5e7eb; border-radius: 999px;
  padding: 11px 16px; font-size: 14px; outline: none;
  background: #f9fafb; transition: all .15s;
}
.lcl-input:focus { border-color: #4f46e5; background: #fff; box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
.lcl-send {
  width: 42px; height: 42px; border-radius: 50%; border: 0;
  background: #1e40af; color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  transition: background .15s, transform .1s;
}
.lcl-send:hover { background:#1d4ed8; }
.lcl-send:active { transform: scale(.94); }

/* Attach button */
.lcl-attach {
  width: 42px; height: 42px; border-radius: 50%; border: 0;
  background: #eef2ff; color: #4f46e5; cursor: pointer;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  transition: background .15s, color .15s, transform .1s;
}
.lcl-attach:hover { background: #e0e7ff; color: #4338ca; }
.lcl-attach:active { transform: scale(.94); }
.lcl-attach svg { width: 20px; height: 20px; }

/* Typing indicator inside header (under "Online now") */
.lcl-agent-status.is-typing { color: #4f46e5; }
.lcl-agent-status.is-typing .lcl-dot {
  background: #4f46e5; box-shadow: 0 0 0 2px rgba(79,70,229,.25);
}

/* Attachments inside bubbles */
.lcl-att { display: inline-block; text-decoration: none; margin-bottom: 4px; max-width: 240px; }
.lcl-att-img img { display: block; max-width: 240px; max-height: 220px; border-radius: 14px; object-fit: cover; box-shadow: 0 1px 2px rgba(15,23,42,.06); }
.lcl-att-file {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px;
  background: rgba(255,255,255,.9); border: 1px solid #e5e7eb; border-radius: 14px;
  color: #111827; font-size: 13px; font-weight: 500;
}
.lcl-msg-visitor .lcl-att-file { background: rgba(255,255,255,.15); border-color: rgba(255,255,255,.35); color: #fff; }
.lcl-att-icon { font-size: 16px; }
.lcl-att-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Attachment preview above composer */
.lcl-attach-preview {
  display: none; align-items: center; gap: 8px;
  padding: 8px 14px; margin: 0 16px 8px; border: 1px dashed #d1d5db; border-radius: 12px;
  background: #f9fafb; position: relative;
}
.lcl-attach-preview img { width: 40px; height: 40px; object-fit: cover; border-radius: 8px; }
.lcl-attach-preview .lcl-att-name { font-size: 12px; color: #374151; }
.lcl-attach-preview .lcl-att-remove {
  margin-left: auto; background: #fff; border: 1px solid #e5e7eb; border-radius: 50%;
  width: 22px; height: 22px; line-height: 1; font-size: 14px; cursor: pointer; color: #6b7280;
}

/* Seen indicator */
.lcl-seen {
  font-size: 10px; color: #9ca3af; font-weight: 600; padding: 0 6px; margin-top: 2px;
  text-align: right; letter-spacing: .02em;
}
.lcl-msg-visitor .lcl-seen::before { content: "✓✓ "; color: #10b981; }

/* Footer branding */
.lcl-brand {
  text-align: center; padding: 6px 0 10px; font-size: 11px; color: #9ca3af; background: #fff;
}
.lcl-brand a { color: #6b7280; text-decoration: none; font-weight: 500; }

/* Unread ping on launcher */
.lcl-unread {
  position: absolute; top: -2px; right: -2px;
  background: #ef4444; color: #fff; font-size: 11px; font-weight: 700;
  min-width: 20px; height: 20px; border-radius: 999px;
  display: none; align-items: center; justify-content: center;
  border: 2px solid #fff;
}

@media (max-width: 480px) {
  .lcl-widget { right: 12px; bottom: 12px; }
  .lcl-panel { width: calc(100vw - 24px); height: calc(100vh - 100px); bottom: 78px; right: 0; border-radius: 20px; }
}
/* Identity live-validation rows */
.lcl-identity .lcl-id-row{display:flex;align-items:center;gap:8px;margin:0 0 6px;}
.lcl-identity .lcl-id-row input{flex:1;}
.lcl-identity .lcl-id-status{width:18px;height:18px;flex-shrink:0;display:inline-flex;align-items:center;justify-content:center;font-size:14px;line-height:1;}
.lcl-identity .lcl-id-status.ok{color:#059669;}
.lcl-identity .lcl-id-status.bad{color:#dc2626;}
.lcl-identity .lcl-id-status.loading{color:#6b7280;animation:lclSpin 1s linear infinite;}
@keyframes lclSpin{to{transform:rotate(360deg);}}
.lcl-identity .lcl-id-submit[disabled]{opacity:.75;cursor:not-allowed;filter:saturate(.85);}
