/* ============================================
   CASINO PAGE - Modern Notion-Style
   ============================================ */

/* Casino Page Container */
.casino-page {
  background: var(--bg-primary);
  min-height: 100vh;
  padding: var(--space-8) 0;
}

/* Casino Header */
.casino-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-8);
  background: var(--bg-secondary);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-primary);
  position: relative;
  overflow: hidden;
  margin-bottom: var(--space-8);
}

.casino-title {
  color: white;
  font-weight: 700;
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  margin: 0;
  z-index: 1;
  letter-spacing: -0.02em;
}

.coin-balance-display {
  z-index: 1;
}

/* Coin Pop Animation */
.coin-pop {
  animation: coinPop 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes coinPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* ============================================
   CASINO CARDS
   ============================================ */

.casino-card {
  border-radius: var(--radius-xl);
  transition: all var(--transition-base);
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  overflow: hidden;
  position: relative;
}

.casino-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
  border-color: var(--border-secondary);
}

.casino-card-header {
  text-align: center;
  padding: var(--space-6) var(--space-4);
}

/* ============================================
   COIN CLICKER
   ============================================ */

.coin-clicker-container {
  padding: var(--space-8) var(--space-4);
  min-height: 320px;
  height: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: visible;
}

.btn-coin-click {
  width: 270px;
  height: 270px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  box-shadow: 
    0 8px 32px rgba(245, 158, 11, 0.3),
    inset 0 -6px 20px rgba(0, 0, 0, 0.2),
    inset 0 6px 20px rgba(255, 255, 255, 0.1);
  cursor: pointer;
  transition: all var(--transition-base);
  position: relative;
  overflow: visible;
}

.btn-coin-click::before {
  content: '';
  position: absolute;
  inset: -20px;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.15) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
  animation: goldPulse 3s ease-in-out infinite;
}

@keyframes goldPulse {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.05); }
}

.btn-coin-click:hover {
  transform: scale(1.08);
  box-shadow: 
    0 12px 40px rgba(245, 158, 11, 0.4),
    inset 0 -6px 20px rgba(0, 0, 0, 0.25),
    inset 0 6px 20px rgba(255, 255, 255, 0.15);
}

.btn-coin-click:active {
  transform: scale(0.92);
  box-shadow: 
    0 4px 16px rgba(245, 158, 11, 0.3),
    inset 0 6px 20px rgba(0, 0, 0, 0.3);
}

.btn-coin-click:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Mobile touch improvements */
@media (hover: none) and (pointer: coarse) {
  .btn-coin-click {
    /* Remove hover effects on touch devices */
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
  }
  
  .btn-coin-click:hover {
    /* Reset hover on touch devices */
    transform: scale(1);
  }
}

.coin-icon {
  font-size: 7rem;
  line-height: 1;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
}

/* Coin Click Pulse Animation */
.coin-click-pulse {
  animation: clickPulse 0.2s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes clickPulse {
  0% { transform: scale(1); }
  50% { transform: scale(0.88); }
  100% { transform: scale(1); }
}

.click-instruction {
  margin-top: var(--space-6);
  font-size: 1.125rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Floating Coin Animation */
.floating-coin {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.75rem;
  font-weight: 700;
  color: #f59e0b;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  pointer-events: none;
  animation: floatUp 1.2s ease-out forwards;
  z-index: 100;
  will-change: transform, opacity;
}

@keyframes floatUp {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) translateX(var(--random-x, 0)) translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) translateX(var(--random-x, 0)) translateY(-120px) scale(1.5);
  }
}

/* Streak Display */
.streak-display {
  position: absolute;
  top: -80px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  font-size: 1.75rem;
  font-weight: 800;
  color: #f59e0b;
  opacity: 0;
  pointer-events: none;
  transition: all var(--transition-base);
  z-index: 102;
  white-space: nowrap;
}

.streak-display.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.streak-display.mega-streak {
  font-size: 2.5rem;
  color: #fbbf24;
  animation: megaStreakPulse 0.5s ease-in-out infinite;
  text-shadow: 0 0 20px rgba(245, 158, 11, 0.6);
}

