/* components/analizador/analizador.css
   Drawer del analizador de precios + gráficas SVG. Todo con las vars
   de tema de base.css (claro/oscuro) y transiciones snappy. */

.anz-host { position: fixed; inset: 0; pointer-events: none; z-index: 1500; }
.anz-host > * { pointer-events: auto; }

/* ── Pestañita fija al fondo ────────────────────────────────── */
.anz-tab {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.5rem 1.125rem;
  background: var(--surface); color: var(--text);
  border: 0.5px solid var(--border-md); border-bottom: none;
  border-radius: 0.75rem 0.75rem 0 0;
  box-shadow: 0 -6px 20px rgba(0,0,0,.12);
  font-size: 0.8125rem; font-weight: 500; cursor: pointer;
  transition: transform .18s cubic-bezier(.16,1,.3,1), box-shadow .18s, background .15s;
}
.anz-tab:hover { transform: translateX(-50%) translateY(-3px); box-shadow: 0 -10px 26px rgba(0,0,0,.18); }
.anz-tab i { font-size: 1rem; color: var(--accent); display: inline-flex; }
.anz-tab i:last-child { color: var(--muted); font-size: 0.875rem; transform: rotate(-90deg); }

/* Brinco elegante para llamar la atención en el paso 4 (Propuesta). */
.anz-tab.anz-bounce { animation: anz-bounce 1.4s ease-in-out infinite; }
@keyframes anz-bounce {
  0%, 100% { transform: translateX(-50%) translateY(0); box-shadow: 0 -6px 20px rgba(0,0,0,.12); }
  25%      { transform: translateX(-50%) translateY(-9px); box-shadow: 0 -14px 30px rgba(26,86,219,.35); }
  40%      { transform: translateX(-50%) translateY(-2px); }
  55%      { transform: translateX(-50%) translateY(-6px); }
}
.anz-tab.anz-bounce i:first-child { color: var(--orange); }

/* ── Backdrop difuminado ────────────────────────────────────── */
.anz-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.35);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  opacity: 0; visibility: hidden;
  transition: opacity .22s ease, visibility .22s ease;
}
.anz-open .anz-backdrop { opacity: 1; visibility: visible; }

/* ── Panel que sube ─────────────────────────────────────────── */
.anz-panel {
  position: fixed; left: 0; right: 0; bottom: 0;
  max-height: 86vh; overflow-y: auto;
  background: var(--bg);
  border-top: 0.5px solid var(--border-md);
  border-radius: 1rem 1rem 0 0;
  box-shadow: 0 -20px 50px rgba(0,0,0,.28);
  padding: 1.25rem 1.5rem 1.75rem;
  transform: translateY(101%);
  transition: transform .32s cubic-bezier(.16,1,.3,1);
}
.anz-open .anz-panel { transform: translateY(0); }

.anz-panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.anz-title { font-size: 1.0625rem; font-weight: 600; color: var(--text); }
.anz-close {
  background: none; border: none; cursor: pointer; color: var(--muted);
  width: 2rem; height: 2rem; border-radius: 0.5rem; display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s, transform .05s;
}
.anz-close:hover { background: var(--surface); color: var(--text); }
.anz-close:active { transform: scale(.9); }

/* ── Controles de búsqueda ──────────────────────────────────── */
.anz-controls {
  display: grid; grid-template-columns: 1.4fr 1fr 1.2fr; gap: 0.875rem;
  margin-bottom: 1.25rem;
}
.anz-select-label { display: block; font-size: 0.75rem; font-weight: 500; color: var(--text); margin-bottom: 0.3125rem; }
@media (max-width: 40rem) { .anz-controls { grid-template-columns: 1fr; } }

/* ── Grid de gráficas ───────────────────────────────────────── */
.anz-charts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.875rem; }
@media (max-width: 60rem) { .anz-charts { grid-template-columns: 1fr; } }

.anz-card {
  background: var(--surface); border: 0.5px solid var(--border);
  border-radius: 0.75rem; padding: 0.875rem 1rem 0.75rem;
  display: flex; flex-direction: column; gap: 0.5rem;
}
.anz-card-head { display: flex; align-items: center; justify-content: space-between; }
.anz-card-title { font-size: 0.8125rem; font-weight: 600; color: var(--text); }
.anz-card-nota { font-size: 0.6875rem; color: var(--muted); }

.anz-chart { position: relative; width: 100%; aspect-ratio: 340 / 190; }

.anz-placeholder {
  grid-column: 1 / -1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 2.5rem 1rem; color: var(--muted); text-align: center;
}
.anz-placeholder i { font-size: 1.75rem; color: var(--border-md); }
.anz-placeholder p { font-size: 0.8125rem; }
.anz-placeholder.anz-error { color: var(--danger); }

.anz-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.anz-spinner {
  width: 1.25rem; height: 1.25rem; border-radius: 50%;
  border: 2px solid var(--border-md); border-top-color: var(--accent);
  animation: anz-spin .7s linear infinite;
}
@keyframes anz-spin { to { transform: rotate(360deg); } }

/* ── SVG de la gráfica ──────────────────────────────────────── */
.chart-svg { width: 100%; height: 100%; display: block; overflow: visible; }
.chart-grid { stroke: var(--border); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-ylabel, .chart-xlabel { font-size: 9px; fill: var(--muted); font-family: inherit; }
.chart-area { opacity: 0; animation: anz-fade .5s ease-out .25s forwards; }
.chart-linea {
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.chart-anim { stroke-dasharray: 1400; stroke-dashoffset: 1400; animation: anz-draw .9s cubic-bezier(.4,0,.2,1) forwards; }
@keyframes anz-draw { to { stroke-dashoffset: 0; } }
.chart-punto { opacity: 0; animation: anz-fade .4s ease-out .55s forwards; }
@keyframes anz-fade { to { opacity: 1; } }

.chart-cross { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; transition: opacity .1s; }
.chart-hit { stroke: var(--surface); stroke-width: 2; vector-effect: non-scaling-stroke; transition: opacity .1s; }

.chart-tooltip {
  position: absolute; pointer-events: none; z-index: 2;
  background: var(--surface); border: 0.5px solid var(--border-md);
  border-radius: 0.5rem; box-shadow: 0 6px 18px rgba(0,0,0,.18);
  padding: 0.4375rem 0.625rem; font-size: 0.6875rem; color: var(--text);
  min-width: 8rem; transition: opacity .1s;
}
.chart-tt-fecha { font-weight: 600; margin-bottom: 0.25rem; color: var(--muted); }
.chart-tt-row { display: flex; align-items: center; gap: 0.375rem; line-height: 1.5; white-space: nowrap; }
.chart-tt-dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; flex-shrink: 0; }

.chart-vacio {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 1rem; text-align: center; font-size: 0.75rem; color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  .anz-tab.anz-bounce { animation: none; }
  .chart-area, .chart-punto { opacity: 1; animation: none; }
}
