/* ============================================
   ASISTENTE HEIMDALL — widget de consultas
   Depende de los design tokens definidos en cada página
   (--mars-red, --deep-space-*, --font-display, etc.)
   ============================================ */

.hda-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 900;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 14px 22px 14px 18px;
  border-radius: 999px;
  background: var(--mars-red, #DE411B);
  color: #fff;
  font-family: var(--font-body, system-ui, sans-serif);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  box-shadow: 0 16px 40px rgba(222, 65, 27, 0.36);
  transition: transform 0.25s, box-shadow 0.25s, opacity 0.2s;
}
.hda-fab:hover { transform: translateY(-2px); box-shadow: 0 20px 48px rgba(222, 65, 27, 0.46); }
.hda-fab svg { width: 22px; height: 22px; flex-shrink: 0; }
.hda-fab-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #7BE38B;
  box-shadow: 0 0 0 3px rgba(123, 227, 139, 0.28);
}
body.hda-open .hda-fab { opacity: 0; pointer-events: none; }

.hda-panel {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 950;
  width: 400px;
  max-width: calc(100vw - 32px);
  height: 610px;
  max-height: calc(100vh - 48px);
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 32px 80px rgba(28, 34, 39, 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--font-body, system-ui, sans-serif);
  opacity: 0;
  transform: translateY(16px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}
body.hda-open .hda-panel { opacity: 1; transform: none; pointer-events: auto; }

.hda-head {
  background: var(--deep-space-900, #2C343B);
  color: #fff;
  padding: 20px 20px 20px 22px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}
.hda-head-mark {
  width: 40px; height: 40px;
  border-radius: 11px;
  background: rgba(222, 65, 27, 0.18);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.hda-head-mark svg { width: 22px; height: 22px; }
.hda-head-txt { flex: 1; min-width: 0; }
.hda-head-txt strong {
  display: block;
  font-family: var(--font-display, system-ui, sans-serif);
  font-stretch: 125%;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.hda-head-txt span {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.62);
  margin-top: 3px;
}
.hda-head-txt span::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #7BE38B;
}
.hda-close {
  width: 34px; height: 34px;
  border-radius: 9px;
  display: grid; place-items: center;
  color: rgba(255, 255, 255, 0.7);
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
}
.hda-close:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.hda-close svg { width: 17px; height: 17px; }

.hda-log {
  flex: 1;
  overflow-y: auto;
  padding: 22px 20px 8px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--cream, #FAFAF8);
  scroll-behavior: smooth;
}
.hda-msg {
  max-width: 88%;
  padding: 13px 16px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.55;
  animation: hda-in 0.24s ease both;
}
@keyframes hda-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.hda-msg.bot {
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--deep-space-200, #DCE0E3);
  color: var(--deep-space-700, #48535B);
  border-bottom-left-radius: 5px;
}
.hda-msg.user {
  align-self: flex-end;
  background: var(--mars-red, #DE411B);
  color: #fff;
  border-bottom-right-radius: 5px;
}
.hda-msg strong { color: var(--deep-space-900, #2C343B); font-weight: 600; }
.hda-msg.user strong { color: #fff; }
.hda-msg ul { margin: 10px 0 0; padding: 0; list-style: none; }
.hda-msg li {
  position: relative;
  padding-left: 16px;
  margin-top: 6px;
  font-size: 13.5px;
}
.hda-msg li::before {
  content: '';
  position: absolute;
  left: 0; top: 8px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--mars-red, #DE411B);
}
.hda-msg a { color: var(--mars-red, #DE411B); font-weight: 600; text-decoration: underline; }

.hda-typing { display: flex; gap: 4px; align-items: center; padding: 4px 2px; }
.hda-typing i {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--deep-space-300, #B8BEC3);
  animation: hda-blink 1.1s infinite ease-in-out;
}
.hda-typing i:nth-child(2) { animation-delay: 0.16s; }
.hda-typing i:nth-child(3) { animation-delay: 0.32s; }
@keyframes hda-blink {
  0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

.hda-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 20px 4px;
  background: var(--cream, #FAFAF8);
  flex-shrink: 0;
}
.hda-chip {
  padding: 8px 14px;
  border: 1px solid var(--deep-space-200, #DCE0E3);
  border-radius: 999px;
  background: #fff;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--deep-space-700, #48535B);
  transition: all 0.2s;
}
.hda-chip:hover {
  border-color: var(--mars-red, #DE411B);
  color: var(--mars-red, #DE411B);
  background: var(--mars-red-50, #FDF1EC);
}

.hda-form {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid var(--deep-space-200, #DCE0E3);
  background: #fff;
  flex-shrink: 0;
}
.hda-input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--deep-space-200, #DCE0E3);
  border-radius: 999px;
  padding: 12px 18px;
  font-family: inherit;
  font-size: 14px;
  color: var(--deep-space-900, #2C343B);
  background: var(--cream, #FAFAF8);
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}
.hda-input::placeholder { color: var(--deep-space-400, #8B949B); }
.hda-input:focus { border-color: var(--mars-red, #DE411B); background: #fff; }
.hda-send {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--mars-red, #DE411B);
  color: #fff;
  display: grid; place-items: center;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.2s;
}
.hda-send:hover { background: var(--mars-red-700, #B8351A); transform: scale(1.05); }
.hda-send svg { width: 18px; height: 18px; }

.hda-foot {
  padding: 0 16px 12px;
  background: #fff;
  font-size: 10.5px;
  line-height: 1.5;
  color: var(--deep-space-400, #8B949B);
  text-align: center;
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .hda-fab { right: 16px; bottom: 16px; padding: 13px 18px 13px 15px; font-size: 13px; }
  .hda-panel {
    right: 0; bottom: 0; left: 0;
    width: 100%;
    max-width: 100%;
    height: 88vh;
    max-height: 88vh;
    border-radius: 20px 20px 0 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hda-panel, .hda-fab, .hda-msg { transition: none; animation: none; }
  .hda-typing i { animation: none; }
}
