/* ==========================================================================
   DESIGN SYSTEM & VARIABLES
   ========================================================================== */
:root {
  --font-family-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-family-display: 'Outfit', sans-serif;
  
  /* Color Palette - HSL curated for high-end feel */
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --card-bg: rgba(17, 24, 39, 0.7);
  --card-border: rgba(255, 255, 255, 0.08);
  
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  
  /* Brand/Accent Colors (Hamec Pink/Rose Theme) */
  --color-primary: #db2777; /* Hamec Pink */
  --color-primary-hover: #be185d; /* Darker Pink */
  --color-secondary: #9d174d; /* Deep Rose */
  --color-accent: #ec4899; /* Bright Pink */
  --color-gold: #f59e0b; /* Amber */
  --color-danger: #ef4444; /* Rose Red */
  
  /* Glow/Neon Shadows */
  --glow-teal: 0 0 20px rgba(157, 23, 77, 0.4);
  --glow-primary: 0 0 25px rgba(219, 39, 119, 0.5);
  --glow-accent: 0 0 20px rgba(236, 72, 153, 0.4);
  
  --transition-smooth: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: all 0.2s ease;
}

/* ==========================================================================
   RESET & BASE STYLES
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Ambient Background Lights */
.bg-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(130px);
  z-index: 0;
  pointer-events: none;
  opacity: 0.45;
}

.bg-glow-1 {
  width: 45vw;
  height: 45vw;
  background: radial-gradient(circle, var(--color-primary) 0%, transparent 70%);
  top: -10vw;
  right: -5vw;
}

.bg-glow-2 {
  width: 50vw;
  height: 50vw;
  background: radial-gradient(circle, var(--color-secondary) 0%, transparent 70%);
  bottom: -15vw;
  left: -10vw;
}

/* ==========================================================================
   APP CONTAINER LAYOUT
   ========================================================================== */
.app-container {
  width: 100%;
  max-width: 1280px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  z-index: 10;
  position: relative;
}

/* Header */
.app-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.logo-area {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--card-border);
  padding: 0.5rem 1.2rem;
  border-radius: 50px;
  backdrop-filter: blur(5px);
  margin-bottom: 1.2rem;
}

.logo-icon {
  color: var(--color-primary);
  font-size: 1.2rem;
  filter: drop-shadow(0 0 5px rgba(14, 165, 233, 0.6));
  animation: pulse-slow 2s infinite ease-in-out;
}

.logo-text {
  font-family: var(--font-family-display);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 2px;
  color: var(--text-primary);
}

.main-title {
  font-family: var(--font-family-display);
  font-size: 2.8rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, #ffffff 30%, #a5f3fc 70%, var(--color-primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
  font-weight: 400;
  max-width: 600px;
  margin: 0 auto;
}

/* Main Area */
.app-main {
  flex-grow: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 2rem;
}

/* ==========================================================================
   REGISTRATION FORM CARD (GLASSMORPHISM)
   ========================================================================== */
.card-section {
  display: none;
  width: 100%;
  max-width: 480px;
  animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.card-section.active {
  display: block;
}

.form-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(20px);
  border-radius: 24px;
  padding: 3rem 2.5rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.form-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
}

.card-icon {
  width: 64px;
  height: 64px;
  background: rgba(14, 165, 233, 0.1);
  border: 1px solid rgba(14, 165, 233, 0.2);
  color: var(--color-primary);
  font-size: 1.8rem;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 16px;
  margin: 0 auto 1.5rem;
  box-shadow: var(--glow-primary);
}

.form-card h2 {
  font-family: var(--font-family-display);
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: #fff;
}

.form-desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 2rem;
}

/* Form controls */
.input-group {
  text-align: left;
  margin-bottom: 1.5rem;
}

.input-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  letter-spacing: 0.5px;
}

.input-group label i {
  color: var(--color-primary);
  margin-right: 0.25rem;
}

