/* ============================================================
   Lahiya AI Support — Chat UI
   Matches drop.lahiya.in brand: deep green + rose-gold + cream
   ============================================================ */

:root {
  --green-deep: #0b2118;
  --green-dark: #0e2a1e;
  --green-mid:  #143a2b;
  --green-card: #122e22;
  --rose-gold:  #c9956c;
  --rose-soft:  #d4a987;
  --cream:      #f8f5f0;
  --cream-dim:  #e8e2d8;
  --text-muted: rgba(248, 245, 240, 0.55);
  --border:     rgba(201, 149, 108, 0.18);
  --border-light: rgba(248, 245, 240, 0.08);
  --shadow-lg:  0 10px 40px rgba(0, 0, 0, 0.35);
  --radius:     14px;
  --radius-sm:  10px;
  --transition: all .25s cubic-bezier(.4, 0, .2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--green-deep);
  color: var(--cream);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

body {
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(201,149,108,0.08), transparent 60%),
    radial-gradient(900px 500px at -10% 100%, rgba(201,149,108,0.05), transparent 55%),
    var(--green-deep);
}

/* ── Shell ─────────────────────────────────────────────── */
.chat-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 820px;
  height: 100dvh;
  margin: 0 auto;
  background: rgba(11, 33, 24, 0.6);
  backdrop-filter: blur(8px);
  border-left: 1px solid var(--border-light);
  border-right: 1px solid var(--border-light);
}

/* ── Header ────────────────────────────────────────────── */
.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: linear-gradient(180deg, rgba(14, 42, 30, 0.95), rgba(14, 42, 30, 0.7));
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.chat-back {
  display: flex;
  width: 36px; height: 36px;
  align-items: center; justify-content: center;
  border-radius: 50%;
  color: var(--cream-dim);
  text-decoration: none;
  transition: var(--transition);
}
.chat-back:hover { background: rgba(255,255,255,0.06); color: var(--rose-gold); }
.chat-back svg { width: 18px; height: 18px; }

.chat-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--rose-gold), #b88159);
  display: flex; align-items: center; justify-content: center;
  color: var(--green-deep);
  box-shadow: 0 4px 14px rgba(201, 149, 108, 0.35);
  position: relative;
}
.chat-avatar svg { width: 22px; height: 22px; }
.chat-avatar::after {
  content: '';
  position: absolute;
  bottom: 2px; right: 2px;
  width: 10px; height: 10px;
  background: #22c55e;
  border: 2px solid var(--green-dark);
  border-radius: 50%;
}

.chat-title { flex: 1; min-width: 0; }
.chat-title h1 {
  font-family: 'Playfair Display', serif;
  font-size: 17px;
  font-weight: 600;
  color: var(--cream);
  letter-spacing: 0.2px;
}
.chat-status {
  font-size: 11.5px;
  color: var(--text-muted);
  display: flex; align-items: center; gap: 6px;
  margin-top: 1px;
}
.chat-status .dot {
  width: 6px; height: 6px;
  background: #22c55e;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(34,197,94,0.6); }
  70%  { box-shadow: 0 0 0 6px rgba(34,197,94,0); }
  100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}

