/* InsightPulse — frontend styles
 * © Media Horizon — https://mediahorizonsl.com/
 * Theme vars are injected by the plugin via wp_add_inline_style.
 * Fallbacks set here so the styles work stand-alone too.
 * ---------------------------------------------------------------- */
:root {
    --ip-bg: #0b1410;
    --ip-card: #0d1a14;
    --ip-line: #1c3329;
    --ip-ink: #ffffff;
    --ip-muted: #ffffff;
    --ip-accent: #00ffb8;
}

.ip-card {
  background: var(--ip-card);
  border: 1px solid var(--ip-line);
  border-radius: 14px;
  padding: 18px 18px 14px;
  color: var(--ip-ink);
  position: relative;
}
.ip-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; gap: 12px; }
.ip-card-title { margin: 0; font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--ip-muted); font-weight: 600; }
.ip-chart-box { position: relative; height: 270px; }

/* ── Legend ─────────────────────────────────────────────── */
.ip-legend { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }
.ip-legend span { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ip-muted); letter-spacing: .03em; }
.ip-legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.ip-legend i.ip-leg-line { width: 18px; height: 3px; border-radius: 2px; }   /* combo: line-series marker */

/* ── Play / stop button — click to play / stop the spoken insight ── */
.ip-speaker {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  box-sizing: border-box;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--ip-accent) 55%, transparent);
  background: color-mix(in srgb, var(--ip-accent) 14%, transparent);
  color: var(--ip-accent);
  cursor: pointer;
  transition: background .18s, border-color .18s, box-shadow .18s;
}
.ip-speaker:hover { background: color-mix(in srgb, var(--ip-accent) 24%, transparent); border-color: var(--ip-accent); }
.ip-speaker:focus-visible { outline: 2px solid var(--ip-accent); outline-offset: 2px; }
.ip-speaker svg { display: block; width: 14px; height: 14px; }
.ip-spk-play { margin-left: 1px; }             /* optical-centre the triangle */
.ip-speaker .ip-spk-stop { display: none; }    /* hidden while idle (beats .ip-speaker svg) */

/* idle → play triangle ▶;  playing (.live) → stop square ■ */
.ip-speaker.live .ip-spk-play { display: none; }
.ip-speaker.live .ip-spk-stop { display: block; }

/* brief attention pulse on load so first-time visitors notice it's clickable;
   stops after a few cycles and is removed entirely on first click */
@keyframes ip-spk-hint {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ip-accent) 40%, transparent); }
  50%      { box-shadow: 0 0 0 5px color-mix(in srgb, var(--ip-accent) 0%, transparent); }
}
.ip-speaker.ip-spk-hint:not(.live) { animation: ip-spk-hint 1.6s ease-out 3; }
@media (prefers-reduced-motion: reduce) {
  .ip-speaker.ip-spk-hint:not(.live) { animation: none; }
}

/* ── Insight caption bubble ────────────────────────────── */
.ip-caption {
  position: absolute; top: 44px; left: 18px; max-width: 72%;
  background: rgba(10,20,16,.96); border: 1px solid var(--ip-line, #1c2b25);
  border-radius: 12px; padding: 11px 14px;
  display: flex; gap: 10px; align-items: flex-start;
  opacity: 0; transform: translateY(-4px);
  transition: opacity .18s, transform .18s;
  pointer-events: none; z-index: 6;
  box-shadow: 0 16px 34px rgba(0,0,0,.45);
}
.ip-caption.show { opacity: 1; transform: none; }
.ip-caption::after {
  content: ''; position: absolute; bottom: -7px; left: 24px;
  width: 12px; height: 12px;
  background: rgba(10,20,16,.96);
  border-right: 1px solid var(--ip-line, #1c2b25);
  border-bottom: 1px solid var(--ip-line, #1c2b25);
  transform: rotate(45deg);
}
.ip-cap-text { font-size: 13px; line-height: 1.45; color: var(--ip-ink); }
.ip-cap-ico { flex: 0 0 auto; width: 18px; height: 18px; margin-top: 1px; color: var(--ip-accent); opacity: .45; transition: opacity .2s; }
.ip-cap-ico.live { opacity: 1; }
.ip-cap-ico svg { width: 100%; height: 100%; }
.ip-cap-ico .bar { fill: currentColor; transform-origin: center bottom; }
.ip-cap-ico.live .b1 { animation: ip-eq .7s infinite ease-in-out; }
.ip-cap-ico.live .b2 { animation: ip-eq .7s infinite ease-in-out .15s; }
.ip-cap-ico.live .b3 { animation: ip-eq .7s infinite ease-in-out .3s; }
@keyframes ip-eq { 0%,100% { transform: scaleY(.4); } 50% { transform: scaleY(1); } }

/* ── Shared value tooltip ──────────────────────────────── */
.ip-tt {
  position: fixed; pointer-events: none; z-index: 99999;
  background: rgba(8,16,13,.96); border: 1px solid var(--ip-line, #1c2b25);
  border-radius: 10px; padding: 11px 13px; min-width: 170px;
  box-shadow: 0 18px 40px rgba(0,0,0,.5); opacity: 0; transition: opacity .12s;
  font-family: 'Barlow','Segoe UI',system-ui,sans-serif; font-size: 13px; color: #e7efe9;
}
.ip-tt-head { color: #7e948b; font-size: 11px; letter-spacing: .08em; margin-bottom: 7px; text-transform: uppercase; }
.ip-tt-row { display: flex; justify-content: space-between; gap: 18px; margin: 3px 0; }
.ip-tt-row b { font-weight: 600; }

/* ── Data table (type: 'table') ────────────────────────── */
.ip-card-table { padding: 0; overflow: hidden; }                 /* full-bleed gradient header, clipped to card radius */
.ip-card-head-table { padding: 8px 12px 0; margin: 0; justify-content: flex-end; }
.ip-table-wrap { width: 100%; overflow-x: auto; }
.ip-table { width: 100%; border-collapse: collapse; font-size: 16px; line-height: 1.35; }
.ip-table thead th {
  color: #fff; font-weight: 700; text-align: right;
  padding: 14px 20px; white-space: nowrap;
}
.ip-table thead th.ip-th-corner { text-align: left; }
.ip-table tbody th, .ip-table tbody td {
  padding: 16px 20px; vertical-align: top;
  border-top: 1px solid var(--ip-line, #e8e8e8);
}
.ip-table tbody tr:first-child th, .ip-table tbody tr:first-child td { border-top: none; }
.ip-table tbody th.ip-row-label { text-align: left; font-weight: 400; color: var(--ip-ink, #444); }
.ip-table tbody td { text-align: right; color: var(--ip-muted, #666); font-variant-numeric: tabular-nums; }
