/* =====================================================
   CHAT SYSTEM — chat.css
   Crystal Aid
   ===================================================== */

/* ── Step wrappers ────────────────────────────────── */
.chat-step-heading {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: var(--space-5);
}
.chat-step-heading h2 { margin: 0; font-size: 22px; }
.chat-step-num {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-deep), #B8860B);
  color: #fff; font-size: 17px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.chat-back-btn {
  background: none; border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 14px; font-size: 13px;
  cursor: pointer; color: var(--ink-soft); transition: all .15s;
}
.chat-back-btn:hover { background: var(--parchment); color: var(--ink); }

/* ── Pandits grid ─────────────────────────────────── */
.pandits-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-4);
}
.pandit-card {
  background: linear-gradient(135deg, #1a0e2e 0%, #110820 100%);
  border: 1px solid rgba(184,134,75,0.25);
  border-radius: 14px;
  padding: var(--space-5);
  cursor: pointer;
  transition: all .2s;
  position: relative;
  overflow: hidden;
}
.pandit-card:hover { border-color: rgba(184,134,75,0.6); transform: translateY(-2px); box-shadow: 0 8px 32px rgba(0,0,0,0.35); }
.pandit-card.selected { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(184,134,75,0.35); }
.pandit-card-top { display: flex; align-items: flex-start; gap: 14px; margin-bottom: var(--space-4); }
.pandit-avatar {
  width: 54px; height: 54px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-deep), #8B5CF6);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700; color: #fff;
  flex-shrink: 0; position: relative;
}
.pandit-online-badge {
  position: absolute; bottom: 2px; right: 2px;
  width: 14px; height: 14px; border-radius: 50%;
  background: #22c55e; border: 2px solid #1a0e2e;
}
.pandit-offline-badge {
  position: absolute; bottom: 2px; right: 2px;
  width: 14px; height: 14px; border-radius: 50%;
  background: #6b7280; border: 2px solid #1a0e2e;
}
.pandit-name { font-size: 16px; font-weight: 700; color: #fff; margin-bottom: 3px; }
.pandit-spec { font-size: 12.5px; color: rgba(255,255,255,0.55); }
.pandit-rating { display: flex; align-items: center; gap: 5px; margin-top: 5px; }
.pandit-rating span { font-size: 13px; color: var(--gold); font-weight: 600; }
.pandit-rating small { font-size: 11px; color: rgba(255,255,255,0.4); }
.pandit-bio { font-size: 12.5px; color: rgba(255,255,255,0.5); line-height: 1.55; margin-bottom: var(--space-4); }
.pandit-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: var(--space-4); }
.pandit-tag {
  background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px; padding: 3px 10px; font-size: 11.5px;
  color: rgba(255,255,255,0.6); font-family: var(--font-mono);
}
.pandit-select-btn {
  width: 100%; padding: 11px; border: none;
  background: linear-gradient(135deg, var(--gold-deep), #B8860B);
  color: #fff; border-radius: 10px; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all .2s;
}
.pandit-select-btn:hover { opacity: .9; }
.pandit-online-status { font-size: 12px; font-family: var(--font-mono); }
.pandit-online-status.online { color: #4ade80; }
.pandit-online-status.offline { color: rgba(255,255,255,0.35); }

/* ── Form card ────────────────────────────────────── */
.selected-pandit-bar {
  display: flex; align-items: center; gap: 12px;
  padding: var(--space-4) var(--space-5);
  background: linear-gradient(135deg, #1a0e2e, #2d1b4e);
  border: 1px solid rgba(184,134,75,0.3); border-radius: 12px;
  margin-bottom: var(--space-5); color: #fff;
}
.selected-pandit-bar .pa { font-size: 24px; }
.selected-pandit-bar .pn { font-weight: 600; font-size: 15px; }
.selected-pandit-bar .ps { font-size: 12.5px; color: rgba(255,255,255,0.55); margin-top: 2px; }

.chat-form-card {
  background: linear-gradient(135deg, #1a0e2e 0%, #0d0820 100%);
  border: 1px solid rgba(184,134,75,0.3);
  border-radius: 16px; padding: var(--space-6);
}
.chat-form-card label { color: rgba(255,255,255,0.75); font-size: 13px; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .04em; }
.chat-form-card input, .chat-form-card select, .chat-form-card textarea {
  background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.15);
  color: #fff; border-radius: 8px; padding: 11px 14px; font-size: 14px;
}
.chat-form-card input::placeholder, .chat-form-card textarea::placeholder { color: rgba(255,255,255,0.3); }
.chat-form-card input:focus, .chat-form-card textarea:focus { outline: none; border-color: rgba(184,134,75,0.7); background: rgba(255,255,255,0.1); }
.chat-form-card select option { background: #1a0e2e; }
.chat-form-card textarea { resize: vertical; min-height: 90px; }

/* ── Chat window ──────────────────────────────────── */
.chat-window {
  background: var(--cream); border: 1px solid var(--line);
  border-radius: 16px; overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,0.1);
  display: flex; flex-direction: column;
  min-height: 520px; max-height: 75vh;
}
.chat-header {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 20px;
  background: linear-gradient(135deg, #1a0e2e, #2d1b4e);
  color: #fff; flex-shrink: 0;
}
.chat-header-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-deep), #8B5CF6);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.chat-header-name  { font-size: 16px; font-weight: 700; }
.chat-header-status{ display: flex; align-items: center; gap: 6px; font-size: 12.5px; opacity: .75; margin-top: 3px; }
.chat-online-dot   { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; flex-shrink: 0; }
.chat-online-dot.offline { background: #6b7280; }
.chat-header-actions { margin-left: auto; }
.chat-free-badge {
  background: rgba(184,134,75,0.25); border: 1px solid rgba(184,134,75,0.5);
  border-radius: 20px; padding: 4px 12px; font-size: 12px;
  font-family: var(--font-mono); color: var(--gold);
}

/* Messages area */
.chat-messages {
  flex: 1; overflow-y: auto; padding: 20px;
  display: flex; flex-direction: column; gap: 12px;
  background: #faf9f7;
}
.chat-msg { display: flex; gap: 10px; max-width: 80%; }
.chat-msg.customer { align-self: flex-end; flex-direction: row-reverse; }
.chat-msg.system   { align-self: center; max-width: 90%; }
.chat-msg-bubble {
  padding: 10px 14px; border-radius: 16px;
  font-size: 14px; line-height: 1.6; word-break: break-word;
}
.chat-msg.pandit   .chat-msg-bubble { background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; color: var(--ink); }
.chat-msg.customer .chat-msg-bubble { background: linear-gradient(135deg, var(--gold-deep), #B8860B); color: #fff; border-bottom-right-radius: 4px; }
.chat-msg.system   .chat-msg-bubble { background: rgba(184,134,75,0.1); border: 1px dashed rgba(184,134,75,0.3); color: var(--ink-soft); font-size: 13px; text-align: center; border-radius: 12px; }
.chat-msg-avatar {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, #8B5CF6, #6D28D9);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff; align-self: flex-end;
}
.chat-msg-time { font-size: 10.5px; color: var(--ink-faint); margin-top: 4px; text-align: right; }

/* Typing indicator */
.chat-typing { display: flex; gap: 5px; align-items: center; padding: 8px 14px; }
.chat-typing-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-soft); animation: chat-bounce .9s infinite; }
.chat-typing-dot:nth-child(2) { animation-delay: .15s; }
.chat-typing-dot:nth-child(3) { animation-delay: .3s; }
@keyframes chat-bounce { 0%,60%,100% { transform:translateY(0); } 30% { transform:translateY(-6px); } }

/* Input area */
.chat-input-area {
  display: flex; gap: 10px; align-items: flex-end;
  padding: 14px 16px; border-top: 1px solid var(--line);
  background: #fff; flex-shrink: 0;
}
.chat-input {
  flex: 1; resize: none; border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 14px; font-size: 14px;
  font-family: var(--font-body); line-height: 1.5;
  max-height: 120px; outline: none; transition: border-color .2s;
}
.chat-input:focus { border-color: var(--gold); }
.chat-send-btn {
  width: 44px; height: 44px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-deep), #B8860B);
  border: none; color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all .2s;
}
.chat-send-btn:hover:not(:disabled) { transform: scale(1.08); }
.chat-send-btn:disabled { opacity: .45; cursor: not-allowed; }

/* ── Floating chat button (site-wide) ─────────────── */
.chat-float-btn {
  position: fixed; bottom: 90px; right: 20px; z-index: 999;
  width: 58px; height: 58px; border-radius: 50%;
  background: linear-gradient(135deg, #8B5CF6, #6D28D9);
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 20px rgba(109,40,217,0.45);
  transition: all .2s; text-decoration: none;
}
.chat-float-btn:hover { transform: scale(1.1); box-shadow: 0 6px 28px rgba(109,40,217,0.6); }
.chat-float-btn svg { width: 26px; height: 26px; fill: #fff; }
.chat-float-badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--gold); color: var(--ink);
  border-radius: 10px; padding: 1px 7px;
  font-size: 10px; font-weight: 700; font-family: var(--font-mono);
  border: 2px solid #fff;
}
