/* ============================================
   Endel Lifetime Premium Redeem Page
   Design System & Styles
   ============================================ */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* --- CSS Variables --- */
:root {
  --bg-primary: #000000;
  --bg-card: rgba(255, 255, 255, 0.04);
  --bg-card-hover: rgba(255, 255, 255, 0.06);
  --bg-input: rgba(255, 255, 255, 0.06);
  --bg-button: #ffffff;
  --bg-button-hover: #e8e8e8;
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.6);
  --text-tertiary: rgba(255, 255, 255, 0.35);
  --text-button: #000000;
  --border-color: rgba(255, 255, 255, 0.15);
  --border-focus: rgba(255, 255, 255, 0.5);
  --accent-glow: rgba(255, 255, 255, 0.08);
  --success-color: #4ade80;
  --error-color: #f87171;
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  line-height: 1.6;
}

/* --- Header / Navigation --- */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 20px 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(to bottom, rgba(0,0,0,0.9) 0%, transparent 100%);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-icon {
  width: 32px;
  height: 32px;
  opacity: 0.9;
  filter: invert(1);
}

.header-logo span {
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: 0.5px;
}

/* --- Main Content --- */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 100px 24px 80px;
  min-height: 100vh;
  position: relative;
}

/* --- Background Ambient Effect --- */
.ambient-bg {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.ambient-bg::before {
  content: '';
  position: absolute;
  top: -20%;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 600px;
  background: radial-gradient(ellipse, rgba(255,255,255,0.03) 0%, transparent 70%);
  animation: ambientPulse 8s ease-in-out infinite;
}

@keyframes ambientPulse {
  0%, 100% { opacity: 0.5; transform: translateX(-50%) scale(1); }
  50% { opacity: 1; transform: translateX(-50%) scale(1.1); }
}

/* --- Sound Wave SVG Animation --- */
.sound-wave-container {
  width: 100%;
  max-width: 500px;
  margin-bottom: 40px;
  position: relative;
  z-index: 1;
}

.sound-wave-container svg {
  width: 100%;
  height: auto;
}

.wave-path {
  fill: none;
  stroke: rgba(255, 255, 255, 0.5);
  stroke-width: 1.2;
  stroke-linecap: round;
}

.wave-path-1 {
  animation: waveMove1 6s ease-in-out infinite;
}

.wave-path-2 {
  stroke: rgba(255, 255, 255, 0.3);
  animation: waveMove2 7s ease-in-out infinite;
}

.wave-path-3 {
  stroke: rgba(255, 255, 255, 0.15);
  animation: waveMove3 8s ease-in-out infinite;
}

@keyframes waveMove1 {
  0%, 100% { d: path("M0,80 C80,40 160,120 240,80 C320,40 400,120 500,80"); }
  50% { d: path("M0,80 C80,120 160,40 240,80 C320,120 400,40 500,80"); }
}

@keyframes waveMove2 {
  0%, 100% { d: path("M0,80 C100,50 200,110 300,80 C400,50 450,110 500,80"); }
  50% { d: path("M0,80 C100,110 200,50 300,80 C400,110 450,50 500,80"); }
}

@keyframes waveMove3 {
  0%, 100% { d: path("M0,80 C60,60 140,100 250,80 C360,60 440,100 500,80"); }
  50% { d: path("M0,80 C60,100 140,60 250,80 C360,100 440,60 500,80"); }
}

/* --- Head Silhouette --- */
.head-silhouette {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -55%);
  width: 120px;
  height: 140px;
}

/* --- Step Container --- */
.step-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 520px;
  text-align: center;
}

.step {
  display: none;
  animation: fadeSlideIn 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.step.active {
  display: block;
}

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

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

.step.exiting {
  animation: fadeSlideOut 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* --- Typography --- */
.step-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 16px;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.step-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 40px;
  line-height: 1.6;
  font-weight: 300;
}

/* --- Form Card --- */
.form-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 32px 28px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: var(--transition-smooth);
}

.form-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.2);
}

/* --- Input Group --- */
.input-group {
  text-align: left;
  margin-bottom: 24px;
}

.input-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 10px;
}

.input-field {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px 18px;
  font-size: 1rem;
  font-family: var(--font-family);
  color: var(--text-primary);
  outline: none;
  transition: var(--transition-smooth);
  letter-spacing: 0.5px;
}

