/**
 * device-wizard.css — Shared device selection wizard
 * Reusable across landing pages. Adapts to page theme via CSS custom properties.
 *
 * Required CSS vars from host page:
 *   --dw-accent        Primary accent color (e.g. #6B00FF or #8B5CF6)
 *   --dw-accent-rgb    RGB triplet for alpha blending (e.g. 107,0,255)
 *   --dw-accent-glow   Secondary glow color (e.g. #9b40ff)
 *   --dw-teal          Teal/green for "available" badges (defaults to #14b8a6)
 *   --dw-teal-rgb      RGB triplet (defaults to 20,184,166)
 */

/* ============================================================
   WIZARD CONTAINER
   ============================================================ */
.dw-wizard {
  --_accent: var(--dw-accent, #6B00FF);
  --_accent-rgb: var(--dw-accent-rgb, 107, 0, 255);
  --_glow: var(--dw-accent-glow, #9b40ff);
  --_teal: var(--dw-teal, #14b8a6);
  --_teal-rgb: var(--dw-teal-rgb, 20, 184, 166);

  position: relative;
  max-width: 600px;
  margin: 2.5rem auto 0;
  padding: 2.5rem 2rem 2rem;
  text-align: center;
  border-radius: 24px;
  overflow: hidden;

  /* Glassmorphism */
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  box-shadow:
    0 8px 40px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* Top accent line — subtle gradient border */
.dw-wizard::before {
  content: '';
  position: absolute;
  top: 0;
  left: 10%;
  right: 10%;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(var(--_accent-rgb), 0.6),
    rgba(var(--_accent-rgb), 0.8),
    rgba(var(--_accent-rgb), 0.6),
    transparent
  );
  border-radius: 0 0 2px 2px;
}

/* Ambient glow behind wizard */
.dw-wizard::after {
  content: '';
  position: absolute;
  top: -40%;
  left: 50%;
  transform: translateX(-50%);
  width: 120%;
  height: 60%;
  background: radial-gradient(
    ellipse 50% 70% at 50% 100%,
    rgba(var(--_accent-rgb), 0.08) 0%,
    transparent 70%
  );
  pointer-events: none;
  z-index: 0;
}

/* ============================================================
   STEP TRANSITIONS
   ============================================================ */
.dw-wizard__step {
  position: relative;
  z-index: 1;
}

.dw-wizard__step[data-animate="enter"] {
  animation: dw-step-enter 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.dw-wizard__step[data-animate="exit"] {
  animation: dw-step-exit 0.2s ease-in forwards;
}

@keyframes dw-step-enter {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes dw-step-exit {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }
}

/* ============================================================
   STEP 1: QUESTION + DEVICE GRID
   ============================================================ */
.dw-wizard__question {
  font-size: 1.15rem;
  font-weight: 600;
  color: #fff;
  margin: 0 0 1.75rem;
  letter-spacing: -0.01em;
}

.dw-wizard__devices {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 1.75rem;
}

.dw-wizard__device {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.dw-wizard__device input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

/* Device card */
.dw-wizard__device-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  padding: 1.35rem 0.5rem 1.1rem;
  border-radius: 16px;
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.025);
  position: relative;
  overflow: hidden;
  transition:
    border-color 0.25s ease,
    background 0.25s ease,
    box-shadow 0.25s ease,
    transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Inner glow on hover */
.dw-wizard__device-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0;
  background: radial-gradient(
    circle at 50% 30%,
    rgba(var(--_accent-rgb), 0.12) 0%,
    transparent 70%
  );
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.dw-wizard__device-card:hover {
  border-color: rgba(var(--_accent-rgb), 0.3);
  background: rgba(var(--_accent-rgb), 0.04);
  transform: translateY(-2px);
}

.dw-wizard__device-card:hover::after {
  opacity: 1;
}

/* Checked state */
.dw-wizard__device input:checked + .dw-wizard__device-card {
  border-color: rgba(var(--_accent-rgb), 0.65);
  background: rgba(var(--_accent-rgb), 0.1);
  box-shadow:
    0 0 24px rgba(var(--_accent-rgb), 0.2),
    inset 0 0 0 1px rgba(var(--_accent-rgb), 0.15);
  transform: translateY(-3px);
}

.dw-wizard__device input:checked + .dw-wizard__device-card::after {
  opacity: 1;
  background: radial-gradient(
    circle at 50% 30%,
    rgba(var(--_accent-rgb), 0.18) 0%,
    transparent 60%
  );
}

/* Check indicator */
.dw-wizard__device input:checked + .dw-wizard__device-card::before {
  content: '';
  position: absolute;
  top: 8px;
  right: 8px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--_accent);
  box-shadow: 0 0 8px rgba(var(--_accent-rgb), 0.5);
  z-index: 2;
  /* CSS checkmark */
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 8.5L6.5 11L12 5.5' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-size: 14px;
  background-position: center;
  background-repeat: no-repeat;
  animation: dw-check-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes dw-check-pop {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}

.dw-wizard__device-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  color: rgba(255, 255, 255, 0.6);
  transition: transform 0.2s ease, color 0.25s ease;
  position: relative;
  z-index: 1;
}

.dw-wizard__device-icon svg {
  display: block;
}

.dw-wizard__device-card:hover .dw-wizard__device-icon {
  color: rgba(255, 255, 255, 0.85);
}

.dw-wizard__device input:checked + .dw-wizard__device-card .dw-wizard__device-icon {
  transform: scale(1.08);
  color: #fff;
}

.dw-wizard__device-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  transition: color 0.25s ease;
  position: relative;
  z-index: 1;
}

.dw-wizard__device-card:hover .dw-wizard__device-name {
  color: rgba(255, 255, 255, 0.75);
}

.dw-wizard__device input:checked + .dw-wizard__device-card .dw-wizard__device-name {
  color: #fff;
}

/* ============================================================
   NEXT BUTTON
   ============================================================ */
.dw-wizard__next {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 0 auto;
  padding: 13px 44px;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--_accent), var(--_glow));
  box-shadow: 0 4px 20px rgba(var(--_accent-rgb), 0.35);
  transition:
    opacity 0.25s ease,
    transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.25s ease;
}

