/**
 * NA Beer Finder - Onboarding Styles
 * Apple-inspired glassmorphism design
 *
 * CUSTOMIZATION:
 * - Colors: Change CSS variables in :root
 * - Spacing: Adjust --spacing-* variables
 * - Animation speed: Modify transition durations (e.g., 0.5s)
 * - Typography: Update font-size values in slide-title, slide-subtitle
 */

:root {
  /* Brand Colors - NA Beer Finder Orange */
  --color-primary-start: #f97316;
  --color-primary-end: #ea580c;
  --color-success-start: #FFAB0F;
  --color-success-end: #F59E0B;

  /* Neutral Colors - Light/White Theme */
  --color-background: #ffffff;
  --color-background-gradient-start: #ffffff;
  --color-background-gradient-end: #fafafa;
  --color-text-primary: #1a1a1a;
  --color-text-secondary: #4b5563;
  --color-text-tertiary: #9ca3af;

  /* Spacing Scale */
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 1.5rem;
  --spacing-lg: 2rem;
  --spacing-xl: 3rem;
  --spacing-2xl: 4rem;

  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Shadows */
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-button: 0 8px 24px 0 rgba(255, 171, 15, 0.35);
  --shadow-button-hover: 0 12px 32px 0 rgba(255, 171, 15, 0.45);
  --shadow-glass: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
  --shadow-glass-hover: 0 12px 40px 0 rgba(31, 38, 135, 0.2);

  /* Typography */
  --font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Only apply overflow hidden when onboarding is active */
body.onboarding-active,
body.onboarding-active html {
  overflow: hidden;
}

body.onboarding-active {
  font-family: var(--font-family);
  background:
    radial-gradient(circle at 20% 50%, rgba(249, 115, 22, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(234, 88, 12, 0.12) 0%, transparent 50%),
    radial-gradient(circle at 40% 20%, rgba(255, 171, 15, 0.1) 0%, transparent 50%),
    linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
  background-size: 100% 100%;
  background-attachment: fixed;
  color: var(--color-text-primary);
  position: relative;
}

/* Animated background effect */
body::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background:
    radial-gradient(circle at 30% 40%, rgba(249, 115, 22, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 70% 70%, rgba(255, 171, 15, 0.06) 0%, transparent 40%);
  animation: backgroundShift 20s ease-in-out infinite;
  pointer-events: none;
  z-index: -1;
}

@keyframes backgroundShift {
  0%, 100% {
    transform: translate(0, 0) rotate(0deg);
  }
  33% {
    transform: translate(-5%, -5%) rotate(1deg);
  }
  66% {
    transform: translate(5%, 5%) rotate(-1deg);
  }
}

/* Main Container */
#onboarding-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  display: none; /* Hidden by default, shown by JS */
  align-items: center;
  justify-content: center;
  padding: 0;
  z-index: 10000;
  pointer-events: none; /* Don't block clicks when hidden */
}

#onboarding-container.active {
  pointer-events: auto; /* Enable clicks when shown */
}

/* Card Container - Enhanced Glassmorphism - Full Screen */
.card-wrapper {
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(60px) saturate(180%);
  -webkit-backdrop-filter: blur(60px) saturate(180%);
  border: none;
  border-radius: 0;
  box-shadow: none;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  animation: fadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Skip Button */
.skip-button {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.8);
  font-size: 1.5rem;
  font-weight: 300;
  width: 2.5rem;
  height: 2.5rem;
  cursor: pointer;
  z-index: 20;
  border-radius: 50%;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.skip-button:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
  color: rgba(255, 255, 255, 1);
  transform: scale(1.05);
  box-shadow: 0 4px 16px 0 rgba(0, 0, 0, 0.2);
}

.skip-button:active {
  transform: scale(0.95);
}

.skip-button:focus {
  outline: 2px solid var(--color-primary-start);
  outline-offset: 2px;
}

/* Slides Container - Horizontal Scroll with Snap */
.slides-container {
  flex: 1;
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.slides-container::-webkit-scrollbar {
  display: none;
}

/* Individual Slide */
.slide {
  flex: 0 0 100%;
  width: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 2.5rem 1.5rem 2.5rem;
  overflow-y: auto;
}

.slide-content {
  width: 100%;
  max-width: 700px;
  text-align: left;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin: 0 auto;
}

/* Slide Icon */
.slide-icon {
  width: 70px;
  height: 70px;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
}

.slide-icon svg {
  width: 100%;
  height: 100%;
}

/* Typography - High Contrast for Dark Glass */
.slide-title {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.03em;
  color: #ffffff;
  margin-bottom: 1rem;
  width: 100%;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  animation: fadeSlideUp 0.6s 0.2s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

.slide-subtitle {
  font-size: 1.125rem;
  line-height: 1.6;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.85);
  width: 100%;
  margin-bottom: 2rem;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  animation: fadeSlideUp 0.6s 0.3s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Feature List (All Slides) */
.feature-list {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  margin-top: 0;
  width: 100%;
  list-style: none;
  padding-left: 0;
}

.feature-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  animation: fadeSlideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

.feature-item:nth-child(1) { animation-delay: 0.4s; }
.feature-item:nth-child(2) { animation-delay: 0.45s; }
.feature-item:nth-child(3) { animation-delay: 0.5s; }
.feature-item:nth-child(4) { animation-delay: 0.55s; }
.feature-item:nth-child(5) { animation-delay: 0.6s; }

.feature-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 171, 15, 0.3);
  transform: translateX(4px);
  box-shadow: 0 4px 16px 0 rgba(0, 0, 0, 0.15);
}

