/* ============================================
   Footer reforzado (logo + texto + versión)
   ============================================ */

.haon-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.haon-footer-logo {
  height: 22px;
  width: auto;
  filter: drop-shadow(0 0 4px rgba(91, 163, 232, 0.3));
  flex-shrink: 0;
}
.haon-footer-text {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-secondary);
  letter-spacing: 1px;
}
.haon-footer-version {
  font-size: 10px;
  color: var(--text-faint);
  letter-spacing: 0.5px;
  padding-left: 8px;
  border-left: 1px solid var(--bg-glass-border);
}

/* Tag de método dentro de la píldora */
.haon-pill-tag {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: 0.3px;
  margin-left: 2px;
}
.haon-pill:hover .haon-pill-tag {
  color: var(--haon-accent);
}

/* Tag de método dentro de la píldora */
.haon-pill-tag {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: 0.3px;
  margin-left: 2px;
}
.haon-pill:hover .haon-pill-tag {
  color: var(--haon-accent);
}

/* ============================================
   Tag de método dentro de la píldora
   ============================================ */
.haon-pill-tag {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: 0.3px;
  margin-left: 2px;
}
.haon-pill:hover .haon-pill-tag { color: var(--haon-accent); }

/* ============================================
   Greeting + quick actions: ocultar suave al iniciar conversación
   ============================================ */
.haon-greeting,
.haon-quick-actions {
  transition: opacity 0.3s ease, max-height 0.4s ease, margin 0.3s ease;
  overflow: hidden;
}
.haon-greeting.is-hidden,
.haon-quick-actions.is-hidden {
  opacity: 0;
  max-height: 0;
  margin: 0 !important;
  padding: 0 !important;
  pointer-events: none;
}

/* ============================================
   Mensajes / burbujas de chat
   ============================================ */
.haon-messages {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-bottom: 18px;
}
.haon-messages:empty { margin: 0; }

.haon-msg {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  animation: haon-msg-in 0.25s ease-out;
}
@keyframes haon-msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.haon-msg--user {
  justify-content: flex-end;
}
.haon-msg--user .haon-msg-bubble {
  background: rgba(91, 163, 232, 0.18);
  border: 1px solid rgba(91, 163, 232, 0.35);
  color: var(--text-primary);
  border-radius: 18px 18px 4px 18px;
  max-width: 75%;
  padding: 10px 14px;
  font-size: 15px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.haon-msg--assistant .haon-msg-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(91, 163, 232, 0.4);
  background: rgba(91, 163, 232, 0.15);
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.haon-msg--assistant .haon-msg-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 25%;
}
.haon-msg--assistant .haon-msg-bubble {
  background: var(--bg-glass);
  border: 1px solid var(--bg-glass-border);
  color: var(--text-primary);
  border-radius: 18px 18px 18px 4px;
  max-width: 80%;
  padding: 10px 14px;
  font-size: 15px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Indicador "escribiendo..." (3 puntos animados) */
.haon-msg-bubble.is-thinking {
  padding: 14px 16px;
}
.haon-typing {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  height: 16px;
}
.haon-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--haon-blue-light);
  opacity: 0.4;
  animation: haon-typing-bounce 1.2s ease-in-out infinite;
}
.haon-typing span:nth-child(2) { animation-delay: 0.15s; }
.haon-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes haon-typing-bounce {
  0%, 60%, 100% { opacity: 0.4; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-4px); }
}

@media (min-width: 640px) {
  .haon-msg--user .haon-msg-bubble,
  .haon-msg--assistant .haon-msg-bubble { font-size: 15px; }
}

/* Burbuja de error en chat */
.haon-msg-bubble.haon-msg-error {
  background: rgba(255, 107, 107, 0.12);
  border-color: rgba(255, 107, 107, 0.4);
  color: var(--color-error);
}

/* ═══ Panel lateral de cert emitido ═══ */
.haon-cert-panel {
  position: fixed;
  top: 0;
  right: -480px;
  width: 460px;
  height: 100vh;
  background: linear-gradient(180deg, #0f2847 0%, #1a3a5c 100%);
  border-left: 2px solid #5BA3E8;
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.4);
  z-index: 9999;
  transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}