.input-group input {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--card-border);
  color: #fff;
  padding: 0.9rem 1.2rem;
  border-radius: 12px;
  font-family: var(--font-family-sans);
  font-size: 1rem;
  transition: var(--transition-fast);
}

.input-group input:focus {
  outline: none;
  border-color: var(--color-primary);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 10px rgba(14, 165, 233, 0.25);
}

.terms-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  text-align: left;
  margin-bottom: 2rem;
}

.terms-checkbox input[type="checkbox"] {
  accent-color: var(--color-primary);
  width: 16px;
  height: 16px;
  margin-top: 0.15rem;
}

.terms-checkbox label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
  cursor: pointer;
  user-select: none;
}

/* Buttons */
.btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  padding: 1rem 1.5rem;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
  border: none;
  font-family: var(--font-family-sans);
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
  color: #fff;
  box-shadow: var(--glow-primary);
  position: relative;
  overflow: hidden;
  z-index: 1;
}

.btn-primary::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--color-secondary) 0%, var(--color-primary) 100%);
  opacity: 0;
  z-index: -1;
  transition: opacity 0.5s ease;
}

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

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(14, 165, 233, 0.6);
}

.btn-primary:active {
  transform: translateY(1px);
}

.error-message {
  color: var(--color-danger);
  font-size: 0.85rem;
  margin-top: 1rem;
  min-height: 20px;
  font-weight: 500;
}

/* ==========================================================================
   LUCKY WHEEL SECTION
   ========================================================================== */
.game-section {
  display: none;
  width: 100%;
  animation: fadeIn 0.8s ease forwards;
}

.game-section.active {
  display: flex;
  justify-content: center;
  align-items: center;
}

.wheel-outer-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}

/* Spinner wrapper holds the pointer and the canvas */
.wheel-spinner-wrapper {
  position: relative;
  width: 460px;
  height: 460px;
  border-radius: 50%;
  padding: 10px;
  background: radial-gradient(circle, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.02) 100%);
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

/* Arrow pointer pointing down onto the wheel */
.wheel-pointer {
  position: absolute;
  top: -15px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.5));
}

.wheel-canvas-container {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 0 30px rgba(0,0,0,0.3);
}

#wheel-canvas {
  width: 100%;
  height: 100%;
  display: block;
  transition: transform 6s cubic-bezier(0.1, 0.8, 0.1, 1); /* Custom easing for realistic rotation deceleration */
}

/* Center decorative cap on the wheel */
.wheel-center-cap {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60px;
  height: 60px;
  background: radial-gradient(circle, #2a3754 0%, #0c152b 100%);
  border: 4px solid #fff;
  border-radius: 50%;
  z-index: 10;
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--color-gold);
  font-size: 1.2rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6), 0 0 15px rgba(245, 158, 11, 0.4);
}

.wheel-center-cap i {
  animation: pulse-slow 1.5s infinite ease-in-out;
}

/* Spin action buttons */
.wheel-control {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  width: 100%;
  max-width: 320px;
}

.btn-spin-action {
  width: 100%;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
  font-family: var(--font-family-display);
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: 2px;
  padding: 1.1rem;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: var(--glow-accent);
  transition: var(--transition-smooth);
}

.btn-spin-action:hover:not(:disabled) {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 10px 30px rgba(16, 185, 129, 0.6);
}

.btn-spin-action:active:not(:disabled) {
  transform: translateY(1px);
}

.btn-spin-action:disabled {
  background: #374151;
  color: #9ca3af;
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.6;
}

.user-status-badge {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--card-border);
  padding: 0.5rem 1rem;
  border-radius: 30px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.user-status-badge i {
  color: var(--color-accent);
}

