/**
 * PuttPoints Wager Modal & UI Styles
 * Implements psychological design principles for maximum engagement
 */

/* Modal Backdrop & Container */
.putt-points-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  padding: 20px;
}

.putt-points-modal-backdrop.active {
  opacity: 1;
}

.putt-points-modal-container {
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.putt-points-modal-backdrop.active .putt-points-modal-container {
  transform: scale(1);
}

.putt-points-modal-card {
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  border-radius: 20px;
  padding: 30px 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  position: relative;
}

/* Header */
.wager-modal-header {
  text-align: center;
  margin-bottom: 24px;
}

.wager-modal-title {
  font-size: 28px;
  font-weight: 800;
  color: #dc2626;
  margin: 0 0 8px 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  animation: pulse-warning 2s ease-in-out infinite;
}

@keyframes pulse-warning {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.85; }
}

.wager-modal-subtitle {
  font-size: 14px;
  color: #6b7280;
  font-weight: 500;
}

/* Your Stack Section (Endowment Effect Trigger) */
.your-stack-section {
  background: linear-gradient(135deg, #fef3c7 0%, #fde047 100%);
  border: 3px solid #facc15;
  border-radius: 16px;
  padding: 20px;
  text-align: center;
  margin-bottom: 24px;
  box-shadow: 0 4px 12px rgba(250, 204, 21, 0.25);
}

.stack-label {
  font-size: 12px;
  font-weight: 600;
  color: #92400e;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.stack-amount-display {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
}

.stack-amount {
  font-size: 42px;
  font-weight: 900;
  color: #92400e;
  line-height: 1;
  text-shadow: 0 2px 4px rgba(146, 64, 14, 0.1);
}

.stack-unit {
  font-size: 20px;
  font-weight: 700;
  color: #b45309;
}

.earned-reminder {
  font-size: 13px;
  color: #92400e;
  font-weight: 600;
  margin-top: 8px;
  font-style: italic;
}

/* Wager Options Container */
.wager-options-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.wager-option-btn {
  background: linear-gradient(135deg, #ffffff 0%, #f3f4f6 100%);
  border: 2px solid #d1d5db;
  border-radius: 12px;
  padding: 16px 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  text-align: left;
}

.wager-option-btn:hover {
  border-color: #10b981;
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.wager-option-btn:active {
  transform: translateY(0);
}

.wager-option-btn.extreme-risk {
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  border-color: #ef4444;
  animation: extreme-pulse 1.5s ease-in-out infinite;
}

@keyframes extreme-pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
  }
}

.wager-option-btn.extreme-risk:hover {
  border-color: #dc2626;
  background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
}

.wager-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.wager-badge.popular {
  background: #10b981;
  color: white;
}

.wager-badge.extreme {
  background: #ef4444;
  color: white;
  animation: badge-flash 1s ease-in-out infinite;
}

@keyframes badge-flash {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.wager-option-risk {
  font-size: 16px;
  font-weight: 700;
  color: #374151;
  margin-bottom: 4px;
}

.wager-option-win {
  font-size: 14px;
  font-weight: 600;
  color: #10b981;
}

/* Loss Handling Info */
.loss-handling-info {
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: #6b7280;
  margin-bottom: 16px;
  padding: 8px;
  background: #f3f4f6;
  border-radius: 8px;
}

.loss-handling-info .text-red-600 {
  color: #dc2626;
}

/* Skip Button */
.skip-wager-btn {
  width: 100%;
  background: #f3f4f6;
  border: 2px solid #d1d5db;
  border-radius: 10px;
  padding: 14px;
  font-size: 15px;
  font-weight: 600;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 16px;
}

.skip-wager-btn:hover {
  background: #e5e7eb;
  border-color: #9ca3af;
  color: #374151;
}

/* Countdown Timer */
.wager-timer {
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: #6b7280;
  padding: 12px;
  background: #f9fafb;
  border-radius: 8px;
}

.wager-timer.urgent {
  background: #fef2f2;
  color: #dc2626;
  animation: timer-urgent 0.5s ease-in-out infinite;
}

#wager-countdown.urgent {
  font-size: 18px;
  font-weight: 800;
}

@keyframes timer-urgent {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

/* Sticky Points Counter (Always Visible) */
.sticky-points-counter {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: linear-gradient(135deg, #fef3c7 0%, #fde047 100%);
  border-bottom: 3px solid #facc15;
  padding: 12px 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.points-player-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #fde047;
}

.points-player-row:last-child {
  border-bottom: none;
}

.points-player-name {
  font-weight: 600;
  color: #92400e;
  font-size: 14px;
}

.points-player-points {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.points-value {
  font-size: 20px;
  font-weight: 800;
  color: #92400e;
}

.points-unit {
  font-size: 12px;
  font-weight: 600;
  color: #b45309;
}

.points-rank {
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  margin-left: 8px;
}

/* Point Counter Animations (Psychological Feedback) */
@keyframes points-gain {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); color: #10b981; }
  100% { transform: scale(1); }
}

@keyframes points-loss {
  0% { transform: scale(1); }
  50% { transform: scale(0.9); color: #ef4444; }
  100% { transform: scale(1); }
}

.points-value.gaining {
  animation: points-gain 0.6s ease;
}

.points-value.losing {
  animation: points-loss 0.6s ease;
}

/* Screen Flash Effects */
@keyframes flash-green {
  0%, 100% { background-color: transparent; }
  50% { background-color: rgba(16, 185, 129, 0.2); }
}

@keyframes flash-red {
  0%, 100% { background-color: transparent; }
  50% { background-color: rgba(239, 68, 68, 0.3); }
}

.screen-flash-green {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 9999;
  animation: flash-green 0.5s ease;
}

.screen-flash-red {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 9999;
  animation: flash-red 0.5s ease;
}

/* Responsive Design */
@media (max-width: 640px) {
  .putt-points-modal-card {
    padding: 24px 16px;
  }

  .wager-modal-title {
    font-size: 24px;
  }

  .stack-amount {
    font-size: 36px;
  }

  .wager-option-btn {
    padding: 14px 16px;
  }

  .wager-option-risk {
    font-size: 15px;
  }
}

/* Feedback Modal Styles */
.feedback-modal {
  text-align: center;
  max-width: 480px;
  margin: 0 auto;
}

.feedback-title {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 16px;
  line-height: 1.2;
}

.feedback-modal.feedback-success .feedback-title {
  color: #10b981;
}

.feedback-modal.feedback-loss .feedback-title {
  color: #ef4444;
}

.feedback-modal.feedback-regret .feedback-title {
  color: #dc2626;
  animation: shake 0.5s ease;
}

.feedback-modal.feedback-near-miss .feedback-title {
  color: #f59e0b;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-10px); }
  75% { transform: translateX(10px); }
}

.feedback-message {
  margin: 20px 0;
  color: #374151;
  line-height: 1.6;
}

.feedback-button {
  width: 100%;
  padding: 16px;
  font-size: 16px;
  font-weight: 700;
  color: white;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 20px;
}

.feedback-button:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.feedback-button:active {
  transform: translateY(0);
}

/* Leaderboard Highlight Animations */
.leaderboard-winning {
  animation: highlight-green 2s ease;
}

.leaderboard-losing {
  animation: highlight-red 2s ease;
}

@keyframes highlight-green {
  0%, 100% { background-color: transparent; }
  50% { background-color: rgba(16, 185, 129, 0.2); }
}

@keyframes highlight-red {
  0%, 100% { background-color: transparent; }
  50% { background-color: rgba(239, 68, 68, 0.2); }
}

/* Toast Animations */
@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOutRight {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

/* Confetti fallback (if canvas-confetti not available) */
.confetti-particle {
  position: fixed;
  width: 10px;
  height: 10px;
  background: #10b981;
  pointer-events: none;
  z-index: 9999;
  animation: confetti-fall 3s linear forwards;
}

@keyframes confetti-fall {
  to {
    transform: translateY(100vh) rotate(360deg);
    opacity: 0;
  }
}

/* Game Summary Styles */
.feedback-modal.feedback-summary {
  max-width: 600px;
}

.feedback-modal.feedback-summary .feedback-title {
  color: #3b82f6;
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  .putt-points-modal-card {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    color: #f3f4f6;
  }

  .wager-option-btn {
    background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
    border-color: #4b5563;
    color: #f3f4f6;
  }

  .wager-option-btn:hover {
    background: linear-gradient(135deg, #065f46 0%, #064e3b 100%);
    border-color: #10b981;
  }

  .skip-wager-btn {
    background: #374151;
    border-color: #4b5563;
    color: #d1d5db;
  }

  .skip-wager-btn:hover {
    background: #4b5563;
    color: #f3f4f6;
  }

  .feedback-message {
    color: #d1d5db;
  }
}