.haon-cert-panel.is-open {
  right: 0;
}
.haon-cert-panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  z-index: 9998;
}
.haon-cert-panel-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}
.haon-cert-panel-head {
  padding: 18px 20px;
  border-bottom: 1px solid rgba(91, 163, 232, 0.3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.haon-cert-panel-title {
  font-size: 13px;
  font-weight: 400;
  color: #5BA3E8;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.haon-cert-panel-folio {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  margin-top: 2px;
  font-family: 'SF Mono', 'Monaco', 'Courier New', monospace;
}
.haon-cert-panel-close {
  background: none;
  border: 1px solid rgba(91, 163, 232, 0.4);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.haon-cert-panel-close:hover {
  background: rgba(91, 163, 232, 0.2);
}
.haon-cert-panel-body {
  flex: 1;
  overflow: hidden;
  background: #2a2a2a;
  display: flex;
  flex-direction: column;
}
.haon-cert-pdf-frame {
  flex: 1;
  width: 100%;
  border: none;
  background: #fff;
}
.haon-cert-panel-actions {
  padding: 16px 20px;
  border-top: 1px solid rgba(91, 163, 232, 0.3);
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}
.haon-cert-btn {
  flex: 1;
  padding: 12px 16px;
  border-radius: 10px;
  border: none;
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.15s, box-shadow 0.15s;
}
.haon-cert-btn-primary {
  background: linear-gradient(135deg, #5BA3E8 0%, #3a87d4 100%);
  color: #fff;
}
.haon-cert-btn-secondary {
  background: linear-gradient(135deg, #f5c44a 0%, #e0a830 100%);
  color: #0f2847;
}
.haon-cert-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.haon-cert-btn:active {
  transform: translateY(0);
}
.haon-cert-meta {
  padding: 16px 20px;
  font-size: 12px;
  color: #b8d4f0;
  border-bottom: 1px solid rgba(91, 163, 232, 0.2);
  background: rgba(15, 40, 71, 0.6);
  flex-shrink: 0;
}
.haon-cert-meta-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}
.haon-cert-meta-row:last-child { margin-bottom: 0; }
.haon-cert-meta-label { color: #88b4dc; }
.haon-cert-meta-value { color: #fff; font-weight: 500; }

/* Mobile */
@media (max-width: 768px) {
  .haon-cert-panel {
    width: 100vw;
    right: -100vw;
  }
}

/* Panel lateral cert emitido */
.haon-cert-panel {
  position: fixed;
  top: 0;
  right: -480px;
  width: 460px;
  height: 100vh;
  background: linear-gradient(180deg, #0f2847 0%, #1a3a5c 100%);
  border-left: 2px solid #5BA3E8;
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.4);
  z-index: 9999;
  transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}
.haon-cert-panel.is-open { right: 0; }
.haon-cert-panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  z-index: 9998;
}
.haon-cert-panel-overlay.is-visible { opacity: 1; pointer-events: auto; }
.haon-cert-panel-head {
  padding: 18px 20px;
  border-bottom: 1px solid rgba(91, 163, 232, 0.3);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.haon-cert-panel-title {
  font-size: 13px;
  font-weight: 400;
  color: #5BA3E8;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.haon-cert-panel-folio {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  margin-top: 2px;
  font-family: monospace;
}
.haon-cert-panel-close {
  background: none;
  border: 1px solid rgba(91, 163, 232, 0.4);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.haon-cert-panel-close:hover { background: rgba(91, 163, 232, 0.2); }
.haon-cert-panel-body { flex: 1; overflow: hidden; background: #2a2a2a; }
.haon-cert-pdf-frame { width: 100%; height: 100%; border: none; background: #fff; }
.haon-cert-panel-actions {
  padding: 16px 20px;
  border-top: 1px solid rgba(91, 163, 232, 0.3);
  display: flex;
  gap: 10px;
}
.haon-cert-btn {
  flex: 1;
  padding: 12px 16px;
  border-radius: 10px;
  border: none;
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.15s;
}
.haon-cert-btn-primary { background: linear-gradient(135deg, #5BA3E8 0%, #3a87d4 100%); color: #fff; }
.haon-cert-btn-secondary { background: linear-gradient(135deg, #f5c44a 0%, #e0a830 100%); color: #0f2847; }
.haon-cert-btn:hover { transform: translateY(-1px); }
.haon-cert-meta {
  padding: 16px 20px;
  font-size: 12px;
  color: #b8d4f0;
  border-bottom: 1px solid rgba(91, 163, 232, 0.2);
  background: rgba(15, 40, 71, 0.6);
}
.haon-cert-meta-row { display: flex; justify-content: space-between; margin-bottom: 4px; }
.haon-cert-meta-label { color: #88b4dc; }
.haon-cert-meta-value { color: #fff; font-weight: 500; }
@media (max-width: 768px) {
  .haon-cert-panel { width: 100vw; right: -100vw; }
}