.feature-item:hover .feature-icon {
  color: var(--color-success-start);
  transform: scale(1.1);
}

.feature-icon {
  flex-shrink: 0;
  color: var(--color-primary-start);
  margin-top: 0.125rem;
  width: 20px;
  height: 20px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.feature-item span {
  font-size: 0.9375rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.9);
  text-align: left;
  line-height: 1.6;
}

/* Dot Indicators */
.dots-container {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  padding: 1rem 0;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.3);
  border: none;
  cursor: pointer;
  padding: 0;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.dot:hover:not(.active) {
  background: rgba(255, 255, 255, 0.5);
  transform: scale(1.2);
}

.dot.active {
  background: linear-gradient(135deg, var(--color-success-start) 0%, var(--color-success-end) 100%);
  width: 28px;
  box-shadow: 0 2px 12px 0 rgba(255, 171, 15, 0.5);
}

.dot:focus {
  outline: 2px solid var(--color-success-start);
  outline-offset: 2px;
}

/* Next/Get Started Button */
.next-button {
  width: auto;
  min-width: 200px;
  background: linear-gradient(135deg, var(--color-success-start) 0%, var(--color-success-end) 100%);
  color: #ffffff;
  border: none;
  padding: 1.125rem 3rem;
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  margin: 0 auto 2rem auto;
  box-shadow: var(--shadow-button);
  letter-spacing: -0.01em;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.next-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: rgba(255, 255, 255, 0.2);
  box-shadow: none;
}

.next-button:disabled:hover {
  transform: none;
  box-shadow: none;
}

.next-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, transparent 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.next-button:hover::before {
  opacity: 1;
}

.next-button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-button-hover);
}

.next-button:active {
  transform: translateY(0);
  box-shadow: var(--shadow-button);
}

.next-button:focus {
  outline: 2px solid var(--color-success-start);
  outline-offset: 2px;
}

/* Get Started Variant (Final Slide) */
.next-button.get-started {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  box-shadow: 0 8px 24px 0 rgba(16, 185, 129, 0.4);
}

.next-button.get-started:hover {
  box-shadow: 0 12px 32px 0 rgba(16, 185, 129, 0.5);
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .slides-container {
    scroll-behavior: auto;
  }

  body::before {
    animation: none !important;
  }
}

/* Checkbox Container */
.checkbox-container {
  padding: 1.25rem 1.5rem;
  margin: 0 auto 1rem auto;
  max-width: 700px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  transition: all 0.3s ease;
}

/* Checkbox shake animation when validation fails */
.checkbox-container.shake {
  animation: shake 0.5s ease-in-out;
  border-color: rgba(239, 68, 68, 0.8);
  background: rgba(239, 68, 68, 0.15);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-8px); }
  20%, 40%, 60%, 80% { transform: translateX(8px); }
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  cursor: pointer;
}

.checkbox-input {
  width: 20px;
  height: 20px;
  min-width: 20px;
  min-height: 20px;
  margin-top: 0.125rem;
  cursor: pointer;
  accent-color: var(--color-success-start);
}

.checkbox-text {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 400;
}

/* Creator Badge */
.creator-badge {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1.5rem;
  margin-left: calc(-1 * var(--spacing-md));
  margin-right: calc(-1 * var(--spacing-md));
  padding: 1.25rem 1.5rem;
  background: rgba(255, 171, 15, 0.08);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 171, 15, 0.2);
  border-radius: var(--radius-md);
  animation: fadeSlideUp 0.6s 0.8s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

.creator-photo {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 171, 15, 0.3);
  flex-shrink: 0;
}

.creator-caption {
  font-size: 0.875rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.9);
  margin: 0;
  font-weight: 500;
}

/* Mobile Optimizations */
@media (max-width: 640px) {
  #onboarding-container {
    padding: 0;
  }

  .card-wrapper {
    border-radius: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for mobile browsers */
  }

  .slide {
    padding: 4rem 1.5rem 1.5rem 1.5rem; /* Increased top padding to show icon */
    align-items: flex-start; /* Align to top on mobile */
  }

  .slide-content {
    padding-top: 1rem;
  }

  .slide-icon {
    width: 56px;
    height: 56px;
    margin-bottom: 1rem;
  }

  .slide-title {
    font-size: 1.75rem; /* Slightly smaller on mobile */
  }

  .slide-subtitle {
    font-size: 1rem;
  }

  .feature-item {
    padding: 1rem 1.25rem;
  }

  .feature-item span {
    font-size: 0.9375rem;
  }

  .feature-list {
    gap: var(--spacing-sm);
  }

  .creator-badge {
    flex-direction: column;
    text-align: center;
    gap: 0.75rem;
    margin-left: calc(-1 * var(--spacing-sm));
    margin-right: calc(-1 * var(--spacing-sm));
  }

  .creator-photo {
    width: 56px;
    height: 56px;
  }

  .checkbox-container {
    margin-left: 1rem;
    margin-right: 1rem;
  }
}

/* Focus Visible for Better Accessibility */
.skip-button:focus-visible,
.next-button:focus-visible,
.dot:focus-visible {
  outline: 2px solid var(--color-primary-start);
  outline-offset: 2px;
}

/* Dark Mode Support (Optional) */
@media (prefers-color-scheme: dark) {
  :root {
    --color-background: #1a1a1a;
    --color-background-gradient-start: #111827;
    --color-background-gradient-end: #1f2937;
    --color-text-primary: #f9fafb;
    --color-text-secondary: #d1d5db;
    --color-text-tertiary: #9ca3af;
  }

  .feature-item {
    background: rgba(31, 41, 55, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
  }
}