@keyframes megaStreakPulse {
  0%, 100% { transform: translateX(-50%) translateY(0) scale(1); }
  50% { transform: translateX(-50%) translateY(0) scale(1.1); }
}

/* Mega Click Animation */
.btn-coin-click.mega-click {
  animation: megaClick 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes megaClick {
  0%, 100% { transform: scale(1) rotate(0deg); }
  25% { transform: scale(0.88) rotate(-8deg); }
  75% { transform: scale(1.15) rotate(8deg); }
}

/* Screen Shake Effect - Only applied to coin clicker container */
.coin-clicker-container.screen-shake {
  animation: screenShake 0.4s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes screenShake {
  10%, 90% { transform: translate3d(-1px, 0, 0); }
  20%, 80% { transform: translate3d(2px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-3px, 0, 0); }
  40%, 60% { transform: translate3d(3px, 0, 0); }
}

/* Coin Stats */
.coin-stats {
  display: flex;
  gap: var(--space-6);
  justify-content: center;
  margin-top: var(--space-8);
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-4) var(--space-6);
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-primary);
  min-width: 120px;
}

.stat-label {
  font-size: 0.875rem;
  color: var(--text-tertiary);
  margin-bottom: var(--space-2);
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-primary);
}

/* ============================================
   SLOT MACHINE
   ============================================ */

.slot-machine-container {
  background: var(--bg-elevated);
  border-radius: var(--radius-xl);
  padding: var(--space-8) var(--space-6);
  border: 1px solid var(--border-primary);
  position: relative;
  overflow: hidden;
  margin-bottom: var(--space-6);
}

.slot-display {
  display: flex;
  justify-content: center;
  gap: var(--space-4);
  min-height: 100px;
  align-items: center;
}

.slot-symbol {
  font-size: 3rem;
  background: var(--bg-surface);
  padding: var(--space-4) var(--space-6);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-primary);
  min-width: 80px;
  text-align: center;
}

.slot-reel {
  font-size: 3rem;
  background: var(--bg-surface);
  padding: var(--space-4) var(--space-6);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-primary);
  min-width: 80px;
  text-align: center;
}

/* Spinning Animation */
.slot-machine-container.spinning .slot-reel {
  animation: spinReel 0.3s linear infinite;
}

@keyframes spinReel {
  0% { transform: translateY(0); opacity: 1; }
  50% { transform: translateY(-15px); opacity: 0.6; }
  100% { transform: translateY(0); opacity: 1; }
}

.slot-reels {
  display: flex;
  justify-content: center;
  gap: var(--space-4);
}

