/* ============================================================
   SYNAPTX — CHATBOT PAGE STYLES
   Combina: estética dark de index-v2 + widget de chat_salomon
   ============================================================ */

/* --- TOKENS ------------------------------------------------- */
:root {
  --pink:        #ff009d;
  --violet:      #ad37f1;
  --dark:        #0e0e12;
  --dark2:       #16161e;
  --glass:       rgba(255,255,255,0.06);
  --border:      rgba(255,255,255,0.10);
  --grad:        linear-gradient(135deg, var(--violet), var(--pink));
  --text:        #f0f0f5;
  --muted:       rgba(240,240,245,0.55);
  /* widget específico */
  --w-bg:        #1a1a24;
  --w-surface:   #22222e;
  --w-border:    rgba(255,255,255,0.10);
  --w-bubble-bot:   #2a2a38;
  --w-bubble-user-from: var(--violet);
  --w-bubble-user-to:   var(--pink);
  --w-radius:    20px;
  --w-radius-sm: 12px;
}

/* --- RESET -------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Poppins', 'Raleway', sans-serif;
  background: var(--dark);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }

/* --- VIDEO BG ---------------------------------------------- */
#video-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
#video-bg video {
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0.14;
}
#video-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg,
    rgba(14,14,18,0.60) 0%,
    rgba(14,14,18,0.85) 60%,
    rgba(14,14,18,0.97) 100%);
}

/* --- PAGE WRAPPER ------------------------------------------ */
.page {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* --- NAV ---------------------------------------------------- */
nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 999;
  padding: 16px 0;
  background: rgba(14,14,18,0.75);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 28px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
}
.logo img { height: 26px; }
.logo-text {
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.nav-back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
  transition: color 0.25s;
  padding: 8px 0;
}
.nav-back:hover { color: var(--text); }
.nav-back i { font-size: 0.75rem; }

/* --- MAIN CONTENT ------------------------------------------ */
.chat-page-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 96px 20px 40px;
  min-height: 100vh;
}

/* --- PAGE HEADER ------------------------------------------- */
.chat-page-header {
  text-align: center;
  margin-bottom: 32px;
  max-width: 560px;
}
.chat-page-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 5px 14px;
  border-radius: 50px;
  margin-bottom: 14px;
}
.chat-page-badge .dot-live {
  width: 6px; height: 6px;
  border-radius: 50%;
  animation: pulseLive 1.5s infinite;
}
@keyframes pulseLive { 0%,100%{opacity:1} 50%{opacity:0.3} }

.badge-ventas   { background:rgba(173,55,241,0.15); color:var(--violet); border:1px solid rgba(173,55,241,0.3); }
.badge-ventas   .dot-live { background: var(--violet); }
.badge-reservas { background:rgba(255,0,157,0.12);  color:var(--pink);   border:1px solid rgba(255,0,157,0.3); }
.badge-reservas .dot-live { background: var(--pink); }
.badge-turnos   { background:rgba(74,222,128,0.10); color:#4ade80;       border:1px solid rgba(74,222,128,0.25); }
.badge-turnos   .dot-live { background: #4ade80; }
.badge-atencion { background:rgba(251,191,36,0.10); color:#fbbf24;       border:1px solid rgba(251,191,36,0.25); }
.badge-atencion .dot-live { background: #fbbf24; }

.chat-page-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 10px;
  color: var(--text);
}
.chat-page-title em {
  font-style: italic;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.chat-page-desc {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.65;
}
.chat-page-desc strong { color: var(--text); font-weight: 600; }

/* ============================================================
   CHAT WIDGET  (estética chat_salomon adaptada a dark/synaptx)
   ============================================================ */
.chat-widget {
  width: 440px;
  max-width: 100%;
  height: min(620px, 80vh);
  background: var(--w-surface);
  border-radius: var(--w-radius);
  border: 1px solid var(--w-border);
  box-shadow:
    0 32px 80px rgba(0,0,0,0.6),
    0 0 0 1px rgba(173,55,241,0.15),
    0 0 60px rgba(173,55,241,0.06) inset;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* Header del widget */
.chat-header {
  padding: 14px 18px;
  background: linear-gradient(135deg, rgba(173,55,241,0.25), rgba(255,0,157,0.15));
  border-bottom: 1px solid var(--w-border);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}
.chat-header::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 140px; height: 140px;
  border-radius: 50%;
  background: rgba(173,55,241,0.08);
  pointer-events: none;
}

.header-avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--grad);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(173,55,241,0.3);
  overflow: hidden;
}
.header-avatar img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.header-info { flex: 1; }
.header-name {
  font-family: 'Playfair Display', serif;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.header-status {
  color: var(--muted);
  font-size: 0.72rem;
  display: flex; align-items: center; gap: 5px;
  margin-top: 2px;
}
.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #5dde8a;
  animation: pulseLive 2s infinite;
}

/* Body / mensajes */
.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  scroll-behavior: smooth;
  background: var(--w-bg);
}
.chat-body::-webkit-scrollbar { width: 3px; }
.chat-body::-webkit-scrollbar-track { background: transparent; }
.chat-body::-webkit-scrollbar-thumb { background: rgba(173,55,241,0.3); border-radius: 4px; }

/* Date separator */
.date-sep {
  text-align: center;
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin: 4px 0 8px;
  position: relative;
}
.date-sep::before, .date-sep::after {
  content: '';
  position: absolute;
  top: 50%; width: calc(50% - 28px);
  height: 1px; background: var(--border);
}
.date-sep::before { left: 0; }
.date-sep::after  { right: 0; }

/* Rows */
.msg-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  animation: fadeUp 0.22s ease both;
}
.msg-row.user { flex-direction: row-reverse; }
.msg-row.bot  { flex-direction: row; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Bot mini-avatar */
.msg-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--grad);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem;
  flex-shrink: 0;
  margin-bottom: 18px;
  overflow: hidden;
}
.msg-avatar img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

