/* ═══════════════════════════════════════════════════════
   VIBRARANK v1.0 — Feed Ranking Engine + Trust System
   Urban Intelligence Layer · VibraWorld
   ═══════════════════════════════════════════════════════ */

/* ── Panel Principal ── */
#vibra-rank-panel {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #06040f;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 80px;
}

#vibra-rank-panel.vr-open {
  display: block;
  animation: vrSlideUp .3s cubic-bezier(.2,0,.1,1);
}

@keyframes vrSlideUp {
  from { transform: translateY(30px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ── Header ── */
.vr-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(6,4,15,.97);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(138,87,255,.2);
  padding: .85rem 1rem;
  display: flex;
  align-items: center;
  gap: .75rem;
}

.vr-header-back {
  background: rgba(138,87,255,.12);
  border: 1px solid rgba(138,87,255,.2);
  border-radius: 8px;
  color: rgba(200,180,255,.9);
  font-family: var(--mono);
  font-size: .75rem;
  padding: .35rem .65rem;
  cursor: pointer;
  transition: background .15s;
}
.vr-header-back:hover { background: rgba(138,87,255,.22); }

.vr-header-title {
  flex: 1;
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -.02em;
}

.vr-header-live {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-family: var(--mono);
  font-size: .6rem;
  color: var(--teal, #00e5ff);
  letter-spacing: .08em;
}

.vr-live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal, #00e5ff);
  animation: vrPulse 1.5s ease-in-out infinite;
}

@keyframes vrPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0,229,255,.6); }
  50%       { box-shadow: 0 0 0 5px rgba(0,229,255,0); }
}

/* ── Score Formula Banner ── */
.vr-formula {
  margin: 1rem;
  background: rgba(138,87,255,.06);
  border: 1px solid rgba(138,87,255,.15);
  border-radius: 12px;
  padding: .85rem 1rem;
  font-family: var(--mono);
  font-size: .6rem;
  color: rgba(200,180,255,.7);
  line-height: 1.8;
}

.vr-formula-title {
  font-size: .65rem;
  font-weight: 700;
  color: rgba(138,87,255,.9);
  letter-spacing: .1em;
  margin-bottom: .5rem;
}

.vr-formula-eq {
  color: rgba(220,200,255,.9);
  font-size: .62rem;
}

.vr-formula-vars {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-top: .6rem;
}

.vr-fvar {
  background: rgba(138,87,255,.1);
  border: 1px solid rgba(138,87,255,.15);
  border-radius: 5px;
  padding: .2rem .45rem;
  font-size: .55rem;
  color: rgba(200,180,255,.8);
}

/* ── Sección ── */
.vr-section {
  margin: 0 1rem 1.2rem;
}

.vr-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .65rem;
}

.vr-section-title {
  font-family: var(--mono);
  font-size: .62rem;
  font-weight: 700;
  color: rgba(200,180,255,.6);
  letter-spacing: .12em;
  text-transform: uppercase;
}