/* Slot Result Animations */
.slot-result {
  display: flex;
  justify-content: center;
  gap: var(--space-4);
  animation: revealResult 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes revealResult {
  0% { transform: scale(0.8); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.slot-result.win .slot-symbol {
  animation: winSymbol 0.6s ease-in-out infinite;
  border-color: var(--success);
}

@keyframes winSymbol {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.slot-result.lose .slot-symbol {
  opacity: 0.5;
}

/* ============================================
   GAMBLING FORM
   ============================================ */

.gambling-form {
  padding: var(--space-4) 0;
}

.quick-bet-buttons {
  display: flex;
  gap: var(--space-2);
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.quick-bet-buttons .btn {
  flex: 1;
  transition: all var(--transition-fast);
  font-size: 0.875rem;
  padding: var(--space-2) var(--space-3);
}

.quick-bet-buttons .btn:hover {
  transform: translateY(-1px);
}

.btn-gambling {
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
  border: none;
  color: white;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.btn-gambling:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-lg);
}

.btn-gambling:active {
  transform: scale(0.98);
}

.btn-gambling:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Game Info */
.game-info {
  display: flex;
  justify-content: space-around;
  gap: var(--space-4);
  margin-top: var(--space-4);
}

.info-box {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-primary);
  flex: 1;
  justify-content: center;
}

.info-icon {
  font-size: 1.25rem;
}

.info-text {
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

/* ============================================
   RESULT ANIMATIONS
   ============================================ */

.result-container {
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition-slow);
}

.result-container.show {
  opacity: 1;
}

.result-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-primary);
  padding: var(--space-8);
  box-shadow: var(--shadow-xl);
  text-align: center;
  min-width: 360px;
  max-width: 90%;
  animation: resultSlideIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  position: relative;
  overflow: hidden;
}

@keyframes resultSlideIn {
  0% {
    transform: translateY(-60px) scale(0.8);
    opacity: 0;
  }
  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.result-emoji {
  font-size: 4rem;
  animation: emojiZoom 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  margin-bottom: var(--space-4);
}

@keyframes emojiZoom {
  0% { transform: scale(0); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

.result-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: var(--space-6);
  letter-spacing: -0.01em;
}

.win-result {
  border: 2px solid var(--success);
}

.win-result .result-title {
  color: var(--success);
}

.lose-result {
  border: 2px solid var(--border-secondary);
}

.lose-result .result-title {
  color: var(--text-secondary);
}

.result-details {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  font-size: 1.125rem;
}

.bet-info, .payout-info, .loss-info, .net-info {
  padding: var(--space-3);
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-primary);
}

.amount {
  font-weight: 700;
  font-size: 1.25rem;
}

.amount.win {
  color: var(--success);
}

.amount.lose {
  color: var(--error);
}

.encouragement {
  font-style: italic;
  color: var(--text-tertiary);
  margin-top: var(--space-2);
  font-size: 0.9375rem;
}

/* ============================================
   BONUS CARDS
   ============================================ */

.bonus-card {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-6);
  border-radius: var(--radius-lg);
  transition: all var(--transition-base);
  border: 1.5px solid transparent;
}

.bonus-card.available {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.3);
}

.bonus-card.available:hover {
  transform: translateY(-2px);
  border-color: var(--success);
}

.bonus-card.claimed {
  background: var(--bg-tertiary);
  border-color: var(--border-primary);
  opacity: 0.7;
}

.bonus-icon {
  flex-shrink: 0;
}

.bonus-content {
  flex: 1;
}

/* ============================================
   SHOP ITEMS
   ============================================ */

.shop-item-card {
  transition: all var(--transition-base);
  cursor: pointer;
  border: 1.5px solid var(--border-primary);
}

.shop-item-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-hover);
}

/* Empty States */
.empty-state {
  text-align: center;
  padding: var(--space-12) var(--space-6);
}

.empty-icon {
  font-size: 3.5rem;
  margin-bottom: var(--space-4);
  opacity: 0.4;
}

.empty-state-small {
  padding: var(--space-8) var(--space-4);
}

/* Purchase List */
.purchase-list {
  max-height: 560px;
  overflow-y: auto;
}

.purchase-item {
  padding: var(--space-4);
  border-bottom: 1px solid var(--border-primary);
  transition: background var(--transition-fast);
}

.purchase-item:hover {
  background: var(--bg-elevated);
}

.purchase-item:last-child {
  border-bottom: none;
}

.purchase-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: var(--space-2);
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
  .btn-coin-click {
    width: 200px;
    height: 200px;
  }

  .coin-icon {
    font-size: 5rem;
  }
  
  .streak-display {
    top: -60px;
    font-size: 1.25rem;
  }
  
  .streak-display.mega-streak {
    font-size: 1.75rem;
  }

  .result-container {
    min-height: auto;
    padding: var(--space-4);
  }

  .result-card {
    min-width: auto;
    width: 100%;
    max-width: 100%;
    padding: var(--space-6) var(--space-4);
    box-sizing: border-box;
  }

  .result-title {
    font-size: 1.5rem;
    margin-bottom: var(--space-4);
  }

  .result-emoji {
    font-size: 3rem;
    margin-bottom: var(--space-3);
  }

  .result-details {
    gap: var(--space-2);
    font-size: 1rem;
  }

  .bet-info, .payout-info, .loss-info, .net-info {
    padding: var(--space-2) var(--space-3);
    font-size: 0.9rem;
  }

  .amount {
    font-size: 1rem;
  }

  .slot-symbol, .slot-reel {
    font-size: 2.25rem;
    min-width: 60px;
    padding: var(--space-3) var(--space-4);
  }

  .quick-bet-buttons {
    flex-wrap: wrap;
  }

  .quick-bet-buttons .btn {
    flex: 0 0 48%;
  }

  .game-info {
    flex-direction: column;
    gap: var(--space-3);
  }

  .info-box {
    flex-direction: column;
    padding: var(--space-3) var(--space-2);
  }

  .info-icon {
    font-size: 1rem;
  }

  .info-text {
    font-size: 0.8rem;
  }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

