/* ============================================================================
   Guided Tour — Reusable Tour Engine Styles
   ============================================================================ */

:root {
  --ob-spotlight-color: #ffffff;
  --ob-spotlight-color-ring: rgba(255, 255, 255, 0.25);
  --ob-spotlight-color-ring-faint: rgba(255, 255, 255, 0.08);
}

/* Welcome Overlay */
.onboarding-welcome-overlay {
  position: fixed;
  inset: 0;
  z-index: 9200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 6, 12, 0.82);
  backdrop-filter: blur(14px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}
.onboarding-welcome-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.onboarding-welcome-dialog {
  max-width: 340px;
  width: 90%;
  padding: 36px 28px 28px;
  border-radius: var(--cw-radius-lg, 20px);
  background: var(--cw-gradient-card, linear-gradient(160deg, #1a1a24, #242430));
  border: 1px solid var(--cw-gold-border-strong, rgba(228, 184, 91, 0.45));
  box-shadow:
    0 0 60px rgba(228, 184, 91, 0.08),
    0 24px 48px var(--cw-shadow, rgba(4, 4, 20, 0.50));
  text-align: center;
  transform: scale(0.92) translateY(24px);
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.onboarding-welcome-overlay.visible .onboarding-welcome-dialog {
  transform: scale(1) translateY(0);
}

.onboarding-welcome-symbol {
  font-size: 44px;
  line-height: 1;
  margin-bottom: 8px;
  filter: drop-shadow(0 0 12px rgba(228, 184, 91, 0.3));
}

.onboarding-welcome-dialog h2 {
  font-family: var(--cw-font-display, Georgia, serif);
  font-size: 24px;
  font-weight: 500;
  color: var(--cw-text, #f8f3eb);
  margin-bottom: 8px;
  letter-spacing: 0.01em;
}

.onboarding-welcome-dialog p {
  font-family: var(--cw-font-body, sans-serif);
  font-size: 14px;
  color: var(--cw-text-secondary, #b8b0a5);
  line-height: 1.5;
  margin-bottom: 24px;
}

.onboarding-welcome-dialog .ob-btn-primary {
  display: block;
  width: 100%;
  padding: 14px 20px;
  border: none;
  border-radius: 10px;
  background: var(--cw-gradient-sacred, linear-gradient(135deg, #e4b85b, #e67e22));
  color: #fff;
  font-family: var(--cw-font-body, sans-serif);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 10px;
  transition: filter 0.2s, transform 0.15s;
}
.onboarding-welcome-dialog .ob-btn-primary:active {
  transform: scale(0.97);
}

.onboarding-welcome-dialog .ob-btn-secondary {
  display: block;
  width: 100%;
  padding: 11px 20px;
  border: 1px solid var(--cw-border, rgba(228, 184, 91, 0.14));
  border-radius: 10px;
  background: transparent;
  color: var(--cw-text-muted, #a89a88);
  font-family: var(--cw-font-body, sans-serif);
  font-size: 14px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.onboarding-welcome-dialog .ob-btn-secondary:hover {
  color: var(--cw-text-secondary, #b8b0a5);
  border-color: var(--cw-border-strong, rgba(228, 184, 91, 0.28));
}

/* Floating Checklist Card */
.ob-checklist {
  position: fixed;
  bottom: 80px;
  right: 16px;
  z-index: 8000;
  width: 272px;
  border-radius: var(--cw-radius, 12px);
  background: rgba(20, 20, 30, 0.94);
  backdrop-filter: blur(18px);
  border: 1px solid var(--cw-gold-border, rgba(228, 184, 91, 0.22));
  box-shadow:
    0 0 40px rgba(228, 184, 91, 0.06),
    0 12px 36px var(--cw-shadow, rgba(4, 4, 20, 0.50));
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px);
  transition: opacity 0.35s ease, transform 0.4s cubic-bezier(0.34, 1.2, 0.64, 1);
}
.ob-checklist.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.ob-checklist-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--cw-border, rgba(228, 184, 91, 0.14));
}

.ob-checklist-ring { flex-shrink: 0; }
.ob-checklist-ring circle.ob-ring-track {
  fill: none;
  stroke: rgba(255,255,255,0.06);
  stroke-width: 3;
}
.ob-checklist-ring circle.ob-ring-fill {
  fill: none;
  stroke: var(--cw-gold, #e4b85b);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 88;
  stroke-dashoffset: 88;
  transform: rotate(-90deg);
  transform-origin: center;
  transition: stroke-dashoffset 0.8s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.ob-checklist-title {
  font-family: var(--cw-font-body, sans-serif);
  font-size: 13px;
  font-weight: 600;
  color: var(--cw-text, #f8f3eb);
  flex: 1;
}
.ob-checklist-progress {
  font-family: var(--cw-font-body, sans-serif);
  font-size: 12px;
  color: var(--cw-text-muted, #a89a88);
}
.ob-checklist-toggle {
  background: none;
  border: none;
  color: var(--cw-text-muted, #a89a88);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 2px;
}

.ob-checklist-body {
  padding: 6px 0;
  max-height: 360px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.ob-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.2s;
}
.ob-step:hover { background: rgba(228, 184, 91, 0.04); }
.ob-step.done { cursor: default; }
.ob-step.done:hover { background: transparent; }

.ob-step-check {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--cw-border-strong, rgba(228, 184, 91, 0.28));
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
  transition: border-color 0.3s, background 0.3s, transform 0.4s cubic-bezier(0.34, 1.6, 0.64, 1);
}
.ob-step.done .ob-step-check {
  border-color: var(--cw-green, #5cc98a);
  background: var(--cw-green, #5cc98a);
  transform: scale(1);
}
.ob-step-check svg {
  width: 12px;
  height: 12px;
  opacity: 0;
  transform: scale(0) rotate(-45deg);
  transition: opacity 0.3s, transform 0.4s cubic-bezier(0.34, 1.6, 0.64, 1);
}
.ob-step.done .ob-step-check svg {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

.ob-step-content { flex: 1; min-width: 0; }
.ob-step-label {
  font-family: var(--cw-font-body, sans-serif);
  font-size: 13px;
  font-weight: 500;
  color: var(--cw-text, #f8f3eb);
  line-height: 1.3;
  transition: color 0.3s;
}
.ob-step.done .ob-step-label {
  color: var(--cw-text-muted, #a89a88);
  text-decoration: line-through;
  text-decoration-color: var(--cw-text-dim, #6a5e50);
}
.ob-step-hint {
  font-family: var(--cw-font-body, sans-serif);
  font-size: 11px;
  color: var(--cw-text-dim, #6a5e50);
  margin-top: 2px;
  line-height: 1.35;
}

.ob-checklist-footer {
  padding: 8px 16px 12px;
  border-top: 1px solid var(--cw-border, rgba(228, 184, 91, 0.14));
  text-align: center;
}
.ob-checklist-dismiss {
  background: none;
  border: none;
  color: var(--cw-text-dim, #6a5e50);
  font-family: var(--cw-font-body, sans-serif);
  font-size: 11px;
  cursor: pointer;
  transition: color 0.2s;
}
.ob-checklist-dismiss:hover { color: var(--cw-text-muted, #a89a88); }

/* Minimized FAB */
.ob-fab {
  position: fixed;
  bottom: 80px;
  right: 16px;
  z-index: 8000;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: var(--cw-gradient-sacred, linear-gradient(135deg, #e4b85b, #e67e22));
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 0 24px rgba(228, 184, 91, 0.2),
    0 4px 16px var(--cw-shadow, rgba(4, 4, 20, 0.50));
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.3s, transform 0.35s cubic-bezier(0.34, 1.4, 0.64, 1);
}
.ob-fab.visible { opacity: 1; transform: scale(1); }
.ob-fab-icon {
  font-family: var(--cw-font-body, sans-serif);
  font-size: 18px;
  font-weight: 700;
  position: relative;
  z-index: 1;
}
.ob-fab svg { position: absolute; inset: -3px; }
.ob-fab svg circle.ob-fab-track {
  fill: none;
  stroke: rgba(255,255,255,0.15);
  stroke-width: 2.5;
}
.ob-fab svg circle.ob-fab-fill {
  fill: none;
  stroke: #fff;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 138;
  stroke-dashoffset: 138;
  transform: rotate(-90deg);
  transform-origin: center;
  transition: stroke-dashoffset 0.8s cubic-bezier(0.34, 1.4, 0.64, 1);
}

/* FAB entrance animation */
.ob-fab.ob-fab-entering {
  animation: ob-fab-enter 300ms cubic-bezier(0.34, 1.2, 0.64, 1) forwards;
}
@keyframes ob-fab-enter {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

/* FAB tooltip pill */
.ob-fab-tooltip {
  position: absolute;
  right: 56px;
  top: 50%;
  transform: translateY(-50%);
  white-space: nowrap;
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 500;
  background: rgba(30, 30, 40, 0.88);
  color: #f5f0e8;
  pointer-events: none;
  animation: ob-tooltip-fade 4000ms ease-out forwards;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
@keyframes ob-tooltip-fade {
  0%, 70% { opacity: 1; }
  100%    { opacity: 0; }
}
body.light-theme .ob-fab-tooltip {
  background: rgba(250, 249, 247, 0.95);
  color: #2a2520;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

@keyframes ob-fab-pulse {
  0%, 100% { box-shadow: 0 0 24px rgba(228, 184, 91, 0.2), 0 4px 16px var(--cw-shadow, rgba(4,4,20,0.5)); }
  50% { box-shadow: 0 0 32px rgba(228, 184, 91, 0.35), 0 4px 20px var(--cw-shadow, rgba(4,4,20,0.5)); }
}
.ob-fab.incomplete { animation: ob-fab-pulse 2.5s ease-in-out infinite; }

/* Spotlight Overlay */
.ob-spotlight {
  position: fixed;
  inset: 0;
  z-index: 8500;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.ob-spotlight.visible { opacity: 1; visibility: visible; }
.ob-spotlight[data-sheet-elevated="true"] { z-index: 9000; }
.ob-spotlight[data-sheet-elevated="true"] .ob-spotlight-cutout {
  box-shadow: none;
  border: 2px solid var(--ob-spotlight-color, #fff);
  animation: ob-cutout-glow-noblur 1.8s ease-in-out infinite;
}
@keyframes ob-cutout-glow-noblur {
  0%, 100% { border-color: var(--ob-spotlight-color, #fff); box-shadow: 0 0 12px var(--ob-spotlight-color-ring, rgba(255, 255, 255, 0.25)); }
  50% { border-color: var(--ob-spotlight-color, #fff); box-shadow: 0 0 20px var(--ob-spotlight-color-ring, rgba(255, 255, 255, 0.25)); }
}

.ob-spotlight-cutout {
  position: fixed;
  border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(6, 6, 12, 0.75);
  border: 2px solid var(--ob-spotlight-color, #fff);
  pointer-events: none;
  z-index: 9050;
  transition: top 0.35s ease, left 0.35s ease, width 0.35s ease, height 0.35s ease;
  animation: ob-cutout-glow 1.8s ease-in-out infinite;
}
@keyframes ob-cutout-glow {
  0%, 100% { border-color: var(--ob-spotlight-color, #fff); box-shadow: 0 0 0 9999px rgba(6, 6, 12, 0.75), 0 0 12px var(--ob-spotlight-color-ring, rgba(255, 255, 255, 0.25)); }
  50% { border-color: var(--ob-spotlight-color, #fff); box-shadow: 0 0 0 9999px rgba(6, 6, 12, 0.75), 0 0 20px var(--ob-spotlight-color-ring, rgba(255, 255, 255, 0.25)); }
}

.ob-pointer {
  position: fixed;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--ob-spotlight-color, #fff);
  box-shadow: 0 0 0 4px var(--ob-spotlight-color-ring, rgba(255, 255, 255, 0.25));
  pointer-events: none;
  z-index: 9100;
  animation: ob-pointer-pulse 1.6s ease-in-out infinite;
}
@keyframes ob-pointer-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 4px var(--ob-spotlight-color-ring, rgba(255, 255, 255, 0.25)); }
  50% { transform: scale(1.15); box-shadow: 0 0 0 10px var(--ob-spotlight-color-ring-faint, rgba(255, 255, 255, 0.08)); }
}

/* Spotlight Tooltip */
.ob-tooltip {
  position: absolute;
  z-index: 9100;
  max-width: 260px;
  padding: 16px;
  border-radius: var(--cw-radius, 12px);
  background: rgba(20, 20, 30, 0.96);
  backdrop-filter: blur(16px);
  border: 1px solid var(--cw-gold-border, rgba(228, 184, 91, 0.22));
  box-shadow: 0 8px 32px var(--cw-shadow, rgba(4, 4, 20, 0.50));
  pointer-events: auto;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s 0.15s, transform 0.35s 0.15s cubic-bezier(0.34, 1.2, 0.64, 1);
}
.ob-spotlight.visible .ob-tooltip { opacity: 1; transform: translateY(0); }

.ob-tooltip-step {
  font-family: var(--cw-font-body, sans-serif);
  font-size: 11px;
  font-weight: 600;
  color: var(--cw-gold, #e4b85b);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}
.ob-tooltip-text {
  font-family: var(--cw-font-body, sans-serif);
  font-size: 14px;
  color: var(--cw-text, #f8f3eb);
  line-height: 1.45;
  margin-bottom: 14px;
}
.ob-tooltip-actions { display: flex; gap: 8px; }
.ob-tooltip-btn {
  flex: 1;
  padding: 9px 14px;
  border-radius: 8px;
  border: none;
  font-family: var(--cw-font-body, sans-serif);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: filter 0.2s, transform 0.15s;
}
.ob-tooltip-btn:active { transform: scale(0.96); }
.ob-tooltip-btn.primary {
  background: var(--cw-gradient-sacred, linear-gradient(135deg, #e4b85b, #e67e22));
  color: #fff;
}

/* Tooltip arrow */
.ob-tooltip::before {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  background: rgba(20, 20, 30, 0.96);
  border: 1px solid var(--cw-gold-border, rgba(228, 184, 91, 0.22));
  transform: rotate(45deg);
}
.ob-tooltip.arrow-top::before { top: -7px; left: 24px; border-right: none; border-bottom: none; }
.ob-tooltip.arrow-bottom::before { bottom: -7px; left: 24px; border-left: none; border-top: none; }
.ob-tooltip.arrow-left::before { left: -7px; top: 16px; border-right: none; border-top: none; }
.ob-tooltip.arrow-none::before { display: none; }

/* Particles */
@keyframes ob-particle {
  0% { opacity: 1; transform: translate(0,0) scale(1); }
  100% { opacity: 0; transform: translate(var(--px), var(--py)) scale(0); }
}
.ob-particle {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cw-gold, #e4b85b);
  pointer-events: none;
  animation: ob-particle 0.6s ease-out forwards;
}

/* Milestone */
.ob-milestone {
  position: fixed;
  inset: 0;
  z-index: 9100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(6, 6, 12, 0.7);
  backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}
.ob-milestone.visible { opacity: 1; visibility: visible; }
.ob-milestone-icon {
  font-size: 48px;
  margin-bottom: 12px;
  filter: drop-shadow(0 0 20px rgba(228, 184, 91, 0.4));
  animation: ob-milestone-bounce 0.6s cubic-bezier(0.34, 1.6, 0.64, 1);
}
@keyframes ob-milestone-bounce {
  0% { transform: scale(0) rotate(-20deg); }
  60% { transform: scale(1.15) rotate(5deg); }
  100% { transform: scale(1) rotate(0deg); }
}
.ob-milestone-text {
  font-family: var(--cw-font-display, Georgia, serif);
  font-size: 22px;
  font-weight: 500;
  color: var(--cw-text, #f8f3eb);
  text-align: center;
  max-width: 280px;
}
.ob-milestone-sub {
  font-family: var(--cw-font-body, sans-serif);
  font-size: 14px;
  color: var(--cw-text-muted, #a89a88);
  margin-top: 6px;
}

/* Light theme */
body.light-theme .ob-checklist { background: rgba(250, 249, 247, 0.96); }
body.light-theme .ob-spotlight-cutout { box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55); }
body.light-theme .ob-tooltip { background: rgba(250, 249, 247, 0.98); }
body.light-theme .onboarding-welcome-overlay { background: rgba(0, 0, 0, 0.55); }
body.light-theme .onboarding-welcome-dialog { background: linear-gradient(160deg, var(--cw-bg-card) 0%, #fff 100%); }
body.light-theme .ob-milestone { background: rgba(255, 255, 255, 0.7); }

/* Mobile */
@media (max-width: 440px) {
  .ob-checklist { right: 8px; left: 8px; width: auto; bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
  .ob-checklist-body { max-height: 40vh; }
  .ob-fab { right: 12px; bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
  .ob-tooltip { max-width: 240px; }
}

/* Touch-friendly targets */
@media (pointer: coarse) {
  .ob-checklist-toggle { min-height: 44px; min-width: 44px; display: flex; align-items: center; justify-content: center; }
  .ob-checklist-dismiss { min-height: 44px; padding: 8px 16px; font-size: 13px; }
  .ob-tooltip-btn { min-height: 44px; padding: 12px 16px; }
}

/* Landscape on small screens */
@media (max-height: 500px) and (orientation: landscape) {
  .ob-checklist-body { max-height: 120px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .onboarding-welcome-dialog { transition: none; }
  .ob-checklist { transition: opacity 0.2s; transform: none; }
  .ob-spotlight-cutout { animation: none; transition: none; }
  .ob-tooltip { transition: opacity 0.2s; transform: none; }
  .ob-fab { transition: opacity 0.2s; transform: none; animation: none !important; }
  .ob-fab-tooltip { animation: none; }
  .ob-milestone-icon { animation: none; }
  .ob-step-check, .ob-step-check svg { transition: none; }
  .ob-particle { display: none; }
  .ob-pointer { animation: none; }
}
