/* ═══════════════════════════════════════════════════
   Chatbot Legal — Funez & Asociados  v3.0
   Colores: Azul marino #1a2c4e · Dorado #c9a84c
═══════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700&family=Source+Sans+3:wght@300;400;600&display=swap');

#dfchat-wrapper,
#dfchat-wrapper * { box-sizing: border-box; font-family: 'Source Sans 3', sans-serif; }

#dfchat-wrapper {
  --navy:  #1a2c4e;
  --navy2: #22395e;
  --gold:  #c9a84c;
  --gold2: #dfc06d;
  --chatbg:#edf1f7;
  --white: #ffffff;
  --text:  #2d3748;
  --muted: #718096;
  position: fixed; bottom: 26px; right: 26px; z-index: 999999;
}

/* ── Toggle button ── */
#dfchat-toggle {
  position: relative; width: 58px; height: 58px; border-radius: 50%;
  background: linear-gradient(145deg, var(--navy), var(--navy2));
  border: 2.5px solid var(--gold); color: var(--gold);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  margin-left: auto; transition: transform .2s, box-shadow .2s;
  box-shadow: 0 6px 22px rgba(26,44,78,.45);
  animation: df-pulse 3.5s ease infinite;
}
#dfchat-toggle:hover { transform: scale(1.08); }
#dfchat-toggle svg { width: 24px; height: 24px; pointer-events: none; }

@keyframes df-pulse {
  0%,100% { box-shadow: 0 6px 22px rgba(26,44,78,.45), 0 0 0 0 rgba(201,168,76,.5); }
  55%      { box-shadow: 0 6px 22px rgba(26,44,78,.45), 0 0 0 12px rgba(201,168,76,0); }
}

#dfchat-badge {
  position: absolute; top: -3px; right: -3px;
  width: 14px; height: 14px;
  background: #e53e3e; border: 2px solid #fff;
  border-radius: 50%; display: none;
}

/* ── Window ── */
#dfchat-window {
  position: absolute; bottom: 70px; right: 0; width: 358px; max-height: 560px;
  display: flex; flex-direction: column;
  background: var(--white); border-radius: 20px;
  box-shadow: 0 24px 64px rgba(26,44,78,.28);
  border: 1px solid rgba(201,168,76,.22); overflow: hidden;
  opacity: 0; transform: translateY(16px) scale(.96); pointer-events: none;
  transition: opacity .28s ease, transform .28s ease;
}
#dfchat-window.df-open {
  opacity: 1; transform: translateY(0) scale(1); pointer-events: all;
}

/* ── Header ── */
#dfchat-header {
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy2) 100%);
  padding: 14px 16px 17px; display: flex; align-items: center;
  justify-content: space-between; position: relative;
}
#dfchat-header::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  background: linear-gradient(90deg, var(--gold), var(--gold2), var(--gold));
}
#dfchat-header-left { display: flex; align-items: center; gap: 11px; }
#dfchat-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold2));
  color: var(--navy); font-family: 'Playfair Display', serif;
  font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid rgba(255,255,255,.2); flex-shrink: 0;
}
#dfchat-header-name { color: #fff; font-weight: 600; font-size: 13.5px; line-height: 1.2; }
#dfchat-header-firm { color: var(--gold); font-size: 10.5px; opacity: .9; }
#dfchat-online { color: rgba(255,255,255,.65); font-size: 10.5px; display: flex; align-items: center; gap: 5px; }
#dfchat-dot { width: 7px; height: 7px; background: #48bb78; border-radius: 50%; animation: df-blink 2.2s infinite; }
@keyframes df-blink { 0%,100%{opacity:1} 50%{opacity:.3} }

/* ── Messages ── */
#dfchat-messages {
  flex: 1; overflow-y: auto; padding: 14px 13px 6px;
  background: var(--chatbg); display: flex; flex-direction: column; gap: 10px;
  scroll-behavior: smooth;
}
#dfchat-messages::-webkit-scrollbar { width: 3px; }
#dfchat-messages::-webkit-scrollbar-thumb { background: #c0c8d8; border-radius: 3px; }