@media (prefers-reduced-motion: reduce) {
  .btn-coin-click,
  .slot-reel,
  .result-card,
  .floating-coin {
    animation: none !important;
    transition: none !important;
  }
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */

.casino-toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: var(--space-4) var(--space-6);
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  color: var(--text-primary);
  font-weight: 500;
  z-index: 9999;
  opacity: 0;
  transform: translateY(100px);
  transition: all var(--transition-base);
  pointer-events: auto;
}

.casino-toast.show {
  opacity: 1;
  transform: translateY(0);
}

.casino-toast.success {
  border-color: var(--success);
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
}

.casino-toast.error {
  border-color: var(--error);
  background: rgba(239, 68, 68, 0.1);
  color: var(--error);
}

/* Mobile Toast Positioning */
@media (max-width: 768px) {
  .casino-toast {
    bottom: 16px;
    right: 16px;
    left: 16px;
    padding: var(--space-3) var(--space-4);
    font-size: 0.9375rem;
  }
}

/* ============================================
   POLYMARKET-STYLE CARDS
   ============================================ */

.market-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  transition: all var(--transition-base);
  cursor: pointer;
  overflow: visible;
  position: relative;
}

.market-card:hover {
  border-color: var(--border-secondary);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.market-card-header {
  margin-bottom: var(--space-4);
}

.market-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
  line-height: 1.4;
}

.market-category {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  background: var(--bg-elevated);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-2);
}

.market-deadline {
  font-size: 0.875rem;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* Probability Display */
.probability-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.outcome {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.outcome-label {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.outcome-probability {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
}

.probability-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
}

.probability-percent {
  font-size: 1rem;
  color: var(--text-tertiary);
}

.probability-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-elevated);
  border-radius: 999px;
  overflow: hidden;
  margin-top: var(--space-2);
}

.probability-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-gold) 0%, #fbbf24 100%);
  border-radius: 999px;
  transition: width var(--transition-base);
}

/* Buy/Sell Interface */
.trading-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

.trade-option {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.trade-button {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  border: none;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all var(--transition-base);
  width: 100%;
  min-height: 48px;
}

.trade-button.yes {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
}

.trade-button.yes:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.trade-button.no {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
}

.trade-button.no:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.trade-price {
  font-size: 0.875rem;
  color: var(--text-tertiary);
  text-align: center;
}

/* Market Stats */
.market-stats {
  display: flex;
  gap: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-primary);
  font-size: 0.875rem;
  color: var(--text-tertiary);
}

.stat {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.stat-label {
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.75rem;
}

.stat-value {
  color: var(--text-secondary);
  font-weight: 600;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 1024px) {
  .market-card {
    padding: var(--space-5);
  }

  .probability-container {
    gap: var(--space-3);
  }
}

/* Markets Grid - Responsive */
.markets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  gap: var(--space-4);
  width: 100%;
  max-width: 100%;
}

@media (max-width: 768px) {
  .markets-grid {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }

  .market-card {
    padding: var(--space-4);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .market-title {
    font-size: 1.125rem;
  }

  .probability-container {
    grid-template-columns: 1fr 1fr;
    margin-bottom: var(--space-4);
    gap: var(--space-3);
  }

  .probability-value {
    font-size: 1.5rem;
  }

  .trading-section {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
  }

  .trade-button {
    padding: var(--space-2) var(--space-3);
    font-size: 0.875rem;
    min-height: 44px;
  }

  .market-stats {
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  .stat {
    flex: 1 0 calc(50% - var(--space-2));
  }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
  .casino-page {
    background: white;
  }

  .btn-coin-click,
  .btn-gambling {
    display: none;
  }
}
