/* ═══════════════════════════════════════════════════════════════
   hari.css — Hari Assistant v1.0
   v7.2.0 | feat/hari-assistant-v1
   Componentes: FAB, Panel slide-in, Tooltip Notion-style
   z-index: FAB 9500 | Panel 9600 | Tooltip 9700 | Overlay 9400
   ═══════════════════════════════════════════════════════════════ */

/* ── Variables ────────────────────────────────────────────────── */
:root {
  --hari-blue:        #1d4ed8;
  --hari-blue-light:  #eff6ff;
  --hari-blue-border: #bfdbfe;
  --hari-radius:      12px;
  --hari-shadow:      0 8px 32px rgba(0,0,0,0.14);
  --hari-shadow-sm:   0 2px 12px rgba(0,0,0,0.10);
  --hari-duration:    200ms;
}

/* ── FAB (Floating Action Button) ─────────────────────────────── */
#hari-fab {
  position: fixed;
  bottom: 80px; /* sobre bottom nav mobile */
  right: 20px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--hari-blue);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  z-index: 9500;
  box-shadow: var(--hari-shadow);
  transition: transform var(--hari-duration), box-shadow var(--hari-duration);
}
#hari-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 36px rgba(29,78,216,0.28);
}
#hari-fab.hari-fab--pulse::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--hari-blue);
  animation: hari-pulse 1.8s ease-out infinite;
}
@keyframes hari-pulse {
  0%   { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.5); }
}

/* Desktop: FAB más arriba (sin bottom nav) */
@media (min-width: 768px) {
  #hari-fab { bottom: 28px; }
}

/* ── Panel slide-in ───────────────────────────────────────────── */
#hari-panel {
  position: fixed;
  top: 0;
  right: -360px; /* oculto fuera de pantalla */
  width: 340px;
  height: 100%;
  background: white;
  z-index: 9600;
  box-shadow: var(--hari-shadow);
  display: flex;
  flex-direction: column;
  transition: right var(--hari-duration) ease;
  border-left: 1px solid #e5e7eb;
}
#hari-panel.hari-panel--open {
  right: 0;
}

/* Mobile: panel full-width como bottom sheet */
@media (max-width: 767px) {
  #hari-panel {
    top: auto;
    bottom: -100%;
    right: 0;
    width: 100%;
    height: 70%;
    border-radius: 16px 16px 0 0;
    border-left: none;
    border-top: 1px solid #e5e7eb;
    transition: bottom var(--hari-duration) ease;
  }
  #hari-panel.hari-panel--open {
    bottom: 0;
    right: 0;
  }
}

/* Panel — header */
.hari-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 12px;
  border-bottom: 1px solid #f3f4f6;
  flex-shrink: 0;
}
.hari-panel-header h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #111827;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.hari-panel-close {
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  font-size: 18px;
  padding: 4px;
  line-height: 1;
  border-radius: 6px;
  transition: color var(--hari-duration), background var(--hari-duration);
}
.hari-panel-close:hover {
  color: #374151;
  background: #f3f4f6;
}

/* Panel — buscador */
.hari-search-wrap {
  padding: 12px 18px;
  border-bottom: 1px solid #f3f4f6;
  flex-shrink: 0;
}
.hari-search-wrap input {
  width: 100%;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 8px 12px 8px 36px;
  font-size: 0.88rem;
  color: #374151;
  background: #f9fafb url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E") no-repeat 12px center;
  outline: none;
  transition: border-color var(--hari-duration);
}
.hari-search-wrap input:focus {
  border-color: var(--hari-blue);
  background-color: white;
}

/* Panel — body scrollable */
.hari-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px;
}

/* Panel — etiqueta de contexto */
.hari-context-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
  margin-top: 4px;
}

/* Panel — lista de artículos */
.hari-article-list {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
}
.hari-article-item {
  border-radius: 8px;
  margin-bottom: 4px;
}
.hari-article-btn {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.875rem;
  color: #374151;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  transition: background var(--hari-duration);
  line-height: 1.4;
}
.hari-article-btn:hover {
  background: var(--hari-blue-light);
  color: var(--hari-blue);
}
.hari-article-btn .hari-article-icon {
  font-size: 13px;
  color: #9ca3af;
  margin-top: 2px;
  flex-shrink: 0;
}
.hari-article-btn:hover .hari-article-icon {
  color: var(--hari-blue);
}
.hari-article-badge {
  font-size: 0.68rem;
  color: #6b7280;
  display: block;
  margin-top: 2px;
}