.vr-section-badge {
  font-family: var(--mono);
  font-size: .55rem;
  color: var(--teal, #00e5ff);
  background: rgba(0,229,255,.1);
  border: 1px solid rgba(0,229,255,.2);
  border-radius: 20px;
  padding: .15rem .5rem;
}

/* ── Score Cards ── */
.vr-score-list {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.vr-score-card {
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 12px;
  padding: .75rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  transition: border-color .2s;
}

.vr-score-card:hover {
  border-color: rgba(138,87,255,.3);
}

.vr-rank-badge {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--sans);
  font-size: .8rem;
  font-weight: 900;
  flex-shrink: 0;
}

.vr-rank-1 { background: rgba(255,196,0,.15); color: #ffc400; border: 1px solid rgba(255,196,0,.25); }
.vr-rank-2 { background: rgba(180,180,200,.1); color: #c0c0d0; border: 1px solid rgba(180,180,200,.2); }
.vr-rank-3 { background: rgba(205,127,50,.1);  color: #cd7f32; border: 1px solid rgba(205,127,50,.2); }
.vr-rank-n { background: rgba(138,87,255,.08);  color: rgba(200,180,255,.6); border: 1px solid rgba(138,87,255,.12); }

.vr-card-body {
  flex: 1;
  min-width: 0;
}

.vr-card-text {
  font-family: var(--sans);
  font-size: .8rem;
  color: rgba(240,235,255,.9);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: .2rem;
}

.vr-card-meta {
  font-family: var(--mono);
  font-size: .55rem;
  color: rgba(200,180,255,.5);
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}

.vr-card-score {
  text-align: right;
  flex-shrink: 0;
}

.vr-score-num {
  font-family: var(--sans);
  font-size: 1.1rem;
  font-weight: 900;
  line-height: 1;
}

.vr-score-label {
  font-family: var(--mono);
  font-size: .5rem;
  color: rgba(200,180,255,.5);
  letter-spacing: .08em;
}

/* Score color ramp */
.vr-s-high   { color: #00e676; }
.vr-s-mid    { color: #ffc400; }
.vr-s-low    { color: rgba(200,180,255,.6); }

/* ── Score Bar ── */
.vr-bar-wrap {
  height: 3px;
  background: rgba(255,255,255,.06);
  border-radius: 2px;
  margin-top: .35rem;
  overflow: hidden;
}

.vr-bar {
  height: 100%;
  border-radius: 2px;
  transition: width .8s cubic-bezier(.2,0,.1,1);
}

/* ── Trust Score Grid ── */
.vr-trust-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .5rem;
}

.vr-trust-card {
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 12px;
  padding: .75rem;
  position: relative;
  overflow: hidden;
}

.vr-trust-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
}

.vr-trust-card.trust-high::before   { background: #00e676; }
.vr-trust-card.trust-mid::before    { background: #ffc400; }
.vr-trust-card.trust-low::before    { background: #ff5252; }
.vr-trust-card.trust-new::before    { background: rgba(138,87,255,.6); }

.vr-trust-name {
  font-family: var(--sans);
  font-size: .72rem;
  font-weight: 700;
  color: rgba(240,235,255,.9);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: .3rem;
}

.vr-trust-score {
  font-family: var(--sans);
  font-size: 1.5rem;
  font-weight: 900;
  line-height: 1;
  margin-bottom: .25rem;
}

.vr-trust-label {
  font-family: var(--mono);
  font-size: .52rem;
  color: rgba(200,180,255,.5);
  letter-spacing: .08em;
}

.vr-trust-flags {
  margin-top: .4rem;
  display: flex;
  gap: .3rem;
  flex-wrap: wrap;
}

.vr-flag {
  font-family: var(--mono);
  font-size: .5rem;
  padding: .1rem .35rem;
  border-radius: 4px;
}

.vr-flag-ok   { background: rgba(0,230,118,.1); color: #00e676; border: 1px solid rgba(0,230,118,.2); }
.vr-flag-warn { background: rgba(255,196,0,.1);  color: #ffc400; border: 1px solid rgba(255,196,0,.2); }
.vr-flag-bad  { background: rgba(255,82,82,.1);  color: #ff5252; border: 1px solid rgba(255,82,82,.2); }

/* ── Zone Energy Table ── */
.vr-zone-list {
  display: flex;
  flex-direction: column;
  gap: .4rem;
}

.vr-zone-row {
  display: flex;
  align-items: center;
  gap: .6rem;
  background: rgba(255,255,255,.025);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 10px;
  padding: .6rem .75rem;
}

.vr-zone-icon {
  font-size: 1rem;
  flex-shrink: 0;
}

.vr-zone-name {
  flex: 1;
  font-family: var(--sans);
  font-size: .75rem;
  font-weight: 700;
  color: rgba(240,235,255,.9);
}

.vr-zone-energy {
  font-family: var(--sans);
  font-size: .9rem;
  font-weight: 900;
}

.vr-zone-vel {
  font-family: var(--mono);
  font-size: .55rem;
  color: rgba(200,180,255,.5);
  text-align: right;
}

/* ── Anti-Spam Alerts ── */
.vr-alerts {
  display: flex;
  flex-direction: column;
  gap: .4rem;
}

.vr-alert {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  background: rgba(255,82,82,.05);
  border: 1px solid rgba(255,82,82,.15);
  border-radius: 10px;
  padding: .65rem .75rem;
  animation: vrAlertIn .3s ease;
}

@keyframes vrAlertIn {
  from { transform: translateX(-8px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

.vr-alert-icon { font-size: .9rem; flex-shrink: 0; margin-top: .05rem; }

.vr-alert-body { flex: 1; }

.vr-alert-title {
  font-family: var(--mono);
  font-size: .62rem;
  font-weight: 700;
  color: #ff5252;
  margin-bottom: .2rem;
}

.vr-alert-desc {
  font-family: var(--mono);
  font-size: .56rem;
  color: rgba(200,180,255,.6);
  line-height: 1.5;
}

.vr-alert-time {
  font-family: var(--mono);
  font-size: .5rem;
  color: rgba(200,180,255,.35);
}

.vr-no-alerts {
  text-align: center;
  padding: 1.5rem;
  font-family: var(--mono);
  font-size: .65rem;
  color: rgba(200,180,255,.35);
}

/* ── Score Breakdown Modal ── */
.vr-breakdown-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.vr-breakdown-overlay.vr-bd-open {
  display: flex;
  animation: vrFadeIn .2s ease;
}

@keyframes vrFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.vr-breakdown-card {
  background: #0d0b1a;
  border: 1px solid rgba(138,87,255,.25);
  border-radius: 16px;
  padding: 1.25rem;
  width: 100%;
  max-width: 360px;
  max-height: 80vh;
  overflow-y: auto;
}

.vr-bd-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.vr-bd-title {
  font-family: var(--sans);
  font-size: .9rem;
  font-weight: 800;
  color: #fff;
}

.vr-bd-close {
  background: rgba(255,255,255,.07);
  border: none;
  border-radius: 6px;
  color: rgba(200,180,255,.7);
  font-size: .9rem;
  width: 28px; height: 28px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

.vr-bd-total {
  text-align: center;
  padding: 1rem;
  background: rgba(138,87,255,.08);
  border: 1px solid rgba(138,87,255,.15);
  border-radius: 12px;
  margin-bottom: 1rem;
}

.vr-bd-total-num {
  font-family: var(--sans);
  font-size: 2.5rem;
  font-weight: 900;
  line-height: 1;
  background: linear-gradient(135deg, #8a57ff, #00e5ff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.vr-bd-total-label {
  font-family: var(--mono);
  font-size: .6rem;
  color: rgba(200,180,255,.5);
  letter-spacing: .1em;
  margin-top: .2rem;
}

.vr-bd-factors {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.vr-bd-factor {
  display: flex;
  align-items: center;
  gap: .6rem;
}

.vr-bd-factor-icon { font-size: .95rem; flex-shrink: 0; }

.vr-bd-factor-info { flex: 1; }

.vr-bd-factor-name {
  font-family: var(--mono);
  font-size: .6rem;
  color: rgba(200,180,255,.7);
  margin-bottom: .25rem;
}

.vr-bd-factor-bar-wrap {
  height: 4px;
  background: rgba(255,255,255,.06);
  border-radius: 2px;
  overflow: hidden;
}

.vr-bd-factor-bar {
  height: 100%;
  border-radius: 2px;
  transition: width .8s cubic-bezier(.2,0,.1,1);
}

.vr-bd-factor-val {
  font-family: var(--sans);
  font-size: .8rem;
  font-weight: 800;
  min-width: 36px;
  text-align: right;
}

/* ── Score Badge on feed posts ── */
.vr-post-score {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  font-family: var(--mono);
  font-size: .52rem;
  color: rgba(200,180,255,.5);
  background: rgba(138,87,255,.06);
  border: 1px solid rgba(138,87,255,.1);
  border-radius: 4px;
  padding: .12rem .35rem;
  cursor: pointer;
  transition: all .15s;
  vertical-align: middle;
}

.vr-post-score:hover {
  background: rgba(138,87,255,.14);
  border-color: rgba(138,87,255,.25);
  color: rgba(200,180,255,.8);
}

.vr-post-score-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Ranking Engine HUD (floating mini) ── */
.vr-hud {
  position: fixed;
  bottom: 80px;
  right: 12px;
  z-index: 150;
  background: rgba(9,6,18,.92);
  border: 1px solid rgba(138,87,255,.2);
  border-radius: 12px;
  padding: .6rem .75rem;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: none;
  flex-direction: column;
  gap: .3rem;
  min-width: 130px;
  animation: vrHudIn .3s ease;
}

@keyframes vrHudIn {
  from { transform: translateX(20px) scale(.95); opacity: 0; }
  to   { transform: translateX(0) scale(1); opacity: 1; }
}

.vr-hud.vr-hud-visible { display: flex; }

.vr-hud-title {
  font-family: var(--mono);
  font-size: .5rem;
  color: rgba(138,87,255,.7);
  letter-spacing: .1em;
  font-weight: 700;
}

.vr-hud-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
}

.vr-hud-stat-label {
  font-family: var(--mono);
  font-size: .52rem;
  color: rgba(200,180,255,.5);
}

.vr-hud-stat-val {
  font-family: var(--sans);
  font-size: .7rem;
  font-weight: 800;
  color: var(--teal, #00e5ff);
}

.vr-hud-close {
  position: absolute;
  top: 4px; right: 6px;
  background: none; border: none;
  color: rgba(200,180,255,.3);
  font-size: .65rem;
  cursor: pointer;
  padding: 0;
}