.input-field::placeholder {
  color: var(--text-tertiary);
  font-weight: 300;
}

.input-field:focus {
  border-color: var(--border-focus);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.05);
}

.input-field.error {
  border-color: var(--error-color);
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.1);
}

.input-field.success {
  border-color: var(--success-color);
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.1);
}

textarea.input-field {
  resize: vertical;
  min-height: 100px;
  line-height: 1.5;
}

/* --- Error Message --- */
.error-message {
  display: none;
  color: var(--error-color);
  font-size: 0.85rem;
  margin-top: 8px;
  text-align: left;
  font-weight: 400;
  animation: shakeError 0.4s ease-in-out;
}

.error-message.visible {
  display: block;
}

@keyframes shakeError {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

/* --- Submit Button --- */
.btn-submit {
  width: 100%;
  padding: 16px 24px;
  background: var(--bg-button);
  color: var(--text-button);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font-family);
  cursor: pointer;
  transition: var(--transition-smooth);
  position: relative;
  overflow: hidden;
  letter-spacing: 0.3px;
}

.btn-submit::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.15) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.btn-submit:hover {
  background: var(--bg-button-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(255, 255, 255, 0.1);
}

.btn-submit:hover::before {
  opacity: 1;
}

.btn-submit:active {
  transform: translateY(0);
  box-shadow: none;
}

.btn-submit:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* --- Loading Spinner --- */
.btn-submit .spinner {
  display: none;
  width: 20px;
  height: 20px;
  border: 2px solid transparent;
  border-top-color: var(--text-button);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}

.btn-submit.loading .btn-text {
  display: none;
}

.btn-submit.loading .spinner {
  display: block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* --- Step Progress Indicator --- */
.step-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 48px;
}

.progress-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  transition: var(--transition-smooth);
}

.progress-dot.active {
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.progress-dot.completed {
  background: var(--success-color);
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.3);
}

.progress-line {
  width: 40px;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  transition: var(--transition-smooth);
}

.progress-line.completed {
  background: var(--success-color);
}

/* --- Tutorial / How-to Section --- */
.tutorial-section {
  margin-top: 48px;
  text-align: center;
  width: 100%;
  max-width: 520px;
  position: relative;
  z-index: 1;
}

.tutorial-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 24px;
  letter-spacing: -0.01em;
}

/* --- Tutorial Tabs --- */
.tutorial-tabs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-bottom: 28px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 4px;
}