/* Bubbles */
.bubble-wrap {
  display: flex;
  flex-direction: column;
  max-width: 80%;
}
.msg-row.user .bubble-wrap { align-items: flex-end; }

.bubble {
  padding: 9px 13px;
  border-radius: var(--w-radius);
  font-size: 0.845rem;
  line-height: 1.55;
  word-break: break-word;
}
.msg-row.bot .bubble {
  background: var(--w-bubble-bot);
  color: var(--text);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--w-border);
}
.msg-row.user .bubble {
  background: var(--grad);
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* Markdown */
.bubble p       { margin-bottom: 0.45em; }
.bubble p:last-child { margin-bottom: 0; }
.bubble strong  { font-weight: 600; }
.bubble em      { font-style: italic; }
.bubble a       { color: var(--violet); text-decoration: underline; }
.msg-row.user .bubble a { color: rgba(255,255,255,0.85); }
.bubble ul, .bubble ol  { padding-left: 1.2em; margin: 0.3em 0; }
.bubble li      { margin-bottom: 0.2em; }
.bubble code {
  background: rgba(255,255,255,0.08);
  padding: 0.1em 0.35em;
  border-radius: 4px;
  font-size: 0.82em;
  font-family: monospace;
}
.bubble hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.5em 0;
}

/* Meta */
.bubble-meta {
  font-size: 0.62rem;
  color: var(--muted);
  margin-top: 3px;
  display: flex; align-items: center; gap: 4px;
}
.ticks { color: var(--violet); }

/* --- TYPING INDICATOR -------------------------------------- */
.typing-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  animation: fadeUp 0.2s ease both;
}
.typing-bubble {
  background: var(--w-bubble-bot);
  border: 1px solid var(--w-border);
  border-radius: var(--w-radius);
  border-bottom-left-radius: 4px;
  padding: 11px 15px;
  display: flex; align-items: center; gap: 5px;
}
.dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--violet);
  opacity: 0.4;
  animation: blink 1.2s infinite;
}
.dot:nth-child(2) { animation-delay: 0.2s; }
.dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink {
  0%, 80%, 100% { opacity: 0.2; transform: scale(0.9); }
  40%           { opacity: 1;  transform: scale(1.1); }
}

/* --- INPUT AREA -------------------------------------------- */
.chat-footer {
  padding: 10px 14px;
  background: var(--w-surface);
  border-top: 1px solid var(--w-border);
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}
.input-wrap {
  flex: 1;
  background: var(--w-bg);
  border: 1.5px solid var(--w-border);
  border-radius: 22px;
  padding: 8px 14px;
  display: flex; align-items: center;
  transition: border-color 0.2s;
}
.input-wrap:focus-within {
  border-color: rgba(173,55,241,0.5);
}
textarea {
  width: 100%;
  border: none; background: transparent;
  outline: none; resize: none;
  font-family: 'Poppins', sans-serif;
  font-size: 0.855rem;
  color: var(--text);
  line-height: 1.5;
  max-height: 100px;
}
textarea::placeholder { color: var(--muted); }

.send-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--grad);
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.2s, transform 0.15s;
  box-shadow: 0 4px 16px rgba(173,55,241,0.4);
}
.send-btn:hover  { opacity: 0.88; transform: scale(1.06); }
.send-btn:active { transform: scale(0.95); }
.send-btn:disabled { background: rgba(255,255,255,0.1); box-shadow: none; cursor: default; transform: none; }

/* --- BRANDING ---------------------------------------------- */
.chat-branding {
  text-align: center;
  font-size: 0.62rem;
  color: var(--muted);
  padding: 6px;
  background: var(--w-surface);
  border-top: 1px solid var(--w-border);
  letter-spacing: 0.03em;
}
.chat-branding a {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 600;
}

/* --- RESPONSIVE -------------------------------------------- */
@media (max-width: 500px) {
  .chat-page-main { padding: 80px 0 0; }
  .chat-widget {
    width: 100%;
    height: calc(100vh - 64px);
    border-radius: 0;
    border: none;
  }
  .chat-page-header { padding: 0 16px; margin-bottom: 16px; }
}
