/* Match prediction poll — voting + results (all match pages) */

.match-prediction-block {
  --poll-bg: var(--mb-row-bg, #191d2d);
  --poll-line: var(--mb-row-line, rgba(255, 255, 255, 0.08));
  --poll-surface: rgba(255, 255, 255, 0.04);
  --poll-text: var(--mb-text-strong, #ffffff);
  --poll-muted: var(--mb-text-muted, #8b90a5);
  --poll-accent: var(--mb-accent, #39dbbf);
  --poll-accent-soft: rgba(57, 219, 191, 0.14);
  --poll-home: #5a83ff;
  --poll-draw: #8b90a5;
  --poll-away: #9b6bb8;
  margin-top: 16px;
}

html.light:not(.dark) .match-prediction-block {
  --poll-bg: #ffffff;
  --poll-line: #eef1f8;
  --poll-surface: #f5f7fc;
  --poll-text: #131521;
  --poll-muted: #6c6f83;
  --poll-accent: #12a58c;
  --poll-accent-soft: rgba(18, 165, 140, 0.12);
  --poll-home: #4766c4;
  --poll-draw: #9aa0b5;
  --poll-away: #7c569a;
}

.match-prediction-block .section-title {
  margin-bottom: 12px;
}

/* ——— Voting cards (override legacy style.css gradient pills) ——— */
.match-prediction-block .match-prediction {
  position: relative;
  display: grid !important;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: stretch !important;
  justify-content: stretch !important;
  padding: 12px !important;
  border-radius: 12px !important;
  background: var(--poll-bg) !important;
  border: 1px solid var(--poll-line) !important;
  background-image: none !important;
}

.match-prediction-block .match-prediction .predict-vote-card.predict-link {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  width: auto !important;
  max-width: none !important;
  height: auto !important;
  min-height: 88px;
  flex: unset !important;
  margin: 0 !important;
  padding: 12px 10px !important;
  border-radius: 10px !important;
  background: var(--poll-surface) !important;
  border: 2px solid transparent !important;
  color: var(--poll-text) !important;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
  cursor: pointer;
}

.match-prediction-block .match-prediction .predict-vote-card.predict-link.equal,
.match-prediction-block .match-prediction .predict-vote-card.vote-draw {
  min-width: 72px;
  max-width: 88px;
}

.match-prediction-block .match-prediction .predict-vote-card .img {
  display: none !important;
}

.match-prediction-block .match-prediction .predict-vote-card:hover {
  color: var(--poll-text) !important;
  background: var(--poll-accent-soft) !important;
  border-color: var(--poll-accent) !important;
  transform: translateY(-1px);
}

/* ——— Voting cards ——— */
.match-prediction {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  padding: 12px;
  border-radius: 12px;
  background: var(--poll-bg);
  border: 1px solid var(--poll-line);
}

.match-prediction .predict-vote-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 88px;
  padding: 12px 10px;
  border-radius: 10px;
  background: var(--poll-surface);
  border: 2px solid transparent;
  color: var(--poll-text);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
  cursor: pointer;
}

.match-prediction .predict-vote-card.vote-draw {
  min-width: 72px;
  max-width: 88px;
  margin-inline: 0;
}

.match-prediction .predict-vote-card .vote-logo {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.match-prediction .predict-vote-card .vote-logo img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.match-prediction .predict-vote-card .vote-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: var(--poll-muted);
}

html.light:not(.dark) .match-prediction .predict-vote-card .vote-icon {
  background: #eef1f8;
}

.match-prediction .predict-vote-card .vote-label {
  line-height: 1.25;
  text-align: center;
}

.match-prediction .predict-vote-card .vote-team-name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 100%;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
  word-break: break-word;
}

.match-prediction .predict-vote-card:hover {
  border-color: var(--poll-accent);
  background: var(--poll-accent-soft);
  transform: translateY(-1px);
}

.match-prediction .predict-vote-card.is-chosen {
  border-color: var(--poll-accent);
  background: var(--poll-accent-soft);
  box-shadow: 0 0 0 1px rgba(57, 219, 191, 0.2);
}

.match-prediction.is-voting .predict-vote-card {
  pointer-events: none;
  opacity: 0.55;
}

.match-prediction.is-voting .predict-vote-card.is-chosen {
  opacity: 1;
}

.match-prediction-loading {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 12px;
  background: rgba(21, 24, 37, 0.72);
  backdrop-filter: blur(2px);
}

html.light:not(.dark) .match-prediction-loading {
  background: rgba(255, 255, 255, 0.82);
}

.match-prediction.is-voting .match-prediction-loading {
  display: flex;
}

.match-prediction-loading__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--poll-accent);
  animation: poll-dot-pulse 0.9s ease-in-out infinite;
}

.match-prediction-loading__dot:nth-child(2) { animation-delay: 0.15s; }
.match-prediction-loading__dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes poll-dot-pulse {
  0%, 80%, 100% { transform: scale(0.75); opacity: 0.45; }
  40% { transform: scale(1); opacity: 1; }
}

