/* ==========================================================================
   Live poll widget v decku
   - Voting layout: QR vľavo, bar chart vpravo
   - Results layout: bar chart full-width, víťaz highlight
   ========================================================================== */

/* Override reveal center: true pre poll slide aby content nepresahoval */
.reveal .slides section.poll-section {
  top: 0 !important;
  transform: none !important;
  height: 100%;
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
}

.poll-slide {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  padding: 0 0.5rem;
}

.poll-slide .poll-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-secondary, #c5c5c5);
  font-weight: 600;
}
.poll-slide .poll-eyebrow .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--red, #ed1c24);
  box-shadow: 0 0 12px var(--red, #ed1c24);
  animation: poll-pulse 1.4s ease-in-out infinite;
}
.poll-slide.is-closed .poll-eyebrow .dot {
  background: var(--text-muted, #888);
  box-shadow: none;
  animation: none;
}

@keyframes poll-pulse {
  0%, 100% { opacity: 0.4; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1); }
}

.poll-slide .poll-question {
  font-family: 'Satoshi', sans-serif;
  font-size: 2.0rem;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
  max-width: 1100px;
}
.poll-slide .poll-question em {
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  color: var(--red-bright, #ff3a3a);
  font-weight: 400;
}

/* ============ Body layout ============ */
.poll-body {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 40px;
  align-items: center;
  transition: grid-template-columns 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.poll-slide.is-results .poll-body {
  grid-template-columns: 0 1fr;
  gap: 0;
}

/* ============ QR side ============ */
.poll-qr-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  overflow: hidden;
  transition: opacity 0.35s ease, transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.poll-slide.is-results .poll-qr-wrap {
  opacity: 0;
  transform: scale(0.8) translateX(-30px);
  pointer-events: none;
}
.poll-qr-box {
  width: 280px;
  height: 280px;
  box-sizing: border-box;
  background: #fff;
  border-radius: 18px;
  padding: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
}
.poll-qr-box img,
.poll-qr-box svg {
  width: 100%;
  height: 100%;
  display: block;
  aspect-ratio: 1 / 1;
}
.poll-qr-link {
  display: flex; align-items: center; gap: 10px;
  font-size: 0.95rem;
  color: var(--text-secondary, #c5c5c5);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border, rgba(255,255,255,0.1));
  border-radius: 999px;
  padding: 10px 18px;
  font-variant-numeric: tabular-nums;
}
.poll-qr-link strong {
  color: var(--text, #f5f5f5);
  font-weight: 600;
}

/* ============ Bars side ============ */
.poll-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.poll-bar {
  position: relative;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border, rgba(255,255,255,0.1));
  padding: 12px 18px;
  overflow: hidden;
  min-height: 52px;
  display: flex;
  align-items: center;
  transition: border-color 0.4s ease, transform 0.4s ease, padding 0.4s ease, min-height 0.4s ease;
}
.poll-slide.is-results .poll-bar {
  padding: 18px 22px;
  min-height: 64px;
}

.poll-bar.is-winner {
  border-color: var(--red, #ed1c24);
  box-shadow: 0 0 0 2px rgba(237, 28, 36, 0.25);
}
.poll-bar.is-winner::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 14px;
  border: 2px solid var(--red, #ed1c24);
  opacity: 0;
  animation: poll-winner-ring 2.2s cubic-bezier(0.16, 1, 0.3, 1) infinite;
  pointer-events: none;
}
@keyframes poll-winner-ring {
  0% { opacity: 0.6; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.04); }
}

.poll-bar-fill {
  position: absolute;
  inset: 0;
  width: 0%;
  background: linear-gradient(90deg, rgba(237, 28, 36, 0.22) 0%, rgba(237, 28, 36, 0.06) 100%);
  transition: width 0.7s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 0;
}
.poll-bar.is-winner .poll-bar-fill {
  background: linear-gradient(90deg, rgba(237, 28, 36, 0.5) 0%, rgba(237, 28, 36, 0.15) 100%);
}

.poll-bar-content {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  width: 100%;
}

.poll-bar-letter {
  flex-shrink: 0;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(237, 28, 36, 0.18);
  color: var(--red-bright, #ff3a3a);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  font-family: 'Satoshi', sans-serif;
  transition: width 0.4s ease, height 0.4s ease, font-size 0.4s ease;
}
.poll-slide.is-results .poll-bar-letter {
  width: 44px; height: 44px;
  font-size: 1.2rem;
}

.poll-bar-label {
  font-size: 1.05rem;
  font-weight: 500;
  font-family: 'Satoshi', sans-serif;
  color: var(--text, #f5f5f5);
  transition: font-size 0.4s ease;
}
.poll-slide.is-results .poll-bar-label {
  font-size: 1.3rem;
}

.poll-bar-stats {
  font-size: 1rem;
  color: var(--text-secondary, #c5c5c5);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  transition: font-size 0.4s ease;
}
.poll-bar-stats strong {
  color: var(--text, #f5f5f5);
  font-weight: 700;
  font-size: 1.15em;
}
.poll-slide.is-results .poll-bar-stats {
  font-size: 1.2rem;
}

/* ============ Rating mode (1-5) ============ */
.poll-bars.is-rating {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.poll-bars.is-rating .poll-bar-letter {
  background: rgba(237, 28, 36, 0.15);
  width: 40px;
  height: 40px;
}
/* ============ Rating summary (priemer + mini škála) ============ */
.poll-rating-summary {
  margin-top: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  width: 100%;
}
.prs-value {
  font-family: 'Satoshi', sans-serif;
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--text, #f5f5f5);
  display: inline-flex;
  align-items: baseline;
  gap: 14px;
  letter-spacing: 0.01em;
}
.prs-value strong {
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  font-weight: 400;
  font-size: 3.4rem;
  line-height: 1;
  color: var(--red-bright, #ff3a3a);
}
.prs-value .prs-of {
  color: var(--text-muted, #888);
  font-size: 1.4rem;
  font-weight: 500;
}

.prs-scale {
  position: relative;
  width: 100%;
  max-width: 720px;
  height: 56px;
  margin-top: 6px;
}
.prs-track {
  position: absolute;
  top: 24px;
  left: 28px;
  right: 28px;
  height: 6px;
  background: linear-gradient(90deg,
    rgba(255, 255, 255, 0.15) 0%,
    rgba(237, 28, 36, 0.4) 50%,
    rgba(237, 28, 36, 0.85) 100%);
  border-radius: 3px;
}
.prs-num {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  font-size: 1.7rem;
  color: var(--text-secondary, #c5c5c5);
  width: 28px;
  text-align: center;
}
.prs-num-lo { left: 0; }
.prs-num-hi { right: 0; }

.prs-marker {
  position: absolute;
  top: 24px;
  transform: translate(-50%, -50%);
  transition: left 1s cubic-bezier(0.16, 1, 0.3, 1);
}
.prs-marker-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--red, #ed1c24);
  border: 4px solid var(--bg, #050505);
  box-shadow: 0 0 24px rgba(237, 28, 36, 0.7);
  position: relative;
  top: 3px;
}
.prs-marker-dot::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--red, #ed1c24);
  opacity: 0.6;
  animation: poll-winner-ring 2.2s cubic-bezier(0.16, 1, 0.3, 1) infinite;
}
.prs-marker-bubble {
  position: absolute;
  top: -34px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--red, #ed1c24);
  color: #fff;
  font-family: 'Satoshi', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 4px 10px;
  border-radius: 8px;
  white-space: nowrap;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}
.prs-marker-bubble::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 8px;
  height: 8px;
  background: var(--red, #ed1c24);
}

html[data-theme="light"] .prs-marker-dot {
  border-color: var(--bg, #fafafa);
}
html[data-theme="light"] .prs-track {
  background: linear-gradient(90deg,
    rgba(0, 0, 0, 0.1) 0%,
    rgba(237, 28, 36, 0.4) 50%,
    rgba(237, 28, 36, 0.85) 100%);
}

/* Inline rating label v baroch (1 — text / 5 — text) */
.poll-bar-label .rl-num-inline {
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  font-weight: 400;
  color: var(--red-bright, #ff3a3a);
  margin-right: 4px;
  font-size: 1.2em;
}
.poll-bar-label .rl-text-inline {
  color: var(--text, #f5f5f5);
  font-weight: 500;
}
html[data-theme="light"] .poll-bar-label .rl-text-inline {
  color: var(--text, #1a1a1a);
}

/* ============ Total / live indicator ============ */
.poll-meta {
  display: flex; align-items: center; gap: 14px;
  font-size: 0.95rem;
  color: var(--text-muted, #888);
  margin-top: 8px;
}
.poll-meta-live {
  display: inline-flex; align-items: center; gap: 8px;
  letter-spacing: 0.05em;
}
.poll-meta-live .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--red, #ed1c24);
  animation: poll-pulse 1.4s ease-in-out infinite;
}
.poll-slide.is-closed .poll-meta-live .dot {
  background: var(--text-muted, #888);
  animation: none;
}
.poll-meta-total {
  font-variant-numeric: tabular-nums;
}
.poll-meta-total strong {
  color: var(--text, #f5f5f5);
}

/* Loading placeholder */
.poll-loading {
  padding: 40px 0;
  text-align: center;
  color: var(--text-muted, #888);
}

/* ============ Presenter toast (po Shift+R reset) ============ */
.presenter-toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translate(-50%, -20px);
  z-index: 10000;
  padding: 14px 22px;
  border-radius: 12px;
  background: rgba(45, 212, 191, 0.95);
  color: #062b27;
  font-family: 'Satoshi', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.presenter-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}
.presenter-toast.is-err {
  background: rgba(237, 28, 36, 0.95);
  color: #fff;
}

/* ============ Light theme overrides ============ */
html[data-theme="light"] .poll-bar {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.1);
}
html[data-theme="light"] .poll-bar.is-winner {
  box-shadow: 0 0 0 2px rgba(237, 28, 36, 0.18);
}
html[data-theme="light"] .poll-qr-link {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.1);
}