/* Shimmer on enabled button */
.dw-wizard__next::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.12),
    transparent
  );
  transition: left 0.6s ease;
  pointer-events: none;
}

.dw-wizard__next:not(:disabled):hover::after {
  left: 100%;
}

.dw-wizard__next:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.dw-wizard__next:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 28px rgba(var(--_accent-rgb), 0.5);
}

.dw-wizard__next:not(:disabled):active {
  transform: translateY(0);
}

/* ============================================================
   STEP 2: RESULTS
   ============================================================ */
.dw-wizard__results {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 1.5rem;
}

.dw-wizard__result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.1rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.03);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.dw-wizard__result-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.12);
}

.dw-wizard__result-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.dw-wizard__result-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  color: rgba(255, 255, 255, 0.7);
}

.dw-wizard__result-icon svg {
  width: 22px;
  height: 22px;
  display: block;
}

.dw-wizard__result-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
}

/* Download link */
.dw-wizard__result-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 7px 18px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--_accent), var(--_glow));
  color: #fff !important;
  text-decoration: none;
  transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 2px 12px rgba(var(--_accent-rgb), 0.3);
}

.dw-wizard__result-link svg {
  flex-shrink: 0;
}

.dw-wizard__result-link:hover {
  opacity: 0.92;
  transform: translateY(-1px);
  box-shadow: 0 4px 18px rgba(var(--_accent-rgb), 0.4);
  color: #fff !important;
}

/* Status badges */
.dw-wizard__result-status {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: 100px;
  letter-spacing: 0.02em;
}

.dw-wizard__result-status--available {
  color: var(--_teal);
  background: rgba(var(--_teal-rgb), 0.1);
  border: 1px solid rgba(var(--_teal-rgb), 0.25);
}

.dw-wizard__result-status--coming {
  color: rgba(var(--_accent-rgb), 0.85);
  background: rgba(var(--_accent-rgb), 0.08);
  border: 1px solid rgba(var(--_accent-rgb), 0.2);
}