.chat-clear {
  width: 36px; height: 36px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.chat-clear:hover { background: rgba(255,255,255,0.06); color: #e57373; }
.chat-clear svg { width: 16px; height: 16px; }

/* ── Messages ──────────────────────────────────────────── */
.chat-main {
  flex: 1;
  overflow-y: auto;
  padding: 24px 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}
.chat-main::-webkit-scrollbar { width: 6px; }
.chat-main::-webkit-scrollbar-thumb { background: rgba(201,149,108,0.2); border-radius: 3px; }
.chat-main::-webkit-scrollbar-track { background: transparent; }

.msg {
  display: flex;
  gap: 10px;
  max-width: 88%;
  animation: msgIn .35s cubic-bezier(.2,.8,.2,1);
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.msg-bot { align-self: flex-start; }
.msg-user { align-self: flex-end; flex-direction: row-reverse; }

.msg-avatar {
  flex-shrink: 0;
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.msg-bot .msg-avatar {
  background: linear-gradient(135deg, var(--rose-gold), #b88159);
  color: var(--green-deep);
}
.msg-user .msg-avatar {
  background: var(--green-mid);
  color: var(--rose-gold);
  border: 1px solid var(--border);
}
.msg-avatar svg { width: 15px; height: 15px; }

.msg-bubble {
  background: var(--green-card);
  border: 1px solid var(--border-light);
  padding: 11px 14px;
  border-radius: var(--radius);
  color: var(--cream-dim);
  font-size: 14.5px;
  line-height: 1.6;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.msg-bot .msg-bubble  { border-top-left-radius: 4px; }
.msg-user .msg-bubble {
  background: linear-gradient(135deg, var(--rose-gold), #b58258);
  color: #1a1a1a;
  border-color: transparent;
  border-top-right-radius: 4px;
  font-weight: 500;
}

.msg-bubble p { margin: 0 0 8px; }
.msg-bubble p:last-child { margin-bottom: 0; }
.msg-bubble ul, .msg-bubble ol { margin: 6px 0 8px 20px; }
.msg-bubble li { margin: 3px 0; }
.msg-bubble a { color: var(--rose-gold); text-decoration: underline; text-decoration-color: rgba(201,149,108,0.4); }
.msg-bubble strong { color: var(--cream); font-weight: 600; }
.msg-bubble code {
  background: rgba(0,0,0,0.3);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 13px;
}
.msg-user .msg-bubble a       { color: #2a2a2a; }
.msg-user .msg-bubble strong  { color: #1a1a1a; }

.msg-time {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 4px;
  padding: 0 4px;
}

/* ── Typing indicator ──────────────────────────────────── */
.typing { display: flex; gap: 4px; padding: 6px 2px; }
.typing span {
  width: 7px; height: 7px;
  background: var(--rose-gold);
  border-radius: 50%;
  opacity: 0.4;
  animation: typingBounce 1.2s infinite;
}
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%           { transform: translateY(-5px); opacity: 1; }
}

/* Word-by-word stream cursor */
.stream-cursor {
  display: inline-block;
  width: 7px;
  height: 14px;
  vertical-align: -2px;
  background: var(--rose-gold);
  margin-left: 2px;
  animation: caret 1s steps(2) infinite;
}
@keyframes caret { 50% { opacity: 0; } }

/* ── Suggestion chips ──────────────────────────────────── */
.chat-suggest {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 18px 10px;
  transition: opacity .25s, transform .25s;
}
.chat-suggest.hide { opacity: 0; transform: translateY(8px); pointer-events: none; height: 0; padding-top: 0; padding-bottom: 0; overflow: hidden; }
.sgst {
  background: rgba(201, 149, 108, 0.08);
  border: 1px solid var(--border);
  color: var(--cream-dim);
  font-size: 12.5px;
  padding: 8px 14px;
  border-radius: 50px;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}
.sgst:hover {
  background: rgba(201, 149, 108, 0.18);
  color: var(--rose-gold);
  transform: translateY(-1px);
}

/* ── Composer ──────────────────────────────────────────── */
.chat-composer {
  padding: 12px 18px 18px;
  border-top: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(11, 33, 24, 0.0), rgba(11, 33, 24, 0.9) 30%);
}

.composer-box {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: var(--green-card);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 6px 6px 6px 16px;
  transition: var(--transition);
}
.composer-box:focus-within {
  border-color: var(--rose-gold);
  box-shadow: 0 0 0 3px rgba(201, 149, 108, 0.15);
}

#chatInput {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--cream);
  font-family: inherit;
  font-size: 14.5px;
  line-height: 1.5;
  resize: none;
  padding: 10px 0;
  max-height: 140px;
}
#chatInput::placeholder { color: var(--text-muted); }

.send-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--rose-gold), #b88159);
  color: var(--green-deep);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: var(--transition);
  box-shadow: 0 4px 12px rgba(201, 149, 108, 0.3);
}
.send-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}
.send-btn:not(:disabled):hover { transform: scale(1.06); }
.send-btn svg { width: 16px; height: 16px; }

.composer-hint {
  text-align: center;
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* ── Mobile ────────────────────────────────────────────── */
@media (max-width: 600px) {
  .chat-shell { max-width: 100%; border: none; }
  .chat-main { padding: 18px 14px 10px; }
  .chat-composer { padding: 10px 12px 14px; }
  .chat-suggest { padding: 0 14px 8px; }
  .msg { max-width: 92%; }
  .chat-title h1 { font-size: 16px; }
}