.tutorial-tab {
  flex: 1;
  padding: 10px 20px;
  background: transparent;
  border: none;
  border-radius: 10px;
  color: var(--text-tertiary);
  font-size: 0.9rem;
  font-weight: 500;
  font-family: var(--font-family);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.tutorial-tab:hover {
  color: var(--text-secondary);
}

.tutorial-tab.active {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* --- Tutorial Panels --- */
.tutorial-panel {
  display: none;
  animation: fadeSlideIn 0.4s ease forwards;
}

.tutorial-panel.active {
  display: block;
}

/* --- Image Tutorial --- */
.tutorial-image-wrapper {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.tutorial-image {
  width: 100%;
  min-height: 200px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: top center;
  pointer-events: none;
  aspect-ratio: auto;
}

/* Use JS to set the correct aspect ratio dynamically */

.tutorial-steps {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.tutorial-step {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 24px;
  text-align: left;
  transition: var(--transition-smooth);
}

.tutorial-step:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.tutorial-step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.tutorial-step-text {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

.tutorial-step-text strong {
  color: var(--text-primary);
  font-weight: 600;
}

.tutorial-step-text .highlight {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 8px;
  border-radius: 6px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.85rem;
}

/* --- Success Step --- */
.success-icon-container {
  margin-bottom: 32px;
}

.success-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto;
  border-radius: 50%;
  background: rgba(74, 222, 128, 0.1);
  border: 2px solid var(--success-color);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: successPop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes successPop {
  from { transform: scale(0); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.success-icon svg {
  width: 36px;
  height: 36px;
  stroke: var(--success-color);
  stroke-width: 2.5;
  fill: none;
  animation: checkDraw 0.5s ease-out 0.3s forwards;
  stroke-dasharray: 50;
  stroke-dashoffset: 50;
}

@keyframes checkDraw {
  to { stroke-dashoffset: 0; }
}

.success-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 16px;
  letter-spacing: -0.02em;
  color: var(--success-color);
}

.success-message {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.8;
  font-weight: 300;
  max-width: 420px;
  margin: 0 auto;
}

.success-message strong {
  color: var(--text-primary);
  font-weight: 500;
}

.success-tip {
  margin-top: 32px;
  padding: 20px 24px;
  background: rgba(74, 222, 128, 0.05);
  border: 1px solid rgba(74, 222, 128, 0.15);
  border-radius: 14px;
  text-align: left;
}

.success-tip-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--success-color);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.success-tip-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* --- Footer --- */
.footer {
  text-align: center;
  padding: 40px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  position: relative;
  z-index: 1;
}

.footer-text {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-text a {
  color: var(--text-tertiary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-text a:hover {
  color: var(--text-secondary);
}

.footer-socials {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.footer-socials a {
  color: var(--text-tertiary);
  transition: var(--transition-smooth);
  display: flex;
  align-items: center;
}

.footer-socials a:hover {
  color: var(--text-primary);
  transform: translateY(-2px);
}

.footer-socials svg {
  width: 20px;
  height: 20px;
}

/* --- Responsive --- */
@media (max-width: 600px) {
  .header {
    padding: 16px 20px;
  }

  .main-content {
    padding: 80px 16px 60px;
    justify-content: flex-start;
  }

  .step-container {
    max-width: 100%;
  }

  .step-title {
    font-size: 1.5rem;
  }

  .step-subtitle {
    font-size: 0.88rem;
    margin-bottom: 28px;
  }

  .form-card {
    padding: 24px 18px;
    border-radius: 16px;
  }

  .input-field {
    padding: 14px 14px;
    font-size: 0.95rem;
    border-radius: 10px;
  }

  .btn-submit {
    padding: 14px 20px;
    border-radius: 12px;
    font-size: 0.95rem;
  }

  .step-progress {
    margin-bottom: 32px;
  }

  .progress-line {
    width: 28px;
  }

  .sound-wave-container {
    max-width: 280px;
    margin-bottom: 24px;
  }

  .success-title {
    font-size: 1.5rem;
  }

  .success-message {
    font-size: 0.9rem;
  }

  .success-icon {
    width: 64px;
    height: 64px;
  }

  .success-icon svg {
    width: 28px;
    height: 28px;
  }

  .success-tip {
    padding: 16px 18px;
    border-radius: 12px;
  }

  .success-tip-text {
    font-size: 0.85rem;
  }

  /* Tutorial */
  .tutorial-section {
    margin-top: 36px;
    max-width: 100%;
  }

  .tutorial-title {
    font-size: 1.15rem;
    margin-bottom: 20px;
  }

  .tutorial-tabs {
    margin-bottom: 20px;
  }

  .tutorial-tab {
    padding: 8px 16px;
    font-size: 0.85rem;
  }

  .tutorial-step {
    padding: 18px;
    border-radius: 12px;
  }

  .tutorial-step-text {
    font-size: 0.88rem;
  }

  .tutorial-image-wrapper {
    border-radius: 12px;
  }

  /* Footer */
  .footer {
    padding: 32px 16px;
  }

  .footer-text {
    gap: 12px;
    font-size: 0.75rem;
  }

  .footer-socials {
    gap: 16px;
  }

  .footer-socials svg {
    width: 18px;
    height: 18px;
  }
}

@media (max-width: 375px) {
  .step-title {
    font-size: 1.3rem;
  }

  .form-card {
    padding: 20px 16px;
  }

  .input-field {
    padding: 12px 12px;
    font-size: 0.9rem;
  }

  .btn-submit {
    padding: 12px 16px;
    font-size: 0.9rem;
  }

  .footer-text {
    gap: 8px;
  }
}

/* --- Utility Animations --- */
.fade-in {
  animation: fadeIn 0.5s ease forwards;
}

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

/* --- Particle Effect (ambient) --- */
.particle {
  position: fixed;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  pointer-events: none;
  z-index: 0;
  animation: particleFloat linear infinite;
}

@keyframes particleFloat {
  0% {
    transform: translateY(100vh) scale(0);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    transform: translateY(-10vh) scale(1);
    opacity: 0;
  }
}