/* Panel — detalle de artículo */
.hari-detail-back {
  background: none;
  border: none;
  color: var(--hari-blue);
  font-size: 0.82rem;
  cursor: pointer;
  padding: 0;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.hari-detail-back:hover { text-decoration: underline; }
.hari-detail-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #111827;
  margin-bottom: 10px;
  line-height: 1.4;
}
.hari-detail-body {
  font-size: 0.875rem;
  color: #4b5563;
  line-height: 1.65;
}
.hari-detail-body ol,
.hari-detail-body ul { padding-left: 18px; margin-bottom: 8px; }
.hari-detail-body li { margin-bottom: 4px; }
.hari-detail-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  font-size: 0.82rem;
  color: var(--hari-blue);
  text-decoration: none;
  font-weight: 600;
}
.hari-detail-cta:hover { text-decoration: underline; }

/* Sin resultados */
.hari-empty {
  text-align: center;
  color: #9ca3af;
  font-size: 0.85rem;
  padding: 24px 0;
}

/* ── Overlay (panel abierto en mobile) ────────────────────────── */
#hari-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 9400;
}
#hari-overlay.hari-overlay--visible {
  display: block;
}

/* ── Tooltip Notion-style ─────────────────────────────────────── */
.hari-tooltip {
  position: absolute;
  z-index: 9700;
  background: white;
  border: 1px solid var(--hari-blue-border);
  border-radius: var(--hari-radius);
  box-shadow: var(--hari-shadow);
  padding: 14px 16px;
  width: 260px;
  animation: hari-tooltip-in var(--hari-duration) ease;
}
@keyframes hari-tooltip-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Flecha del tooltip */
.hari-tooltip::before {
  content: '';
  position: absolute;
  width: 10px;
  height: 10px;
  background: white;
  border-left: 1px solid var(--hari-blue-border);
  border-top: 1px solid var(--hari-blue-border);
  transform: rotate(45deg);
  top: -6px;
  left: var(--hari-arrow-left, 20px);
}
/* Flecha abajo (tooltip arriba del elemento) */
.hari-tooltip.hari-tooltip--above::before {
  top: auto;
  bottom: -6px;
  transform: rotate(225deg);
}

.hari-tooltip-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #111827;
  margin-bottom: 6px;
  line-height: 1.3;
}
.hari-tooltip-body {
  font-size: 0.8rem;
  color: #4b5563;
  line-height: 1.55;
  margin-bottom: 10px;
}
.hari-tooltip-body strong { color: #111827; }
.hari-tooltip-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.hari-tooltip-cta {
  font-size: 0.78rem;
  color: var(--hari-blue);
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
}
.hari-tooltip-cta:hover { text-decoration: underline; }
.hari-tooltip-dismiss {
  background: none;
  border: none;
  color: #9ca3af;
  font-size: 0.75rem;
  cursor: pointer;
  padding: 0;
  white-space: nowrap;
}
.hari-tooltip-dismiss:hover { color: #6b7280; }

/* Highlight del elemento target con ring pulsante */
.hari-highlight {
  position: relative;
  z-index: 9650;
  border-radius: 6px;
  box-shadow: 0 0 0 3px var(--hari-blue-border);
  animation: hari-ring 1.8s ease-in-out infinite;
}
@keyframes hari-ring {
  0%, 100% { box-shadow: 0 0 0 3px var(--hari-blue-border); }
  50%       { box-shadow: 0 0 0 6px rgba(29,78,216,0.15); }
}

/* Mobile: tooltip se convierte en bottom bar fija */
@media (max-width: 767px) {
  .hari-tooltip {
    position: fixed;
    bottom: 70px; /* sobre bottom nav */
    left: 12px;
    right: 12px;
    width: auto;
    top: auto;
  }
  .hari-tooltip::before { display: none; }
}