/* ==========================================================================
   POPUP MODAL (GLASSMORPHISM WINNER MODAL)
   ========================================================================== */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(4, 6, 13, 0.85);
  backdrop-filter: blur(10px);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  padding: 1.5rem;
  animation: fadeIn 0.3s ease forwards;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  background: var(--bg-secondary);
  border: 1px solid var(--card-border);
  border-radius: 28px;
  width: 100%;
  max-width: 500px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8);
  animation: zoomIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.modal-glow {
  position: absolute;
  top: -80px;
  left: 50%;
  transform: translateX(-50%);
  width: 250px;
  height: 250px;
  background: radial-gradient(circle, rgba(14, 165, 233, 0.25) 0%, transparent 70%);
  z-index: 0;
  pointer-events: none;
}

.modal-close {
  position: absolute;
  top: 1.2rem;
  right: 1.2rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--card-border);
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--text-secondary);
  cursor: pointer;
  z-index: 10;
  transition: var(--transition-fast);
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.modal-content {
  padding: 3rem 2.5rem;
  text-align: center;
  position: relative;
  z-index: 2;
}

.winner-trophy {
  font-size: 3.5rem;
  color: var(--color-gold);
  margin-bottom: 1rem;
  filter: drop-shadow(0 0 15px rgba(245, 158, 11, 0.5));
}

.modal-congrats {
  font-family: var(--font-family-display);
  font-weight: 800;
  font-size: 2rem;
  letter-spacing: 1px;
  color: #fff;
  margin-bottom: 0.5rem;
}

.modal-prize-desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 0.3rem;
}

.modal-prize-title {
  font-family: var(--font-family-display);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--color-accent);
  margin-bottom: 1.8rem;
  padding: 0 1rem;
}

/* Voucher ticket aesthetics */
.voucher-display-card {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  text-align: left;
  position: relative;
}

/* Punch cuts to look like a ticket */
.voucher-display-card::before, .voucher-display-card::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  background-color: var(--bg-secondary);
  border-radius: 50%;
}

.voucher-display-card::before {
  left: -8px;
  transform: translateY(-50%);
}

.voucher-display-card::after {
  right: -8px;
  transform: translateY(-50%);
}

.voucher-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 0.6rem;
  margin-bottom: 0.8rem;
}

.voucher-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 1px;
}

.voucher-rule-badge {
  font-size: 0.7rem;
  font-weight: 600;
  color: #fff;
  background-color: var(--color-primary);
  padding: 0.2rem 0.6rem;
  border-radius: 30px;
}

.voucher-code-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
  letter-spacing: 0.5px;
}

.voucher-code-value {
  font-family: var(--font-family-display);
  font-size: 1.8rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: 2px;
  word-break: break-all;
}

.voucher-footer {
  margin-top: 0.8rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 0.6rem;
}

.voucher-footer p {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* QR code section */
.qr-section {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 1.2rem;
  margin-bottom: 2rem;
}

.qr-container {
  width: 140px;
  height: 140px;
  background: #fff;
  border-radius: 12px;
  padding: 8px;
  margin: 0 auto 0.8rem;
}

.qr-container img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.qr-instruction {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
.app-footer {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: auto;
}

/* ==========================================================================
   ANIMATIONS & EFFECTS
   ========================================================================== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

@keyframes pulse-slow {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.75;
    transform: scale(0.96);
  }
}

.animate-bounce {
  animation: bounce 2s infinite ease-in-out;
}

@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

/* ==========================================================================
   MEDIA QUERIES (RESPONSIVENESS)
   ========================================================================== */
@media (max-width: 600px) {
  .app-container {
    padding: 1.5rem 1rem;
  }
  
  .main-title {
    font-size: 2rem;
  }
  
  .form-card {
    padding: 2rem 1.5rem;
  }
  
  .wheel-spinner-wrapper {
    width: 320px;
    height: 320px;
    padding: 6px;
  }
  
  .wheel-center-cap {
    width: 50px;
    height: 50px;
    font-size: 1rem;
  }
  
  .modal-content {
    padding: 2rem 1.25rem;
  }
  
  .voucher-code-value {
    font-size: 1.4rem;
  }
}
