/* CAZZATOMETRO column, same visual language as FACTS, NO BULLSHIT.
   Everything is scoped under .jev-panel / .jev-handle to avoid clashing with YouTube.
   Shared by the extension (content script, live page) and the web app. */

.jev-panel,
.jev-handle {
  /* Background: deep black with a cold tint */
  --jev-bg: #0a0a0f;
  --jev-surface: #0d0d12;
  --jev-elevated: #16161d;
  --jev-border: #2c2c2e;
  --jev-border-subtle: #1c1c1e;

  /* Text */
  --jev-text: #f5f5f7;
  --jev-secondary: #c7c7cc;
  --jev-muted: #8e8e93;

  /* Electric lime signature accent */
  --jev-accent: #cfff04;
  --jev-accent-dim: rgba(207, 255, 4, 0.15);
  --jev-accent-glow: rgba(207, 255, 4, 0.25);

  /* Neon verdicts */
  --jev-true: #00ff88;
  --jev-false: #ff3366;
  --jev-partial: #ffb800;
  --jev-misleading: #ff8c2b;
  --jev-unknown: #9aa0a6;

  --jev-font-display: "Space Grotesk", system-ui, sans-serif;
  --jev-font-body: "DM Sans", system-ui, sans-serif;
  --jev-font-mono: "JetBrains Mono", ui-monospace, monospace;
  --jev-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

.jev-panel {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 2147483646;
  width: 360px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  background: var(--jev-bg);
  color: var(--jev-text);
  border-left: 1px solid var(--jev-border);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.5);
  font-family: var(--jev-font-body);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: transform 250ms var(--jev-ease-out);
}

.jev-panel[hidden] {
  display: none;
}

.jev-panel *,
.jev-panel *::before,
.jev-panel *::after {
  box-sizing: border-box;
}

.jev-panel.jev-collapsed {
  transform: translateX(100%);
}

.jev-panel.jev-fullscreen {
  position: absolute;
  height: 100%;
}

.jev-panel button {
  font-family: inherit;
}

.jev-panel button:focus-visible,
.jev-panel a:focus-visible,
.jev-handle:focus-visible {
  outline: 2px solid var(--jev-accent);
  outline-offset: 2px;
}

/* ---------- Header ---------- */

.jev-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 10px 12px 14px;
  border-bottom: 1px solid var(--jev-border);
}

.jev-brand {
  display: flex;
  align-items: center;
  min-width: 0;
  font-family: var(--jev-font-display);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -1px;
  text-transform: uppercase;
  user-select: none;
}

.jev-brand-main {
  color: var(--jev-accent);
  text-shadow: 0 0 20px var(--jev-accent-glow);
}

.jev-brand-rest {
  color: var(--jev-muted);
  font-weight: 500;
}

.jev-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  margin-right: 9px;
  border-radius: 50%;
  background: var(--jev-false);
}

.jev-panel[data-status="connected"] .jev-dot {
  background: var(--jev-true);
  animation: jev-pulse 1.2s infinite;
}

.jev-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}

.jev-stop {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-right: 4px;
  padding: 4px 10px;
  border: 0;
  border-radius: 6px;
  background: var(--jev-false);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.jev-stop:hover {
  background: #ff1a53;
}

.jev-stop[hidden] {
  display: none;
}

.jev-icon-btn {
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--jev-muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.jev-icon-btn:hover {
  color: var(--jev-text);
  background: var(--jev-elevated);
}

/* ---------- Status ---------- */

.jev-statusbar {
  display: flex;
  align-items: center;
  padding: 6px 14px;
  border-bottom: 1px solid var(--jev-border-subtle);
}

.jev-status {
  font-family: var(--jev-font-mono);
  font-size: 11px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--jev-muted);
}

.jev-status[data-status="connected"] {
  color: var(--jev-true);
}

.jev-status[data-status="paused"],
.jev-status[data-status="reconnecting"] {
  color: var(--jev-partial);
}

.jev-status[data-status="error"],
.jev-status[data-status="limit"],
.jev-status[data-status="signedout"] {
  color: var(--jev-false);
}

/* ---------- Live transcript ---------- */

.jev-live {
  max-height: 120px;
  min-height: 42px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  padding: 10px 14px;
  border-bottom: 1px solid var(--jev-border);
  color: var(--jev-secondary);
  font-size: 12px;
  line-height: 1.5;
}

.jev-live-committed:not(:empty)::after {
  content: " ";
}

.jev-live-partial,
.jev-live-placeholder {
  color: var(--jev-muted);
  font-style: italic;
}

.jev-live-placeholder[hidden] {
  display: none;
}

/* ---------- Feed ---------- */

.jev-feed {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--jev-border) transparent;
}