/* ——— Results card ——— */
.prediction-poll-card {
  margin-top: 12px;
  padding: 14px 14px 12px;
  border-radius: 12px;
  background: var(--poll-bg);
  border: 1px solid var(--poll-line);
  color: var(--poll-muted);
  font-size: 12px;
}

.prediction-poll-card[hidden] {
  display: none !important;
}

.prediction-poll-bar-track {
  display: flex;
  align-items: stretch;
  height: 10px;
  margin-bottom: 14px;
  border-radius: 999px;
  background: var(--poll-surface);
  overflow: hidden;
  gap: 2px;
}

.prediction-poll-seg {
  display: block;
  flex: 0 0 auto;
  min-width: 0;
  height: 100%;
  border-radius: 999px;
  transition: width 0.75s cubic-bezier(0.33, 1, 0.68, 1);
}

.prediction-poll-bar-track .prediction-poll-seg.progress-bar {
  position: static !important;
  left: auto !important;
  top: auto !important;
  transform: none !important;
  animation: none !important;
  border: 0 !important;
  overflow: visible;
  background-clip: padding-box;
}

.prediction-poll-seg.seg-home,
.prediction-poll-seg.win { background: var(--poll-home); }

.prediction-poll-seg.seg-draw,
.prediction-poll-seg.equal { background: var(--poll-draw); }

.prediction-poll-seg.seg-away,
.prediction-poll-seg.lose { background: var(--poll-away); }

.prediction-poll-seg span,
.prediction-poll-bar-track .progress-bar span {
  display: none !important;
}

.prediction-poll-legend {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.prediction-poll-leg {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
  padding: 6px 4px;
  border-radius: 8px;
  transition: background 0.2s ease;
}

.prediction-poll-leg.is-user-vote {
  background: var(--poll-accent-soft);
}

.prediction-poll-leg__dot {
  flex: 0 0 8px;
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 50%;
}

.leg-home .prediction-poll-leg__dot { background: var(--poll-home); }
.leg-draw .prediction-poll-leg__dot { background: var(--poll-draw); }
.leg-away .prediction-poll-leg__dot { background: var(--poll-away); }

.prediction-poll-leg__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.prediction-poll-pct {
  font-size: 17px;
  font-weight: 900;
  line-height: 1.15;
  color: var(--poll-text);
}

.leg-home .prediction-poll-pct { color: var(--poll-home); }
.leg-draw .prediction-poll-pct { color: var(--poll-draw); }
.leg-away .prediction-poll-pct { color: var(--poll-away); }

.prediction-poll-team {
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--poll-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prediction-poll-thanks {
  margin: 10px 0 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--poll-accent-soft);
  color: var(--poll-accent);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  line-height: 1.4;
}

.prediction-poll-thanks[hidden] {
  display: none !important;
}

.prediction-poll-thanks.is-shown {
  animation: poll-thanks-in 0.35s ease;
}

@keyframes poll-thanks-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

[dir="ltr"] .prediction-poll-leg {
  flex-direction: row;
}

.visitors_area .match-prediction-block #pre_result {
  margin-top: 0;
}

.visitors_area > .news-page__comments {
  margin-top: 16px;
}

/* نفس المكان: التصويت والنتائج فوق بعض */
.match-prediction-stage {
  display: grid;
  grid-template: 1fr / 1fr;
  align-items: stretch;
}

.match-prediction-vote-panel,
.match-prediction-stage > .prediction-result-wrap {
  grid-area: 1 / 1;
  min-width: 0;
  transition: opacity 0.28s ease, transform 0.28s ease, visibility 0.28s ease;
}

.match-prediction-stage > .prediction-result-wrap {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(6px) scale(0.985);
  margin-top: 0 !important;
}

.match-prediction-stage.is-revealing > .prediction-result-wrap,
.match-prediction-stage.is-revealed > .prediction-result-wrap {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.match-prediction-stage.is-revealing .match-prediction-vote-panel,
.match-prediction-stage.is-revealed .match-prediction-vote-panel {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-4px) scale(0.985);
}

.match-prediction.is-locked .predict-vote-card {
  pointer-events: none !important;
  cursor: default;
  opacity: 0.45;
}

/* Legacy class hooks (old markup if cached) */
.prediction-poll-head { display: none; }
.prediction-poll-bar.bootstrap-progress { display: none; }

@media (max-width: 575px) {
  .match-prediction .predict-vote-card {
    min-height: 80px;
    padding: 10px 8px;
  }

  .match-prediction .predict-vote-card .vote-logo,
  .match-prediction .predict-vote-card .vote-icon {
    width: 34px;
    height: 34px;
  }

  .match-prediction .predict-vote-card.vote-draw {
    min-width: 64px;
  }

  .prediction-poll-pct {
    font-size: 15px;
  }

  .prediction-poll-team {
    font-size: 10px;
  }
}

html.light:not(.dark) .result-status-text.match-status-cancelled {
  color: #D93030;
}

html.dark .result-status-text.match-status-cancelled {
  color: #FC4D4D;
}
