/*
  REVALYTICS — WIDGETS
  Scoreboard (fixed bottom-right), Video Modal, and small
  shared UI pieces: .r-delta, .r-icon-tile.
*/

/* ─── Video Modal ────────────────────────────────────── */
.video-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.video-modal.is-open {
  display: flex;
}

.video-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
}

.video-modal-content {
  position: relative;
  width: min(960px, 92vw);
  background: #000;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.45);
  z-index: 1;
}

.video-modal-frame {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 */
}

.video-modal-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.video-modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  z-index: 2;
}

.video-modal-close:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Portrait mode for Instagram Reels (9:16) */
.video-modal-content.is-portrait {
  width: min(380px, 92vw);
  max-height: 90vh;
  overflow: hidden;
}

.video-modal-content.is-portrait .video-modal-frame {
  padding-top: 177.78%; /* 9:16 */
}

/* Instagram embed modal */
.video-modal-content.is-ig {
  background: #fff;
  overflow-y: auto;
  padding: 40px 0 0;
}

.ig-embed-wrap {
  width: 100%;
  overflow: hidden;
}

/* ─── Scoreboard Widget (fixed bottom-right) ─────────── */
#scoreboard {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 340px;
  background: var(--rev-blue);
  color: #fff;
  font-size: 14px;
  z-index: 9000;
  box-shadow: 0 8px 40px rgba(4, 18, 45, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 14px;
  overflow: hidden;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

#scoreboard.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px);
}

#scoreboard.min #sb-body {
  display: none;
}

#sb-body {
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  background: var(--rev-navy-900);
}

#sb-header {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  color: #fff;
  cursor: pointer;
  user-select: none;
}

#sb-toggle {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.4);
  transition: transform 0.25s;
}

#sb-toggle svg {
  transform: rotate(0deg);
  transition: transform 0.25s;
}

#sb-header[aria-expanded="true"] #sb-toggle svg {
  transform: rotate(180deg);
}

/* Scoreboard inner labels/rows */
.sb-section-label {
  font-family: var(--rev-font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.4);
  margin-bottom: 2px;
}

.sb-big {
  font-size: 26px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.sb-delta {
  font-size: 10px;
  margin-left: 6px;
}

.sb-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
}

.sb-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
}

.sb-row span:last-child {
  font-variant-numeric: tabular-nums;
  color: #fff;
}

.sb-row span:last-child.pos {
  color: var(--rev-pos);
}

.sb-demo-btn {
  display: block;
  text-align: center;
  background: var(--rev-blue);
  color: #fff;
  font-family: var(--rev-font-mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 10px 0;
  transition: opacity 0.2s;
  border-radius: 99px;
}

.sb-demo-btn:hover { opacity: 0.85; }

/* Live dot inside scoreboard header */
.sb-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--rev-pos);
  animation: live-glow 1.4s infinite;
  flex-shrink: 0;
}

/* ─── Scoreboard mobile (full-width bottom bar) ──────── */
@media (max-width: 600px) {
  #scoreboard {
    bottom: 0 !important;
    right: 0 !important;
    left: 0 !important;
    width: 100% !important;
    border-radius: 16px 16px 0 0 !important;
    box-shadow: 0 -4px 30px rgba(4, 18, 45, 0.5) !important;
  }

  #sb-body {
    max-width: 460px;
    margin: 0 auto;
    padding: 20px !important;
  }

  #sb-header {
    max-width: 460px;
    margin: 0 auto;
    width: 100% !important;
  }
}