.jev-empty {
  margin: 40px 12px 0;
  color: var(--jev-muted);
  font-size: 13px;
  text-align: center;
}

.jev-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--jev-muted);
  font-family: var(--jev-font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.jev-divider::before,
.jev-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--jev-border);
}

/* ---------- Cards ---------- */

.jev-card {
  --jev-tone: var(--jev-accent);
  --jev-tone-glow: var(--jev-accent-glow);
  position: relative;
  flex-shrink: 0;
  overflow: hidden;
  padding: 12px 12px 12px 16px;
  background: var(--jev-surface);
  border: 2px solid var(--jev-border);
  border-radius: 12px;
  animation: jev-card-in 250ms var(--jev-ease-out) both;
}

/* Left glow bar, colored by the verdict. */
.jev-card::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 4px;
  background: var(--jev-tone);
  box-shadow: 0 0 20px var(--jev-tone), 0 0 40px var(--jev-tone-glow);
}

.jev-card[data-state="pending"]::before {
  animation: jev-glow-pulse 2s ease infinite;
}

.jev-card[data-verdict="VERO"] { --jev-tone: var(--jev-true); --jev-tone-glow: rgba(0, 255, 136, 0.3); }
.jev-card[data-verdict="FALSO"] { --jev-tone: var(--jev-false); --jev-tone-glow: rgba(255, 51, 102, 0.3); }
.jev-card[data-verdict="PARZIALMENTE_VERO"] { --jev-tone: var(--jev-partial); --jev-tone-glow: rgba(255, 184, 0, 0.3); }
.jev-card[data-verdict="FUORVIANTE"] { --jev-tone: var(--jev-misleading); --jev-tone-glow: rgba(255, 140, 43, 0.3); }
.jev-card[data-verdict="NON_VERIFICABILE"] { --jev-tone: var(--jev-unknown); --jev-tone-glow: rgba(154, 160, 166, 0.3); }

.jev-card[data-state="error"] {
  opacity: 0.85;
}

.jev-card[data-state="error"]::before {
  background: var(--jev-muted);
  box-shadow: none;
  opacity: 0.5;
}

.jev-card.jev-flash {
  animation: jev-flash 900ms ease-out;
}

.jev-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.jev-card[data-state="pending"] .jev-card-head,
.jev-card[data-state="error"] .jev-card-head {
  margin-bottom: 8px;
}

.jev-card-head:empty {
  display: none;
}

.jev-transcript {
  margin: 0;
  color: var(--jev-muted);
  font-size: 12.5px;
  font-style: italic;
}

/* One block per extracted claim; blocks after the first are separated by a rule. */
.jev-claims {
  display: flex;
  flex-direction: column;
}

.jev-claims:empty {
  display: none;
}

.jev-claim-block + .jev-claim-block {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--jev-border-subtle);
}

/* ---------- Collapsible claim ---------- */

.jev-claim-summary,
.jev-sources-summary {
  list-style: none;
  cursor: pointer;
}

.jev-claim-summary::-webkit-details-marker,
.jev-sources-summary::-webkit-details-marker {
  display: none;
}

.jev-claim-summary:focus-visible,
.jev-sources-summary:focus-visible {
  outline: 2px solid var(--jev-accent);
  outline-offset: 2px;
  border-radius: 6px;
}

