/**
 * Prize Wheel Styles
 * Highly customizable CSS with CSS variables for theming
 */

/* ============================================
   CSS CUSTOM PROPERTIES (Theme Variables)
   ============================================ */
:root {
  /* Colors */
  --wheel-background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  --wheel-primary: #FFD700;
  --wheel-secondary: #4ECDC4;
  --wheel-accent: #FF6B6B;
  --wheel-text: #FFFFFF;
  --wheel-text-muted: rgba(255, 255, 255, 0.7);
  --wheel-overlay: rgba(0, 0, 0, 0.7);
  
  /* Modal Colors */
  --modal-bg: #1a1a2e;
  --modal-border: rgba(255, 215, 0, 0.3);
  --modal-shadow: rgba(0, 0, 0, 0.5);
  
  /* Button Colors */
  --btn-primary-bg: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
  --btn-primary-text: #1a1a2e;
  --btn-secondary-bg: rgba(255, 255, 255, 0.1);
  --btn-secondary-text: #FFFFFF;
  --btn-hover-scale: 1.05;
  
  /* Sizing */
  --wheel-max-size: 400px;
  --wheel-min-size: 280px;
  --modal-max-width: 400px;
  --border-radius: 16px;
  --border-radius-sm: 8px;
  
  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;
  
  /* Fonts */
  --font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  
  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 30px rgba(255, 215, 0, 0.5);
}

/* ============================================
   BASE STYLES
   ============================================ */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background: var(--wheel-background);
  color: var(--wheel-text);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
}

/* ============================================
   CONTAINER
   ============================================ */
.prize-wheel-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
}

/* ============================================
   LOADING OVERLAY
   ============================================ */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--wheel-background);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: opacity var(--transition-normal);
}

.loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--wheel-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-overlay p {
  margin-top: 16px;
  color: var(--wheel-text-muted);
  font-size: 14px;
}

/* ============================================
   WHEEL WRAPPER
   ============================================ */
.wheel-wrapper {
  position: relative;
  width: 100%;
  max-width: var(--wheel-max-size);
  aspect-ratio: 1;
  margin: 20px 0;
}

.wheel-stage {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ============================================
   WHEEL CANVAS
   ============================================ */
#wheel-canvas {
  width: 100%;
  height: 100%;
  max-width: var(--wheel-max-size);
  max-height: var(--wheel-max-size);
}

/* ============================================
   POINTER
   ============================================ */
.wheel-pointer {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  color: var(--wheel-primary);
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.4));
  transition: transform var(--transition-fast);
}

.pointer-svg {
  width: 40px;
  height: 60px;
}

.wheel-pointer.bounce {
  animation: pointer-bounce 0.2s ease;
}

@keyframes pointer-bounce {
  0%, 100% { transform: translateX(-50%) rotate(0deg); }
  25% { transform: translateX(-50%) rotate(-10deg); }
  75% { transform: translateX(-50%) rotate(10deg); }
}

/* ============================================
   CENTER HUB / SPIN BUTTON
   ============================================ */
.wheel-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
}

.spin-button {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 4px solid var(--wheel-primary);
  background: linear-gradient(135deg, #1a1a2e 0%, #2d2d5a 100%);
  color: var(--wheel-text);
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  box-shadow: var(--shadow-lg), inset 0 2px 10px rgba(255, 255, 255, 0.1);
  transition: all var(--transition-fast);
  outline: none;
}

.spin-button:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: var(--shadow-glow);
}

.spin-button:active:not(:disabled) {
  transform: scale(0.95);
}

.spin-button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.spin-button.spinning {
  animation: pulse 0.5s ease infinite;
}

.spin-button .spin-text {
  font-size: 12px;
  letter-spacing: 1px;
}

.spin-button .spin-icon {
  font-size: 20px;
}

@keyframes pulse {
  0%, 100% { box-shadow: var(--shadow-lg); }
  50% { box-shadow: var(--shadow-glow); }
}

/* ============================================
   DECORATIVE LIGHTS
   ============================================ */
.wheel-lights {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  border-radius: 50%;
}

/* ============================================
   WHEEL EFFECTS
   ============================================ */
.wheel-glow {
  animation: wheel-glow 1s ease infinite;
}

@keyframes wheel-glow {
  0%, 100% { filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.3)); }
  50% { filter: drop-shadow(0 0 30px rgba(255, 215, 0, 0.6)); }
}

.wheel-shake {
  animation: shake 0.5s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-10px); }
  40% { transform: translateX(10px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}

/* ============================================
   SPINS REMAINING
   ============================================ */
.spins-remaining {
  text-align: center;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  font-size: 14px;
  color: var(--wheel-text-muted);
  margin-top: 16px;
}

.spins-remaining #spins-count {
  font-weight: 700;
  color: var(--wheel-primary);
}

/* ============================================
   MODAL BASE
   ============================================ */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

.modal.visible {
  opacity: 1;
  visibility: visible;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--wheel-overlay);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: var(--modal-bg);
  border: 1px solid var(--modal-border);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  padding: 32px;
  max-width: var(--modal-max-width);
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.9) translateY(20px);
  transition: transform var(--transition-normal);
}

