/*
 * chitralekha-chat.css
 * Floating chat / help widget — Chitralekha Group
 * Premium, compact, mobile-safe
 */

/* ── FAB trigger button ─────────────────────────────────── */
.cl-chat-btn {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 1200;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--dark, #141410);
  color: rgba(255,255,255,.85);
  border: 1px solid rgba(184,156,110,.35);
  border-radius: 40px;
  padding: 11px 18px 11px 14px;
  cursor: pointer;
  font-family: var(--fb, 'DM Sans', system-ui, sans-serif);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: .06em;
  box-shadow: 0 4px 20px rgba(0,0,0,.28);
  transition: background .2s, border-color .2s, transform .2s;
  white-space: nowrap;
}
.cl-chat-btn:hover {
  background: #1e1e18;
  border-color: rgba(184,156,110,.6);
  transform: translateY(-1px);
}
.cl-chat-btn:focus-visible {
  outline: 2px solid #b89c6e;
  outline-offset: 3px;
}
.cl-chat-btn-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #b89c6e;
  flex-shrink: 0;
  position: relative;
}
.cl-chat-btn-dot::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(184,156,110,.5);
  animation: cl-pulse 2.4s ease infinite;
  will-change: transform, opacity;
}
.cl-chat-btn.cl-chat--open .cl-chat-btn-dot::before {
  animation: none;
}
@keyframes cl-pulse {
  0%, 100% { transform: scale(1);   opacity: .6; }
  50%       { transform: scale(2.6); opacity: 0;  }
}

/* ── Chat panel ─────────────────────────────────────────── */
.cl-chat-panel {
  position: fixed;
  bottom: 84px;
  right: 28px;
  z-index: 1200;
  width: 360px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 120px);
  background: var(--white, #fff);
  border: 1px solid var(--border, #e6e2d8);
  border-radius: 8px;
  box-shadow: 0 8px 40px rgba(0,0,0,.14);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* hidden by default */
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px) scale(.97);
  transition: opacity .25s ease, transform .25s ease;
}
.cl-chat-panel.cl-chat--visible {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0) scale(1);
}

