/* ============================================
   GAMES PAGE STYLES
   ============================================ */

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

/* Games Header */
.games-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);
}

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

/* Tab Styles */
.nav-tabs {
  border-bottom: 2px solid var(--border-primary);
  margin-bottom: var(--space-6);
}

.nav-tabs .nav-link {
  color: var(--text-secondary);
  border: none;
  border-bottom: 3px solid transparent;
  padding: var(--space-4) var(--space-6);
  font-weight: 600;
  transition: all var(--transition-base);
}

.nav-tabs .nav-link:hover {
  color: var(--text-primary);
  border-color: var(--border-secondary);
}

.nav-tabs .nav-link.active {
  color: var(--accent-primary);
  background: transparent;
  border-color: var(--accent-primary);
}

/* Game Card */
.game-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-primary);
  transition: all var(--transition-base);
}

.game-info-header {
  text-align: center;
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border-primary);
}

/* Betting Card */
.betting-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-primary);
  position: sticky;
  top: 20px;
}

/* ============================================
   CRASH GAME STYLES
   ============================================ */

.crash-graph-container {
  position: relative;
  background: linear-gradient(135deg, #1a2c3d 0%, #0f1a24 100%);
  border-radius: 0;
  padding: 0;
  min-height: 500px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.crash-graph-container canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Large Multiplier Display */
.multiplier-display-large {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 100;
  text-align: center;
  pointer-events: none;
}

.multiplier-display-large .multiplier-value {
  font-size: 5rem;
  font-weight: 800;
  color: #10b981;
  text-shadow: 
    0 0 40px rgba(16, 185, 129, 0.8),
    0 0 80px rgba(16, 185, 129, 0.4);
  display: block;
  line-height: 1;
  margin-bottom: 0.5rem;
  transition: all 0.1s ease-out;
}

.rocket-emoji {
  font-size: 3rem;
  filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.6));
  animation: rocketFloat 2s ease-in-out infinite;
}

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

/* Y-Axis Labels */
.y-axis-labels {
  position: absolute;
  left: 10px;
  top: 20px;
  bottom: 60px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
  z-index: 10;
}

.y-axis-labels span {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.875rem;
  font-weight: 600;
}

/* X-Axis Labels */
.x-axis-labels {
  position: absolute;
  bottom: 20px;
  left: 60px;
  right: 20px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
  z-index: 10;
}

.x-axis-labels span {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.875rem;
  font-weight: 600;
}

/* Game Action Buttons - Right by the game */
.game-action-buttons {
  position: relative;
  z-index: 10;
}

.game-action-buttons .btn-lg {
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
}

.game-action-buttons .btn-lg:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.game-action-buttons .btn-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border: none;
}

.game-action-buttons .btn-warning {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  border: none;
  color: white;
}

.crash-graph-container.crashed {
  animation: crashFlash 0.3s ease-out;
}

