/* ============================================================
   DSI Internacional — Chat Widget Styles
   File: css/chat.css
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Raleway:wght@400;500;600;700;800&display=swap');

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

:root {
  --primary: #1a1a2e;
  --primary-mid: #16213e;
  --accent: #0f3460;
  --neon: #e94560;
  --neon-2: #f5a623;
  --surface: #ffffff;
  --surface-2: #f7f8fc;
  --surface-3: #eef0f8;
  --text: #1a1a2e;
  --text-secondary: #5a607a;
  --text-muted: #9ba3bf;
  --border: #e2e6f3;
  --success: #22c55e;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --shadow-lg: 0 20px 60px rgba(26, 26, 46, 0.18);
  --shadow-xl: 0 32px 80px rgba(26, 26, 46, 0.28);
  --font-head: 'Raleway', sans-serif;
  --font-body: 'Raleway', sans-serif;
}

/* ── Trigger Button ────────────────────────────── */
#chat-trigger {
  position: fixed;
  bottom: 20px;
  right: 30px;
  width: auto;
  height: 130px;
  border: none;
  background: transparent;
  cursor: pointer;
  z-index: 9998;
  padding: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.35s ease;
  animation: mascot-float 4s ease-in-out infinite;
}

#chat-trigger:hover {
  transform: scale(1.1) translateY(-4px);
  filter: brightness(1.08);
}

#chat-trigger.hidden {
  transform: scale(0);
  opacity: 0;
  pointer-events: none;
}

.trigger-avatar {
  width: auto;
  height: 200px;
  border-radius: 0;
  overflow: visible;
  border: none;
  background: transparent;
}

.trigger-avatar img {
  width: auto;
  height: 100%;
  object-fit: contain;
  object-position: bottom;
  filter: drop-shadow(0 10px 28px rgba(26, 26, 46, 0.45));
}

.trigger-tooltip {
  position: absolute;
  right: calc(100% + 14px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--primary);
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  padding: 10px 16px;
  border-radius: 12px;
  pointer-events: none;
  opacity: 0;
  transition: all 0.3s;
  box-shadow: var(--shadow-lg);
}

.trigger-tooltip::after {
  content: '';
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  border: 7px solid transparent;
  border-left-color: var(--primary);
}

#chat-trigger:hover .trigger-tooltip {
  opacity: 1;
  transform: translateY(-50%) translateX(-5px);
}

/* ── Overlay ────────────────────────────────────── */
#chat-container {
  position: fixed;
  bottom: 0;           /* Cambiado de 250px a 0 */
  right: 30px;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

#chat-container.visible {
  opacity: 1;
  pointer-events: all;
}

/* ── Main Chat Window ───────────────────────────── */
#chat-window {
  width: 780px;
  max-width: calc(100vw - 40px);
  height: 600px;       /* Aumentado de 480px a 600px */
  max-height: calc(100vh - 20px);
  background: var(--surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;  /* Solo bordes superiores redondeados */
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: row;
  overflow: hidden;
  transform: scale(0.88) translateY(24px);
  transform-origin: bottom right;
  transition: all 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#chat-container.visible #chat-window {
  transform: scale(1) translateY(0);
}

/* ── Mascot Side Panel ──────────────────────────── */
#mascot-panel {
  width: 250px;
  min-width: 250px;
  background-color: var(--primary);
  background-image: url('../../assets/img/logo/logo-white.png'), linear-gradient(160deg, var(--primary) 0%, var(--accent) 100%);
  background-repeat: no-repeat, no-repeat;
  background-position: center 30px, center;
  background-size: 80% auto, cover;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 70px 0 20px 0;
  position: relative;
  overflow: hidden;
}

#mascot-panel::before {
  content: '';
  position: absolute;
  top: -80px;
  left: -80px;
  width: 260px;
  height: 260px;
  background: radial-gradient(circle, rgba(233, 69, 96, 0.25) 0%, transparent 70%);
  border-radius: 50%;
}

#mascot-panel::after {
  content: '';
  position: absolute;
  bottom: -40px;
  right: -60px;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(245, 166, 35, 0.2) 0%, transparent 70%);
  border-radius: 50%;
}

.mascot-img-wrap {
  position: relative;
  z-index: 2;
  width: 180px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  margin-bottom: 0;
}

.mascot-img-wrap img {
  width: 100%;
  height: auto;
  object-fit: contain;
  object-position: bottom;
  filter: drop-shadow(0 12px 32px rgba(0, 0, 0, 0.35));
  animation: mascot-float 4s ease-in-out infinite;
}

.mascot-name {
  font-family: var(--font-head);
  font-size: 1.2rem;
  font-weight: 800;
  color: #fff;
  position: relative;
  z-index: 2;
  margin-top: 12px;
  letter-spacing: -0.01em;
}

.mascot-status {
  font-family: var(--font-body);
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.7);
  position: relative;
  z-index: 2;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 7px;
  height: 7px;
  background: #4ade80;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.3);
  animation: pulse 2s infinite;
}

/* ── Chat Area ──────────────────────────────────── */
#chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  min-height: 0;
}

/* ── Header ────────────────────────────────────── */
.chat-header {
  background: var(--surface);
  border-bottom: 1.5px solid var(--border);
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-info h2 {
  font-family: var(--font-head);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}

.header-info p {
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.header-actions {
  display: flex;
  gap: 8px;
}

.header-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  font-size: 1rem;
}

.header-btn:hover {
  background: var(--surface-3);
  color: var(--text);
  transform: translateY(-1px);
}

/* ── Messages Area ──────────────────────────────── */
#chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
  min-height: 0;
}