.jev-claim-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.jev-claim-head .jev-time {
  margin-left: auto;
}

/* Down-pointing chevron that flips when the section is open. */
.jev-chevron {
  flex-shrink: 0;
  width: 7px;
  height: 7px;
  margin: 0 4px 3px auto;
  border-right: 1.5px solid var(--jev-muted);
  border-bottom: 1.5px solid var(--jev-muted);
  transform: rotate(45deg);
  transition: transform 150ms ease;
}

.jev-time + .jev-chevron {
  margin-left: 6px;
}

details[open] > summary .jev-chevron {
  margin-bottom: -3px;
  transform: rotate(-135deg);
}

.jev-claim-summary:hover .jev-chevron,
.jev-sources-summary:hover .jev-chevron {
  border-color: var(--jev-accent);
}

/* Collapsed claims stay compact: at most two lines of text. */
.jev-claim-block:not([open]) .jev-claim {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.jev-claim-details {
  animation: jev-reveal 180ms var(--jev-ease-out);
}

/* Card meta (topic, latency) only when something is expanded. */
.jev-card:not(:has(details.jev-claim-block[open])) .jev-meta {
  display: none;
}

/* ---------- Verdict badge ---------- */

.jev-badge {
  --jev-badge: var(--jev-unknown);
  --jev-badge-rgb: 154, 160, 166;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: 1px solid rgba(var(--jev-badge-rgb), 0.3);
  border-radius: 999px;
  background: rgba(var(--jev-badge-rgb), 0.12);
  box-shadow: 0 0 12px rgba(var(--jev-badge-rgb), 0.15);
  color: var(--jev-badge);
  font-family: var(--jev-font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  white-space: nowrap;
}

.jev-badge svg {
  flex-shrink: 0;
}

.jev-badge[data-verdict="VERO"] { --jev-badge: var(--jev-true); --jev-badge-rgb: 0, 255, 136; }
.jev-badge[data-verdict="FALSO"] { --jev-badge: var(--jev-false); --jev-badge-rgb: 255, 51, 102; }
.jev-badge[data-verdict="PARZIALMENTE_VERO"] { --jev-badge: var(--jev-partial); --jev-badge-rgb: 255, 184, 0; }
.jev-badge[data-verdict="FUORVIANTE"] { --jev-badge: var(--jev-misleading); --jev-badge-rgb: 255, 140, 43; }

.jev-badge[data-verdict="ERROR"] {
  --jev-badge: var(--jev-muted);
  --jev-badge-rgb: 120, 120, 130;
  box-shadow: none;
}

.jev-badge-pending {
  --jev-badge: var(--jev-accent);
  --jev-badge-rgb: 207, 255, 4;
}

.jev-spinner {
  width: 10px;
  height: 10px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: jev-spin 700ms linear infinite;
}

/* ---------- Reliability ---------- */

.jev-reliability {
  color: var(--jev-muted);
  font-family: var(--jev-font-mono);
  font-size: 11px;
}

/* ---------- Card text ---------- */

.jev-time {
  margin-left: auto;
  padding: 0 4px;
  border: 0;
  background: none;
  color: var(--jev-muted);
  font-family: var(--jev-font-mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.jev-time:hover {
  color: var(--jev-accent);
}

.jev-repeat {
  color: var(--jev-muted);
  font-size: 11px;
}

.jev-claim {
  margin: 0;
  color: var(--jev-text);
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.55;
}

.jev-quote {
  margin: 6px 0 0;
  padding-left: 10px;
  border-left: 2px solid var(--jev-border);
  color: var(--jev-muted);
  font-size: 12px;
  font-style: italic;
  line-height: 1.6;
}

.jev-reason {
  margin: 8px 0 0;
  color: var(--jev-secondary);
  font-size: 12.5px;
  line-height: 1.6;
}

.jev-skeleton {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.jev-skeleton span {
  height: 9px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--jev-elevated) 25%, var(--jev-border) 50%, var(--jev-elevated) 75%);
  background-size: 200% 100%;
  animation: jev-shimmer 1.2s linear infinite;
}

.jev-skeleton span:last-child {
  width: 65%;
}

/* ---------- Sources ---------- */

.jev-sources-box {
  margin-top: 10px;
}

.jev-sources-summary {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border: 1px solid var(--jev-border-subtle);
  border-radius: 8px;
  background: var(--jev-elevated);
  color: var(--jev-secondary);
  font-size: 11.5px;
}

.jev-sources-count {
  margin-right: 2px;
  font-weight: 600;
}

.jev-sources-box[open] > .jev-sources-summary {
  margin-bottom: 4px;
}

.jev-sources {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.jev-source {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  padding: 5px 8px;
  border: 1px solid var(--jev-border-subtle);
  border-radius: 8px;
  background: var(--jev-elevated);
  color: var(--jev-text);
  font-size: 11.5px;
  text-decoration: none;
  transition: border-color 150ms ease;
}

.jev-source:hover {
  border-color: var(--jev-accent-dim);
}

.jev-source-kind {
  flex-shrink: 0;
  padding: 0 6px;
  border-radius: 4px;
  background: var(--jev-border);
  color: var(--jev-muted);
  font-family: var(--jev-font-display);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.jev-source-kind[data-kind="ufficiale"] {
  background: var(--jev-accent-dim);
  color: var(--jev-accent);
}

.jev-source-host {
  flex-shrink: 0;
  color: var(--jev-accent);
  font-weight: 600;
}

.jev-source-title {
  overflow: hidden;
  color: var(--jev-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.jev-meta {
  margin-top: 10px;
  color: var(--jev-muted);
  font-family: var(--jev-font-mono);
  font-size: 10.5px;
  text-align: right;
}

.jev-meta:empty {
  display: none;
}

/* ---------- Footer ---------- */

.jev-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 10px;
  padding: 8px 14px;
  border-top: 1px solid var(--jev-border);
  color: var(--jev-muted);
  font-family: var(--jev-font-mono);
  font-size: 10.5px;
}

.jev-quota {
  color: var(--jev-accent);
}

/* ---------- Standalone: the column fills its container (live page, web app) ---------- */

.jev-panel.jev-standalone {
  position: relative;
  top: auto;
  right: auto;
  z-index: auto;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border: 1px solid var(--jev-border);
  border-radius: 16px;
  box-shadow: -4px 0 40px rgba(0, 0, 0, 0.6);
  transition: none;
}

/* ---------- Collapsed handle ---------- */

.jev-handle {
  position: fixed;
  top: 50%;
  right: 0;
  z-index: 2147483646;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 7px;
  transform: translateY(-50%);
  border: 1px solid var(--jev-border);
  border-right: 0;
  border-radius: 8px 0 0 8px;
  background: var(--jev-bg);
  box-shadow: -2px 0 12px rgba(0, 0, 0, 0.4);
  color: var(--jev-accent);
  font-family: var(--jev-font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  writing-mode: vertical-rl;
  cursor: pointer;
}

.jev-handle[hidden] {
  display: none;
}

.jev-handle.jev-fullscreen {
  position: absolute;
}

.jev-handle-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--jev-true);
}

/* ---------- Motion ---------- */

@keyframes jev-card-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes jev-pulse {
  50% { opacity: 0.3; }
}

@keyframes jev-glow-pulse {
  0%, 100% { box-shadow: 0 0 15px var(--jev-accent), 0 0 30px var(--jev-accent-glow); }
  50% { box-shadow: 0 0 25px var(--jev-accent), 0 0 50px var(--jev-accent-glow); }
}

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

@keyframes jev-shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

@keyframes jev-reveal {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}

@keyframes jev-flash {
  0% { border-color: var(--jev-tone); }
  100% { border-color: var(--jev-border); }
}

@media (prefers-reduced-motion: reduce) {
  .jev-panel,
  .jev-card,
  .jev-card::before,
  .jev-dot,
  .jev-claim-details,
  .jev-spinner,
  .jev-skeleton span {
    animation: none !important;
    transition: none;
  }
}