/* ── Panel header ───────────────────────────────────────── */
.cl-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--dark, #141410);
  flex-shrink: 0;
}
.cl-chat-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.cl-chat-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(184,156,110,.15);
  border: 1px solid rgba(184,156,110,.3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.cl-chat-avatar svg { fill: #b89c6e; }
.cl-chat-header-name {
  font-family: var(--fb, 'DM Sans', system-ui, sans-serif);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .06em;
  color: rgba(255,255,255,.9);
}
.cl-chat-header-sub {
  font-size: 10px;
  color: rgba(184,156,110,.65);
  letter-spacing: .05em;
  margin-top: 1px;
}
.cl-chat-close {
  background: none;
  border: none;
  color: rgba(255,255,255,.35);
  cursor: pointer;
  padding: 6px;
  line-height: 1;
  border-radius: 4px;
  transition: color .15s, background .15s;
  display: flex;
  align-items: center;
}
.cl-chat-close:hover { color: rgba(255,255,255,.8); background: rgba(255,255,255,.06); }
.cl-chat-close:focus-visible { outline: 2px solid #b89c6e; outline-offset: 2px; }

/* ── Messages area ──────────────────────────────────────── */
.cl-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 120px;
  max-height: 280px;
  background: var(--cream, #faf8f4);
  scroll-behavior: smooth;
}
.cl-chat-messages::-webkit-scrollbar { width: 4px; }
.cl-chat-messages::-webkit-scrollbar-thumb { background: var(--border, #e6e2d8); border-radius: 2px; }

/* Message bubbles */
.cl-msg {
  max-width: 88%;
  font-size: 13px;
  line-height: 1.55;
  border-radius: 6px;
  padding: 9px 13px;
}
.cl-msg-bot {
  background: var(--white, #fff);
  border: 1px solid var(--border, #e6e2d8);
  color: var(--ink, #181815);
  align-self: flex-start;
  border-radius: 2px 6px 6px 6px;
}
.cl-msg-user {
  background: var(--dark, #141410);
  color: rgba(255,255,255,.85);
  align-self: flex-end;
  border-radius: 6px 2px 6px 6px;
  font-size: 12px;
}

/* Quick reply buttons */
.cl-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-self: flex-start;
  max-width: 100%;
}
.cl-qr-btn {
  background: none;
  border: 1px solid var(--border, #e6e2d8);
  color: var(--ink, #181815);
  font-family: var(--fb, 'DM Sans', system-ui, sans-serif);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: .04em;
  padding: 6px 10px;
  border-radius: 20px;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
  white-space: nowrap;
}
.cl-qr-btn:hover {
  border-color: var(--gold, #b89c6e);
  color: var(--gold-d, #8a6f43);
  background: var(--gold-bg, rgba(184,156,110,.06));
}
.cl-qr-btn:focus-visible { outline: 2px solid #b89c6e; outline-offset: 2px; }

/* Enquiry prompt link */
.cl-enquiry-prompt {
  align-self: flex-start;
  font-size: 12px;
  color: var(--gold-d, #8a6f43);
  cursor: pointer;
  background: none;
  border: none;
  padding: 4px 0;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-family: var(--fb, 'DM Sans', system-ui, sans-serif);
  transition: color .15s;
}
.cl-enquiry-prompt:hover { color: var(--ink, #181815); }

/* ── Enquiry form ───────────────────────────────────────── */
.cl-chat-form-wrap {
  padding: 14px 16px 16px;
  border-top: 1px solid var(--border, #e6e2d8);
  background: var(--white, #fff);
  overflow-y: auto;
  max-height: 320px;
  flex-shrink: 0;
}
.cl-chat-form-wrap.cl-form--hidden { display: none; }
.cl-form-title {
  font-family: var(--fd, 'Cormorant Garamond', Georgia, serif);
  font-size: 16px;
  font-weight: 300;
  color: var(--ink, #181815);
  margin-bottom: 12px;
  line-height: 1.2;
}
.cl-form-title em { font-style: italic; color: var(--gold, #b89c6e); }
.cl-form-row { margin-bottom: 10px; }
.cl-form-row label {
  display: block;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-l, #5a5a52);
  margin-bottom: 5px;
}
.cl-form-row input,
.cl-form-row select,
.cl-form-row textarea {
  width: 100%;
  box-sizing: border-box;
  font-family: var(--fb, 'DM Sans', system-ui, sans-serif);
  font-size: 12px;
  color: var(--ink, #181815);
  background: var(--cream, #faf8f4);
  border: 1px solid var(--border, #e6e2d8);
  border-radius: 3px;
  padding: 8px 10px;
  transition: border-color .15s;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.cl-form-row select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%235a5a52'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
  cursor: pointer;
}
.cl-form-row textarea { resize: vertical; min-height: 70px; }
.cl-form-row input:focus,
.cl-form-row select:focus,
.cl-form-row textarea:focus { border-color: var(--gold, #b89c6e); }
.cl-form-row input.cl-err,
.cl-form-row select.cl-err,
.cl-form-row textarea.cl-err { border-color: #c0392b; }

/* Consent row */
.cl-consent-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-bottom: 12px;
  margin-top: 4px;
}
.cl-consent-row input[type="checkbox"] {
  width: 14px;
  height: 14px;
  min-width: 14px;
  margin-top: 2px;
  cursor: pointer;
  accent-color: var(--gold, #b89c6e);
  border: 1px solid var(--border, #e6e2d8);
  border-radius: 2px;
}
.cl-consent-row label {
  font-size: 11px;
  line-height: 1.5;
  color: var(--ink-l, #5a5a52);
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}
.cl-consent-row a { color: var(--gold-d, #8a6f43); }

/* Submit button */
.cl-form-submit {
  width: 100%;
  background: var(--dark, #141410);
  color: rgba(255,255,255,.9);
  border: none;
  border-radius: 3px;
  padding: 11px 16px;
  font-family: var(--fb, 'DM Sans', system-ui, sans-serif);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background .2s;
}
.cl-form-submit:hover { background: #2a2a24; }
.cl-form-submit:disabled { background: var(--border, #e6e2d8); color: var(--ink-f, #a0a094); cursor: not-allowed; }
.cl-form-submit:focus-visible { outline: 2px solid #b89c6e; outline-offset: 2px; }

/* Status message */
.cl-form-status {
  font-size: 12px;
  line-height: 1.5;
  margin-top: 10px;
  padding: 9px 12px;
  border-radius: 3px;
  display: none;
}
.cl-form-status.cl-status--ok {
  display: block;
  background: rgba(39,174,96,.08);
  border: 1px solid rgba(39,174,96,.3);
  color: #1e7e34;
}
.cl-form-status.cl-status--err {
  display: block;
  background: rgba(192,57,43,.07);
  border: 1px solid rgba(192,57,43,.25);
  color: #922b21;
}

/* Back to chat link */
.cl-back-btn {
  background: none;
  border: none;
  font-family: var(--fb, 'DM Sans', system-ui, sans-serif);
  font-size: 11px;
  color: var(--ink-l, #5a5a52);
  cursor: pointer;
  padding: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 4px;
  letter-spacing: .04em;
  transition: color .15s;
}
.cl-back-btn:hover { color: var(--gold-d, #8a6f43); }

/* ── Honeypot field ─────────────────────────────────────── */
.cl-hp { position: absolute; left: -9999px; opacity: 0; pointer-events: none; }

/* ── Mobile tweaks ──────────────────────────────────────── */
@media (max-width: 480px) {
  .cl-chat-btn  { bottom: 16px; right: 16px; padding: 10px 15px 10px 12px; }
  .cl-chat-panel {
    bottom: 70px;
    right: 16px;
    left: 16px;
    width: auto;
    max-width: 100%;
    max-height: calc(100vh - 90px);
  }
}
