/**
 * Social R - Interactive Onboarding Tour Styles v1.0
 * Spotlight overlay, popover card, SVG mask, mobile bottom sheet, and reduced motion.
 */

/* ==========================================================================
   1. OVERLAY & SPOTLIGHT
   ========================================================================== */
.sr-tour-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 600;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.sr-tour-overlay.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.sr-tour-svg-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Shield to prevent unintended clicks on interface underneath during tour */
.sr-tour-click-shield {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  pointer-events: auto;
  cursor: default;
}

/* Spotlight outline & subtle indigo aura around the active element */
.sr-tour-spotlight-border {
  position: fixed;
  pointer-events: none;
  z-index: 601;
  border: 2px solid #818cf8;
  border-radius: 8px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15), 0 0 28px rgba(99, 102, 241, 0.4);
  opacity: 0;
  visibility: hidden;
  transition: top 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              left 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              width 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              height 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.2s ease,
              visibility 0.2s ease;
}

.sr-tour-spotlight-border.is-visible {
  opacity: 1;
  visibility: visible;
}

/* While tour is active, suppress drawer's native darkened backdrop to prevent double opacity */
body.is-tour-active .sr-drawer-backdrop::before {
  opacity: 0 !important;
  pointer-events: none !important;
}

body.is-tour-active .sr-drawer-backdrop {
  pointer-events: none !important;
}

/* ==========================================================================
   2. TOUR POPOVER CARD
   ========================================================================== */
.sr-tour-card {
  position: fixed;
  z-index: 602;
  width: min(390px, calc(100vw - 2rem));
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  box-shadow: 0 20px 48px -8px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(99, 102, 241, 0.25);
  padding: 1.25rem 1.4rem 1.2rem;
  font-family: var(--sr-font-sans, 'Inter', system-ui, -apple-system, sans-serif);
  color: #f8fafc;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.96);
  transition: opacity 0.24s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.24s cubic-bezier(0.16, 1, 0.3, 1),
              top 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              left 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.24s ease;
  pointer-events: auto;
  box-sizing: border-box;
}

.sr-tour-card.is-visible {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
}

.sr-tour-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.65rem;
}

.sr-tour-step-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.74rem;
  font-weight: 600;
  color: #a5b4fc;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(129, 140, 248, 0.25);
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  letter-spacing: 0.01em;
}

.sr-tour-close-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 1.25rem;
  line-height: 1;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 6px;
  transition: color 0.15s ease, background-color 0.15s ease;
  margin: -0.25rem -0.25rem 0 0;
}

.sr-tour-close-btn:hover {
  color: #ffffff;
  background-color: rgba(255, 255, 255, 0.08);
}

.sr-tour-close-btn:focus-visible {
  outline: 2px solid #818cf8;
  outline-offset: 2px;
}

.sr-tour-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 0.45rem;
  line-height: 1.3;
  letter-spacing: -0.015em;
}

.sr-tour-card-text {
  font-size: 0.88rem;
  line-height: 1.55;
  color: #cbd5e1;
  margin-bottom: 1.15rem;
}

.sr-tour-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.sr-tour-actions-left {
  display: flex;
  align-items: center;
}

.sr-tour-actions-right {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.sr-tour-btn-skip {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0.4rem 0.2rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.15s ease;
}

.sr-tour-btn-skip:hover {
  color: #f1f5f9;
}

.sr-tour-btn-skip:focus-visible {
  outline: 2px solid #818cf8;
  outline-offset: 2px;
  border-radius: 3px;
}

.sr-tour-btn-prev {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #e2e8f0;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.45rem 0.85rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.sr-tour-btn-prev:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.sr-tour-btn-prev:focus-visible {
  outline: 2px solid #818cf8;
  outline-offset: 2px;
}

.sr-tour-btn-next {
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
  border: 1px solid rgba(165, 180, 252, 0.3);
  color: #ffffff;
  font-size: 0.84rem;
  font-weight: 650;
  padding: 0.48rem 1.05rem;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.sr-tour-btn-next:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.45);
}

.sr-tour-btn-next:active {
  transform: translateY(0);
}

.sr-tour-btn-next:focus-visible {
  outline: 2px solid #a5b4fc;
  outline-offset: 2px;
}

/* ==========================================================================
   3. TOPBAR REPLAY BUTTON (ⓘ)
   ========================================================================== */
.sr-tour-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: transparent;
  border: 1px solid transparent;
  color: #64748b;
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  margin-left: 0.4rem;
  padding: 0;
}

.sr-tour-btn:hover {
  color: #4f46e5;
  background: rgba(79, 70, 229, 0.08);
  border-color: rgba(79, 70, 229, 0.25);
}

.sr-tour-btn:active {
  color: #4338ca;
  background: rgba(79, 70, 229, 0.15);
  border-color: rgba(79, 70, 229, 0.35);
}

.sr-tour-btn:focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
  color: #4f46e5;
  background: rgba(79, 70, 229, 0.08);
  border-color: rgba(79, 70, 229, 0.3);
}

.sr-tour-btn svg {
  display: block;
  pointer-events: none;
}

/* ==========================================================================
   4. MOBILE BOTTOM SHEET & RESPONSIVE
   ========================================================================== */
@media (max-width: 640px) {
  .sr-tour-card {
    width: calc(100vw - 1.5rem) !important;
    left: 0.75rem !important;
    right: 0.75rem !important;
    bottom: max(0.85rem, env(safe-area-inset-bottom)) !important;
    top: auto !important;
    transform: none !important;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(99, 102, 241, 0.35);
  }

  .sr-tour-card.is-visible {
    transform: none !important;
  }
}

/* ==========================================================================
   5. REDUCED MOTION
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .sr-tour-overlay,
  .sr-tour-spotlight-border,
  .sr-tour-card,
  .sr-tour-btn-next,
  .sr-tour-btn-prev {
    transition: none !important;
    animation: none !important;
  }
}