.modal.visible .modal-content {
  transform: scale(1) translateY(0);
}

/* ============================================
   PRIZE MODAL
   ============================================ */
.prize-modal-content {
  text-align: center;
}

.confetti-container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  overflow: hidden;
}

.prize-header {
  margin-bottom: 24px;
}

.prize-emoji {
  font-size: 48px;
  display: block;
  margin-bottom: 8px;
  animation: bounce-in 0.5s ease;
}

@keyframes bounce-in {
  0% { transform: scale(0); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.prize-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--wheel-primary);
  text-transform: uppercase;
  letter-spacing: 2px;
}

.prize-body {
  margin-bottom: 24px;
}

.prize-subtitle {
  color: var(--wheel-text-muted);
  margin-bottom: 16px;
}

.prize-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  background: rgba(255, 215, 0, 0.1);
  border: 2px solid var(--wheel-primary);
  border-radius: var(--border-radius-sm);
  margin-bottom: 20px;
}

.prize-value {
  font-size: 36px;
  font-weight: 800;
  color: var(--wheel-primary);
  line-height: 1.2;
}

.prize-label {
  font-size: 14px;
  color: var(--wheel-text-muted);
  margin-top: 4px;
}

.prize-code-section {
  margin-bottom: 16px;
}

.code-label {
  font-size: 14px;
  color: var(--wheel-text-muted);
  margin-bottom: 8px;
}

.code-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--border-radius-sm);
}

.prize-code {
  font-family: 'Courier New', monospace;
  font-size: 18px;
  font-weight: 700;
  color: var(--wheel-text);
  letter-spacing: 2px;
}

.copy-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--border-radius-sm);
  color: var(--wheel-text);
  font-family: var(--font-family);
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.copy-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.copy-btn.copied {
  background: rgba(78, 205, 196, 0.3);
  border-color: var(--wheel-secondary);
}

.prize-expiry {
  font-size: 12px;
  color: var(--wheel-accent);
}

/* ============================================
   BUTTONS
   ============================================ */
.prize-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border-radius: var(--border-radius-sm);
  font-family: var(--font-family);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  outline: none;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.btn-primary {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-text);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-primary.success {
  background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
  color: white;
}

.btn-primary.error {
  animation: shake 0.3s ease;
}

.btn-secondary {
  background: var(--btn-secondary-bg);
  color: var(--btn-secondary-text);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.2);
}

/* ============================================
   NO PRIZE MODAL
   ============================================ */
.no-prize-modal-content .prize-header {
  margin-bottom: 16px;
}

.no-prize-modal-content .prize-body {
  color: var(--wheel-text-muted);
}

/* ============================================
   ERROR MODAL
   ============================================ */
.error-modal-content .prize-title {
  color: var(--wheel-accent);
}

/* ============================================
   SCREEN FLASH
   ============================================ */
@keyframes flash-fade {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

/* ============================================
   CONFETTI PARTICLE
   ============================================ */
.confetti-particle {
  position: absolute;
  pointer-events: none;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 480px) {
  .prize-wheel-container {
    padding: 10px;
  }
  
  .wheel-wrapper {
    max-width: var(--wheel-min-size);
  }
  
  .spin-button {
    width: 60px;
    height: 60px;
    font-size: 10px;
  }
  
  .spin-button .spin-icon {
    font-size: 16px;
  }
  
  .modal-content {
    padding: 24px;
  }
  
  .prize-title {
    font-size: 20px;
  }
  
  .prize-value {
    font-size: 28px;
  }
  
  .prize-code {
    font-size: 14px;
  }
}

@media (max-width: 360px) {
  .wheel-wrapper {
    max-width: 260px;
  }
  
  .spin-button {
    width: 50px;
    height: 50px;
  }
}

/* ============================================
   HIGH CONTRAST / ACCESSIBILITY
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus styles for keyboard navigation */
.spin-button:focus-visible,
.btn:focus-visible,
.copy-btn:focus-visible {
  outline: 3px solid var(--wheel-primary);
  outline-offset: 2px;
}

/* ============================================
   THEME VARIANTS
   ============================================ */

/* Modern Theme */
[data-theme="modern"] {
  --wheel-primary: #00cec9;
  --wheel-secondary: #0984e3;
  --wheel-accent: #fd79a8;
  --wheel-background: linear-gradient(135deg, #2d3436 0%, #636e72 100%);
  --modal-bg: #2d3436;
}

/* Festive Theme */
[data-theme="festive"] {
  --wheel-primary: #f1c40f;
  --wheel-secondary: #27ae60;
  --wheel-accent: #c0392b;
  --wheel-background: linear-gradient(135deg, #c0392b 0%, #27ae60 100%);
  --modal-bg: #1a3a1a;
}

/* Neon Theme */
[data-theme="neon"] {
  --wheel-primary: #ff00ff;
  --wheel-secondary: #00ffff;
  --wheel-accent: #ff6600;
  --wheel-background: linear-gradient(135deg, #0a0a0a 0%, #1a0a2e 100%);
  --modal-bg: #0a0a0a;
}