/* ============================================================
   WAITLIST (inside wizard step 2)
   ============================================================ */
.dw-wizard__waitlist {
  margin-top: 0.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.dw-wizard__waitlist-label {
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.45);
  margin: 0 0 0.75rem;
  font-weight: 500;
}

.dw-waitlist-form {
  display: flex;
  gap: 10px;
  max-width: 440px;
  margin: 0 auto;
}

.dw-waitlist-input {
  flex: 1;
  padding: 11px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  color: #fff;
  font-size: 0.95rem;
  outline: none;
  min-width: 0;
  transition: border-color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
}

.dw-waitlist-input:focus {
  border-color: rgba(var(--_accent-rgb), 0.5);
  background: rgba(var(--_accent-rgb), 0.06);
  box-shadow: 0 0 0 3px rgba(var(--_accent-rgb), 0.08);
}

.dw-waitlist-input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.dw-waitlist-btn {
  background: linear-gradient(135deg, var(--_accent), var(--_glow));
  border: none;
  padding: 11px 22px;
  border-radius: 10px;
  white-space: nowrap;
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 3px 16px rgba(var(--_accent-rgb), 0.35);
  transition: box-shadow 0.2s, transform 0.15s;
}

.dw-waitlist-btn:hover {
  box-shadow: 0 5px 24px rgba(var(--_accent-rgb), 0.5);
  transform: translateY(-1px);
}

/* Success / Error / Already states */
.dw-waitlist-success,
.dw-waitlist-already {
  padding: 16px;
  animation: dw-step-enter 0.35s ease forwards;
}

.dw-waitlist-success p:first-child,
.dw-waitlist-already p:first-child {
  font-size: 1rem;
  font-weight: 600;
  color: var(--_teal);
  margin: 0 0 6px;
}

.dw-waitlist-position-number {
  font-size: 2rem;
  font-weight: 800;
  color: var(--_glow);
  margin: 0;
  text-shadow: 0 0 20px rgba(var(--_accent-rgb), 0.4);
}

.dw-waitlist-error p {
  color: #ff6b6b;
  font-size: 0.9rem;
  margin: 0;
  padding: 10px 16px;
  background: rgba(255, 68, 68, 0.08);
  border: 1px solid rgba(255, 68, 68, 0.2);
  border-radius: 10px;
}

/* ============================================================
   BACK BUTTON
   ============================================================ */
.dw-wizard__back {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 1.25rem;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.35);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  transition: color 0.2s, background 0.2s;
}

.dw-wizard__back:hover {
  color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.04);
}

/* ============================================================
   RESPONSIVE — TABLET
   ============================================================ */
@media screen and (max-width: 991px) {
  .dw-wizard {
    padding: 2rem 1.5rem 1.75rem;
  }
}

/* ============================================================
   RESPONSIVE — MOBILE
   ============================================================ */
@media screen and (max-width: 767px) {
  .dw-wizard {
    padding: 1.5rem 1rem 1.25rem;
    border-radius: 20px;
  }

  .dw-wizard__devices {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .dw-wizard__device-card {
    padding: 1.1rem 0.5rem 0.9rem;
  }

  .dw-wizard__next {
    width: 100%;
    padding: 14px 24px;
  }

  .dw-waitlist-form {
    flex-direction: column;
  }

  .dw-waitlist-btn {
    width: 100%;
    padding: 13px 24px;
  }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .dw-wizard__device-card,
  .dw-wizard__next,
  .dw-waitlist-btn {
    transition: none;
  }

  .dw-wizard__device-card:hover,
  .dw-wizard__device input:checked + .dw-wizard__device-card,
  .dw-wizard__next:not(:disabled):hover {
    transform: none;
  }

  .dw-wizard__step[data-animate="enter"],
  .dw-wizard__step[data-animate="exit"] {
    animation: none;
    opacity: 1;
    transform: none;
  }

  .dw-wizard__device input:checked + .dw-wizard__device-card::before {
    animation: none;
  }
}