.dfchat-msg { display: flex; flex-direction: column; max-width: 87%; animation: df-in .23s ease; }
@keyframes df-in { from{opacity:0;transform:translateY(7px)} to{opacity:1;transform:translateY(0)} }
.dfchat-bot  { align-self: flex-start; align-items: flex-start; }
.dfchat-user { align-self: flex-end;   align-items: flex-end; }

.dfchat-bubble {
  padding: 10px 14px; border-radius: 18px;
  font-size: 13.5px; line-height: 1.58; color: var(--text);
}
.dfchat-bot .dfchat-bubble {
  background: var(--white); border-radius: 4px 18px 18px 18px;
  border-left: 3px solid var(--gold); box-shadow: 0 2px 8px rgba(0,0,0,.07);
}
.dfchat-user .dfchat-bubble {
  background: linear-gradient(135deg, var(--navy), var(--navy2));
  color: #fff; border-radius: 18px 4px 18px 18px;
  box-shadow: 0 2px 10px rgba(26,44,78,.28);
}
.dfchat-time { font-size: 10px; color: var(--muted); margin-top: 3px; padding: 0 4px; }

/* ── Typing ── */
#dfchat-typing .dfchat-bubble { padding: 11px 16px; display: flex; gap: 4px; align-items: center; }
.df-dot { width: 7px; height: 7px; background: var(--gold); border-radius: 50%; animation: df-b 1.1s infinite; }
.df-dot:nth-child(2){animation-delay:.18s} .df-dot:nth-child(3){animation-delay:.36s}
@keyframes df-b { 0%,60%,100%{transform:translateY(0)} 30%{transform:translateY(-7px)} }

/* ── Quick replies ── */
.dfchat-quick-block { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 0; }
.dfq {
  background: var(--white); border: 1.5px solid var(--gold); color: var(--navy);
  font-family: 'Source Sans 3', sans-serif; font-size: 12px; font-weight: 600;
  padding: 5px 11px; border-radius: 20px; cursor: pointer; white-space: nowrap;
  transition: background .15s, color .15s, transform .12s;
}
.dfq:hover { background: var(--navy); color: var(--gold); border-color: var(--navy); transform: translateY(-1px); }

/* ── Input ── */
#dfchat-input-row {
  flex-shrink: 0; display: flex; align-items: flex-end; gap: 8px;
  padding: 11px 12px; background: var(--white); border-top: 1px solid #e2e8f0;
}
#dfchat-input {
  flex: 1; font-family: 'Source Sans 3', sans-serif; font-size: 13.5px; color: var(--text);
  border: 1.5px solid #cdd5e0; border-radius: 12px; padding: 8px 11px;
  resize: none; outline: none; line-height: 1.46; max-height: 96px;
  background: var(--chatbg); transition: border-color .2s, box-shadow .2s;
}
#dfchat-input::placeholder { color: var(--muted); }
#dfchat-input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,168,76,.12); background: var(--white); }

#dfchat-send {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, var(--navy), var(--navy2));
  border: none; color: var(--gold); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: transform .15s, background .15s;
}
#dfchat-send svg { width: 17px; height: 17px; }
#dfchat-send:hover { transform: scale(1.1); background: linear-gradient(135deg, var(--gold), var(--gold2)); color: var(--navy); }
#dfchat-send:disabled { opacity: .4; cursor: not-allowed; transform: none; }

/* ── Footer ── */
#dfchat-footer {
  flex-shrink: 0; text-align: center; font-size: 10px; color: var(--muted);
  padding: 4px 12px 10px; background: var(--white);
}

/* ── Responsive ── */
@media (max-width: 480px) {
  #dfchat-wrapper { bottom: 14px; right: 14px; }
  #dfchat-window  { width: calc(100vw - 28px); right: 0; max-height: 70vh; }
}