#chat-messages::-webkit-scrollbar {
  width: 4px;
}

#chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

#chat-messages::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 99px;
}

/* ── Messages ───────────────────────────────────── */
.message {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  animation: msg-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.message.user {
  flex-direction: row-reverse;
}

.msg-avatar-small {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--border);
  flex-shrink: 0;
  background: var(--surface-3);
}

.msg-avatar-small img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}

.msg-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 72%;
}

.message.user .msg-content {
  align-items: flex-end;
}

.msg-bubble {
  font-family: var(--font-body);
  font-size: 0.9rem;
  line-height: 1.5;
  padding: 12px 16px;
  border-radius: 18px;
  word-break: break-word;
}

.message.bot .msg-bubble {
  background: var(--surface-2);
  color: var(--text);
  border-bottom-left-radius: 6px;
  border: 1.5px solid var(--border);
}

.message.user .msg-bubble {
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 6px;
}

.msg-time {
  font-family: var(--font-body);
  font-size: 0.7rem;
  color: var(--text-muted);
  padding: 0 4px;
}

/* ── Typing Indicator ───────────────────────────── */
.typing-indicator {
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  padding: 14px 18px;
  border-radius: 18px;
  border-bottom-left-radius: 6px;
  display: inline-flex;
  gap: 5px;
  align-items: center;
}

.typing-dot {
  width: 7px;
  height: 7px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

/* ── Quick Actions ──────────────────────────────── */
#quick-actions {
  padding: 12px 24px 16px;
  background: var(--surface);
  border-top: 1.5px solid var(--border);
  display: none;
}

.actions-label {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

#actions-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.action-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 99px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
}

.action-chip:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(26, 26, 46, 0.22);
}

.action-chip.whatsapp:hover {
  background: #22c55e;
  border-color: #22c55e;
}

.action-chip.primary {
  background: var(--neon);
  color: #fff;
  border-color: var(--neon);
}

.action-chip.primary:hover {
  background: #d63050;
  border-color: #d63050;
}

/* ── Input Bar ──────────────────────────────────── */
.chat-input-bar {
  padding: 14px 24px 18px;
  background: var(--surface);
  border-top: 1.5px solid var(--border);
  display: flex;
  gap: 10px;
  align-items: center;
}

#chat-input {
  flex: 1;
  padding: 11px 18px;
  border: 1.5px solid var(--border);
  border-radius: 99px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--text);
  background: var(--surface-2);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#chat-input:focus {
  border-color: var(--neon);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.1);
}

#chat-input::placeholder {
  color: var(--text-muted);
}

.send-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  flex-shrink: 0;
}

.send-btn:hover {
  background: var(--neon);
  transform: scale(1.1);
}

/* ── Lead / Input Form ──────────────────────────── */
.lead-form-wrap {
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin: 4px 0;
  max-width: 88%;
  animation: msg-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.lead-form-wrap h4 {
  font-family: var(--font-head);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.lead-form-wrap p {
  font-family: var(--font-body);
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.lead-field {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 0.88rem;
  color: var(--text);
  background: var(--surface);
  outline: none;
  margin-bottom: 10px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.lead-field:focus {
  border-color: var(--neon);
  box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.1);
}

.lead-field.error {
  border-color: #ef4444;
}

.lead-submit-btn {
  width: 100%;
  padding: 11px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.22s;
}

.lead-submit-btn:hover {
  background: var(--neon);
  transform: translateY(-1px);
}

/* ── Email form (inline) ───────────────────────── */
.email-form-container {
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  max-width: 88%;
  animation: msg-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.email-form-container h4 {
  font-family: var(--font-head);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.email-form-container p {
  font-family: var(--font-body);
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

/* ── Animations ─────────────────────────────────── */
@keyframes pulse-ring {

  0%,
  100% {
    box-shadow: 0 8px 32px rgba(26, 26, 46, 0.35), 0 0 0 0 rgba(233, 69, 96, 0);
  }

  50% {
    box-shadow: 0 8px 32px rgba(26, 26, 46, 0.35), 0 0 0 12px rgba(233, 69, 96, 0.15);
  }
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: .7;
    transform: scale(0.85);
  }
}

@keyframes typing {

  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: .5;
  }

  30% {
    transform: translateY(-5px);
    opacity: 1;
  }
}

@keyframes msg-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.97);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes mascot-float {

  0%,
  100% {
    transform: translateY(0px);
  }

  50% {
    transform: translateY(-10px);
  }
}

/* ── Responsive ─────────────────────────────────── */
@media (max-width: 640px) {
  #chat-container {
    bottom: 100px;
    right: 16px;
    left: 16px;
    display: block;
    /* Overrides default */
  }

  #chat-trigger {
    bottom: 20px;
    right: 16px;
    width: 62px;
    height: 62px;
  }

  .trigger-avatar {
    width: auto;
    height: 125px;
  }

  .trigger-tooltip {
    display: none;
  }

  #mascot-panel {
    display: none;
  }

  #chat-window {
    width: auto;
    max-width: none;
    height: 75vh;
    max-height: calc(100vh - 120px);
    border-radius: var(--radius-lg);
  }
}