@keyframes crashFlash {
  0%, 100% { background: linear-gradient(135deg, #1a2c3d 0%, #0f1a24 100%); }
  50% { background: linear-gradient(135deg, #7f1d1d 0%, #450a0a 100%); }
}

.crash-message {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 3rem;
  font-weight: 800;
  color: #ef4444;
  text-shadow: 
    0 0 30px rgba(239, 68, 68, 1),
    0 0 60px rgba(239, 68, 68, 0.5);
  z-index: 300;
  display: none;
  animation: crashMessageBounce 0.6s ease-out;
  text-align: center;
  pointer-events: none;
  max-width: 90%;
  word-wrap: break-word;
}

@keyframes crashMessageBounce {
  0% { 
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
  }
  50% { 
    transform: translate(-50%, -50%) scale(1.2);
  }
  100% { 
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
}

/* ============================================
   BATTLESHIP GAME STYLES
   ============================================ */

.battleship-grid-container {
  display: flex;
  justify-content: center;
  margin: var(--space-4) 0;
}

.battleship-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  background: var(--bg-elevated);
  padding: var(--space-3);
  border-radius: var(--radius-lg);
  border: 2px solid var(--border-primary);
  max-width: 400px;
  width: 100%;
}

.battleship-cell {
  aspect-ratio: 1;
  background: var(--bg-secondary);
  border: 2px solid var(--border-primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  cursor: pointer;
  transition: all var(--transition-base);
  position: relative;
}

.battleship-cell:hover {
  background: var(--bg-elevated);
  transform: scale(1.05);
  border-color: var(--accent-primary);
}

.battleship-cell.ship {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  border-color: #1e40af;
}

.battleship-cell.ship-placed {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border-color: #047857;
}

.battleship-cell.hit {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  border-color: #b91c1c;
}

.battleship-cell.miss {
  background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
  border-color: #374151;
}

.battleship-cell.pending {
  background: linear-gradient(135deg, #4b5563 0%, #374151 100%);
  border-color: #6b7280;
  opacity: 0.6;
  cursor: not-allowed !important;
  position: relative;
  animation: pulse-pending 1.5s ease-in-out infinite;
}

.battleship-cell.pending::after {
  content: "⏳";
  position: absolute;
  font-size: 1.2rem;
}

@keyframes pulse-pending {
  0%, 100% {
    opacity: 0.6;
  }
  50% {
    opacity: 0.4;
  }
}

.battleship-cell:disabled,
.battleship-cell[disabled] {
  cursor: not-allowed;
  opacity: 0.6;
}

/* Green outline highlight when it's your turn */
.your-turn-highlight {
  border: 4px solid #10b981 !important;
  border-radius: var(--radius-lg);
  padding: 12px;
  background: rgba(16, 185, 129, 0.05);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
  animation: pulse-green 2s ease-in-out infinite;
}

@keyframes pulse-green {
  0%, 100% {
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
  }
  50% {
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.5);
  }
}

.battleship-status {
  min-height: 60px;
  margin-bottom: var(--space-4);
}

.battleship-waiting,
.battleship-available-games,
.battleship-placement,
.battleship-play {
  padding: var(--space-4);
}

.battleship-available-games .list-group-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  margin-bottom: var(--space-2);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
}

.battleship-available-games .list-group-item:hover {
  background: var(--bg-elevated);
  border-color: var(--accent-primary);
}

/* ============================================
   BLACKJACK GAME STYLES
   ============================================ */

.blackjack-section {
  padding: var(--space-6);
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-primary);
}

.dealer-section {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(147, 51, 234, 0.1) 100%);
}

.player-section {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(5, 150, 105, 0.1) 100%);
}

.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.title-icon {
  font-size: 1.75rem;
}

.hand-value {
  font-size: 1.25rem;
  color: var(--accent-primary);
  margin-left: auto;
  font-weight: 600;
}

.card-hand {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  min-height: 120px;
  align-items: center;
  justify-content: center;
}

.empty-hand {
  color: var(--text-tertiary);
  font-style: italic;
  text-align: center;
  padding: var(--space-8);
}

.playing-card {
  width: 80px;
  height: 112px;
  background: white;
  border-radius: var(--radius-md);
  border: 2px solid var(--border-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  box-shadow: var(--shadow-md);
  transition: all var(--transition-base);
  animation: dealCard 0.3s ease-out;
}

@keyframes dealCard {
  0% {
    transform: translateY(-100px) rotate(-180deg);
    opacity: 0;
  }
  100% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
}

.playing-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-lg);
}

.card-back {
  background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  color: white;
  font-size: 3rem;
}

/* ============================================
   SHARED GAME ELEMENTS
   ============================================ */

.game-status {
  margin-top: var(--space-4);
  min-height: 60px;
}

.game-status .alert {
  margin: 0;
  animation: slideIn 0.3s ease-out;
}

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

.game-info {
  padding: var(--space-4);
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-primary);
}

.game-info h6 {
  color: var(--text-primary);
  font-weight: 700;
  margin-bottom: var(--space-3);
}

.info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border-primary);
}

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

.info-label {
  color: var(--text-secondary);
  font-weight: 500;
}

.info-value {
  color: var(--accent-primary);
  font-weight: 700;
}

.how-to-play {
  padding: var(--space-4);
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-primary);
}

.how-to-play h6 {
  color: var(--text-primary);
  font-weight: 700;
  margin-bottom: var(--space-3);
}

.how-to-play ul {
  margin: 0;
  padding-left: var(--space-5);
}

.how-to-play li {
  margin-bottom: var(--space-2);
  line-height: 1.5;
}

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

@media (max-width: 768px) {
  .games-header {
    flex-direction: column;
    gap: var(--space-4);
    text-align: center;
    padding: var(--space-6);
  }

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

  .nav-tabs .nav-link {
    padding: var(--space-3) var(--space-4);
    font-size: 0.875rem;
  }

  .crash-display {
    min-height: 300px;
    padding: var(--space-4);
  }

  .multiplier-value {
    font-size: 2.5rem;
  }

  .rocket {
    font-size: 3rem;
  }

  .crash-message {
    font-size: 1.75rem;
  }

  .playing-card {
    width: 60px;
    height: 84px;
    font-size: 1.5rem;
  }

  .section-title {
    font-size: 1.25rem;
  }

  .card-hand {
    min-height: 90px;
  }

  .betting-card {
    position: relative;
    top: 0;
  }
}

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

@media (prefers-reduced-motion: reduce) {
  .rocket-container,
  .crash-display,
  .playing-card,
  .crash-message {
    animation: none !important;
    transition: none !important;
  }

  .rocket-trail {
    animation: none !important;
  }
}

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

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

  .betting-card,
  button {
    display: none;
  }
}

