/* ============================================================
   css/funding-origin.css
   Funding Origin module — Pro tier.
   Matches DeFade's cyan/purple cyberpunk aesthetic.
   ============================================================ */

#funding-origin-panel { width: 100%; }

/* ---- Panel container ---- */
.fo-panel {
  position: relative;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 24px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  color: var(--text, #e6e6f0);
  overflow: hidden;
}

/* Subtle gradient glow in the top-right corner — brand cyan→purple */
.fo-panel::before {
  content: "";
  position: absolute;
  top: -120px;
  right: -80px;
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(0, 212, 255, 0.08) 0%, rgba(176, 102, 255, 0.05) 40%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.fo-panel > * { position: relative; z-index: 1; }

/* Severity intensifies the corner glow rather than adding a stripe */
.fo-panel[data-severity="severe"]::before {
  background: radial-gradient(circle, rgba(255, 68, 68, 0.18) 0%, rgba(176, 102, 255, 0.06) 40%, transparent 70%);
}
.fo-panel[data-severity="danger"]::before {
  background: radial-gradient(circle, rgba(255, 136, 0, 0.14) 0%, rgba(176, 102, 255, 0.06) 40%, transparent 70%);
}
.fo-panel[data-severity="warning"]::before {
  background: radial-gradient(circle, rgba(255, 204, 0, 0.10) 0%, rgba(176, 102, 255, 0.05) 40%, transparent 70%);
}
.fo-panel[data-severity="healthy"]::before {
  background: radial-gradient(circle, rgba(0, 255, 136, 0.10) 0%, rgba(0, 212, 255, 0.05) 40%, transparent 70%);
}

/* ---- Header ---- */
.fo-header {
  margin-bottom: 22px;
}

.fo-eyebrow {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--accent, #00d4ff);
  margin-bottom: 10px;
  padding: 3px 9px;
  background: rgba(0, 212, 255, 0.08);
  border: 1px solid rgba(0, 212, 255, 0.2);
  border-radius: 4px;
}

.fo-title {
  font-family: 'Chakra Petch', 'JetBrains Mono', ui-monospace, monospace;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin: 0 0 6px 0;
  color: var(--text, #e6e6f0);
}

.fo-panel[data-severity="severe"] .fo-title,
.fo-panel[data-severity="danger"] .fo-title {
  background: linear-gradient(90deg, #ff4444, #ff8800);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: #ff4444;
}

.fo-panel[data-severity="healthy"] .fo-title {
  background: linear-gradient(90deg, #00d4ff, #00ff88);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: #00d4ff;
}

.fo-subtitle {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px;
  color: var(--text2, #8a8a9c);
  line-height: 1.5;
}

/* ---- Coverage headline (the competitor-comparable big number) ---- */
.fo-coverage {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 4px 0 10px 0;
  flex-wrap: wrap;
}
.fo-coverage-num {
  font-family: 'Chakra Petch', 'JetBrains Mono', ui-monospace, monospace;
  font-size: 40px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.5px;
  background: linear-gradient(90deg, #00d4ff, #b066ff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: #00d4ff;
}
.fo-coverage-unit {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text2, #8a8a9c);
  max-width: 220px;
  line-height: 1.4;
}

/* Tension caption + low-confidence state */
.fo-tension-caption {
  margin-top: 9px;
  font-size: 10px;
  letter-spacing: 0.3px;
  color: var(--text2, #8a8a9c);
  opacity: 0.7;
}
.fo-tension-lowconf {
  opacity: 0.8;
}
.fo-tension-note {
  text-transform: none;
  font-weight: 400;
  font-style: italic;
  opacity: 0.8;
}
.fo-tension-fill-muted {
  background: repeating-linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.06),
    rgba(255, 255, 255, 0.06) 6px,
    rgba(255, 255, 255, 0.02) 6px,
    rgba(255, 255, 255, 0.02) 12px
  );
}

/* ---- Tension bar (hero metric) ---- */
.fo-tension {
  margin-bottom: 24px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
}

.fo-tension-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 10px;
  color: var(--text2, #8a8a9c);
}

.fo-tension-label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fo-tension-label strong {
  color: var(--text, #e6e6f0);
  font-weight: 700;
  margin-left: 4px;
}

.fo-tension-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.fo-tension-suspicious .fo-tension-dot {
  background: #ff8800;
  box-shadow: 0 0 6px rgba(255, 136, 0, 0.5);
}

.fo-tension-organic .fo-tension-dot {
  background: #00ff88;
  box-shadow: 0 0 6px rgba(0, 255, 136, 0.5);
}

.fo-tension-bar {
  height: 6px;
  display: flex;
  border-radius: 3px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
}

.fo-tension-fill {
  height: 100%;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.fo-tension-fill-suspicious {
  background: linear-gradient(90deg, #ff4444, #ff8800);
  box-shadow: 0 0 8px rgba(255, 136, 0, 0.3);
}

.fo-tension-fill-organic {
  background: linear-gradient(90deg, #00ff88, #00d4ff);
  margin-left: auto;
  box-shadow: 0 0 8px rgba(0, 212, 255, 0.3);
}

/* ---- Bands (vertical stack, tier-grouped) ---- */
.fo-bands {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fo-band {
  position: relative;
  padding: 14px 16px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.fo-band:hover {
  background: rgba(255, 255, 255, 0.035);
}

.fo-band-empty {
  opacity: 0.45;
}

.fo-band-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}

.fo-band-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text, #e6e6f0);
}

.fo-band-share {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 15px;
  font-weight: 700;
  color: var(--text, #e6e6f0);
}

.fo-band-share-empty {
  color: var(--text2, #8a8a9c);
  font-weight: 400;
  font-size: 12px;
}

.fo-band-desc {
  font-size: 11px;
  color: var(--text2, #8a8a9c);
  margin-bottom: 10px;
  opacity: 0.85;
}

/* Tier accent strips, using DeFade's color palette */
.band-trust {
  border-left: 2px solid #00ff88;
}
.band-trust .fo-band-share {
  color: #00ff88;
}
.band-trust:hover {
  border-color: rgba(0, 255, 136, 0.6);
}

.band-neutral {
  border-left: 2px solid rgba(0, 212, 255, 0.5);
}
.band-neutral .fo-band-share {
  color: var(--accent, #00d4ff);
}
.band-neutral:hover {
  border-color: rgba(0, 212, 255, 0.6);
}

.band-warning {
  border-left: 2px solid #ffcc00;
}
.band-warning .fo-band-share {
  color: #ffcc00;
}
.band-warning:hover {
  border-color: rgba(255, 204, 0, 0.6);
}

.band-gambling {
  border-left: 2px solid #ff9933;
}
.band-gambling .fo-band-share {
  color: #ff9933;
}
.band-gambling:hover {
  border-color: rgba(255, 153, 51, 0.6);
}
.band-gambling .fo-chip:hover {
  background: rgba(255, 153, 51, 0.06);
  border-color: rgba(255, 153, 51, 0.3);
}

.band-danger {
  border-left: 2px solid #ff8800;
}
.band-danger .fo-band-share {
  color: #ff8800;
}
.band-danger:hover {
  border-color: rgba(255, 136, 0, 0.6);
}

.band-severe {
  border-left: 2px solid #ff4444;
  background: rgba(255, 68, 68, 0.03);
}
.band-severe .fo-band-share {
  color: #ff4444;
}
.band-severe:hover {
  border-color: rgba(255, 68, 68, 0.6);
  background: rgba(255, 68, 68, 0.05);
}

.band-muted {
  border-left: 2px solid rgba(255, 255, 255, 0.08);
  opacity: 0.7;
}
.band-muted .fo-band-share {
  color: var(--text2, #8a8a9c);
}

/* ---- Chips (origin pills inside bands) ---- */
.fo-band-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding-top: 2px;
}

.fo-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  transition: opacity 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

/* The largest origin in a band gets emphasis via weight/tint, NOT a transform
   scale (which overlapped neighbours because it didn't reserve layout space). */
.fo-chip-dominant {
  background: rgba(0, 212, 255, 0.07);
  border-color: rgba(0, 212, 255, 0.22);
}
.fo-chip-dominant .fo-chip-share {
  color: var(--accent, #00d4ff);
}

.fo-chip:hover {
  background: rgba(0, 212, 255, 0.06);
  border-color: rgba(0, 212, 255, 0.25);
}

.fo-chip-name {
  color: var(--text2, #8a8a9c);
}

.fo-chip-share {
  color: var(--text, #e6e6f0);
  font-weight: 700;
}

.fo-chip-dim {
  opacity: 0.25;
}

/* Tier-specific chip tints on hover */
.band-trust .fo-chip:hover {
  background: rgba(0, 255, 136, 0.06);
  border-color: rgba(0, 255, 136, 0.3);
}
.band-warning .fo-chip:hover {
  background: rgba(255, 204, 0, 0.06);
  border-color: rgba(255, 204, 0, 0.3);
}
.band-danger .fo-chip:hover {
  background: rgba(255, 136, 0, 0.06);
  border-color: rgba(255, 136, 0, 0.3);
}
.band-severe .fo-chip {
  background: rgba(255, 68, 68, 0.06);
  border-color: rgba(255, 68, 68, 0.2);
}
.band-severe .fo-chip:hover {
  background: rgba(255, 68, 68, 0.1);
  border-color: rgba(255, 68, 68, 0.4);
}

/* ---- Footer ---- */
.fo-footer {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.fo-footnote {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px;
  color: var(--text2, #8a8a9c);
  opacity: 0.7;
  letter-spacing: 0.2px;
  line-height: 1.5;
}

/* ---- Skeleton loading ---- */
.fo-loading-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.fo-spinner {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border-radius: 50%;
  border: 2px solid rgba(0, 212, 255, 0.15);
  border-top-color: #00d4ff;
  border-right-color: #b066ff;
  animation: fo-spin 0.8s linear infinite;
}

@keyframes fo-spin {
  to { transform: rotate(360deg); }
}

.fo-loading-copy { display: flex; flex-direction: column; gap: 3px; }

.fo-loading-title {
  font-family: 'Chakra Petch', 'JetBrains Mono', ui-monospace, monospace;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: var(--text, #e6e6f0);
}

.fo-loading-status {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  color: var(--accent, #00d4ff);
  opacity: 0.85;
  transition: opacity 0.18s ease;
  letter-spacing: 0.2px;
}

.fo-skeleton .fo-title-shimmer {
  height: 28px;
  width: 60%;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.03),
    rgba(0, 212, 255, 0.08),
    rgba(255, 255, 255, 0.03)
  );
  background-size: 200% 100%;
  animation: fo-shimmer 1.6s linear infinite;
  border-radius: 6px;
  margin-top: 8px;
}

.fo-bands-shimmer {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.fo-band-shimmer {
  height: 64px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.025) 0%,
    rgba(0, 212, 255, 0.10) 35%,
    rgba(176, 102, 255, 0.10) 50%,
    rgba(0, 212, 255, 0.10) 65%,
    rgba(255, 255, 255, 0.025) 100%
  );
  background-size: 220% 100%;
  animation: fo-shimmer 1.4s linear infinite;
  border-radius: 10px;
  border-left: 2px solid rgba(0, 212, 255, 0.18);
}

.fo-band-shimmer:nth-child(2) { animation-delay: 0.15s; }
.fo-band-shimmer:nth-child(3) { animation-delay: 0.30s; }

@keyframes fo-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .fo-spinner { animation-duration: 1.6s; }
  .fo-band-shimmer { animation: none; background-position: 0 0; }
}

/* ---- Locked state (non-Pro users) ---- */
.fo-locked-msg {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 13px;
  color: var(--text2, #8a8a9c);
  margin: 12px 0 0 0;
  line-height: 1.5;
}

.fo-locked-msg a {
  color: var(--accent, #00d4ff);
  text-decoration: none;
  font-weight: 700;
}

.fo-locked-msg a:hover {
  text-decoration: underline;
}

/* ---- Error state ---- */
.fo-error-msg {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 13px;
  color: #ff6b6b;
  margin: 12px 0 0 0;
}

/* ---- Mobile ---- */
@media (max-width: 640px) {
  .fo-panel {
    padding: 18px;
    border-radius: 12px;
  }
  .fo-title {
    font-size: 18px;
  }
  .fo-band {
    padding: 12px 14px;
  }
  .fo-tension-labels {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .fo-tension-organic {
    flex-direction: row-reverse;
    justify-content: flex-end;
  }
  .fo-band-chips {
    gap: 6px;
  }
  .fo-chip {
    font-size: 10px;
    padding: 3px 8px;
  }
}
