/**
 * Fortunio Flip Microgame Component Styles
 * 
 * Card-based reveal game with progressive multipliers.
 * Mobile-first responsive design supporting left-hand play.
 */

:root {
  /* Layout */
  --flip-card-size: 80px;
  --flip-card-gap: 12px;
  --flip-border-radius: 12px;
  
  /* Safe zone colors */
  --flip-safe-color: #28a745;
  --flip-danger-color: #dc3545;
  --flip-warning-color: #ffc107;
}

/* ============================================
   Page Container
   ============================================ */

.flip-page {
  max-width: 600px;
  margin: 0 auto;
  padding: 16px;
}

/* Info button in navbar (matches Yatzy pattern) */
.flip-info-btn {
  margin-left: 0.5rem;
  font-size: 1.1rem;
  color: #d6d6d6 !important;
  opacity: 0.75;
  text-decoration: none;
  transition: opacity 0.2s;
}

.flip-info-btn:hover {
  opacity: 1;
  color: #e8e8e8 !important;
}

/* ============================================
   Difficulty Selection Screen
   ============================================ */

.flip-difficulty-section {
  padding: 20px 0;
}

.flip-difficulty-section h2 {
  color: #333;
  font-weight: 600;
}

.flip-difficulty-section .btn-group-vertical .btn {
  text-align: left;
  border-radius: var(--flip-border-radius) !important;
  margin-bottom: 8px;
  padding: 16px 20px;
  transition: all 0.2s ease;
}

.flip-difficulty-section .btn-group-vertical .btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* ============================================
   Game Area
   ============================================ */

.flip-game-area {
  padding: 20px 0;
}

/* ============================================
   Status Display
   ============================================ */

.flip-status {
  margin-bottom: 20px;
}

.flip-stat {
  text-align: center;
  min-width: 100px;
}

.flip-stat-label {
  font-size: 12px;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.flip-stat-value {
  font-size: 28px;
  font-weight: 700;
  color: #333;
}

/* ============================================
   Deck Area & Cards Container
   ============================================ */

.flip-deck-area {
  display: flex;
  justify-content: center;
  padding: 20px 0;
}

.flip-deck {
  width: 100%;
}

/* Cards grid container (generated by JS) */
.flip-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--flip-card-gap);
  justify-items: center;
  max-width: 400px;
  margin: 0 auto;
}

@media (max-width: 400px) {
  .flip-cards {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ============================================
   Card Styles (structure in flip-animation-tiers.css)
   ============================================ */

/* Clickable unrevealed card */
.flip-anim-card.flip-card-clickable {
  cursor: pointer;
}

/* Card being processed (waiting for API response) */
.flip-anim-card.flip-anim-processing {
  cursor: wait;
  opacity: 0.7;
  animation: flip-card-pulse 0.8s ease-in-out infinite;
}

@keyframes flip-card-pulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

/* ============================================
   Action Buttons
   ============================================ */

.flip-actions {
  margin-top: 20px;
}

.flip-btn-reveal,
.flip-btn-collect {
  min-width: 140px;
  padding: 14px 28px;
  font-size: 16px;
  font-weight: 600;
  border-radius: var(--flip-border-radius);
  transition: all 0.2s ease;
}

.flip-btn-reveal:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(13, 110, 253, 0.4);
}

.flip-btn-collect:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

.flip-btn-reveal:disabled,
.flip-btn-collect:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============================================
   Status Message
   ============================================ */

.flip-message {
  min-height: 24px;
  font-size: 14px;
}

/* ============================================
   Result Screen
   ============================================ */

.flip-result-section {
  padding: 20px 0;
}

.flip-result-icon {
  margin-bottom: 16px;
}

.flip-result-icon.text-success {
  animation: flip-bounce 0.6s ease;
}

.flip-result-icon.text-danger {
  animation: flip-bust-shake 0.5s ease;
}

/* Awarded FP Display */
.flip-awarded-fp {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 48px;
  font-weight: 700;
  color: var(--flip-warning-color);
  margin: 16px 0;
}

.flip-fp-amount {
  color: var(--flip-warning-color);
}

.flip-fp-label {
  font-size: 24px;
  color: #666;
  font-weight: 600;
}

/* ============================================
   Animations
   ============================================ */

@keyframes flip-bounce {
  0%, 100% { transform: scale(1); }
  30% { transform: scale(1.15); }
  50% { transform: scale(0.95); }
  70% { transform: scale(1.05); }
}

@keyframes flip-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.flip-pulse {
  animation: flip-pulse 1.5s ease infinite;
}

/* ============================================
   Loading State
   ============================================ */

#loadingState {
  text-align: center;
  padding: 60px 20px;
}

#loadingState .spinner-border {
  width: 3rem;
  height: 3rem;
}

/* ============================================
   Responsive Adjustments
   ============================================ */

@media (max-width: 360px) {
  :root {
    --flip-card-size: 65px;
    --flip-card-gap: 8px;
  }
  
  .flip-stat-value {
    font-size: 22px;
  }
  
  .flip-btn-reveal,
  .flip-btn-collect {
    padding: 12px 20px;
    font-size: 14px;
    min-width: 110px;
  }
}

@media (min-width: 500px) {
  :root {
    --flip-card-size: 90px;
  }
}

/* ============================================
   Dark Mode Support
   ============================================ */

@media (prefers-color-scheme: dark) {
  .flip-page {
    color: #e9ecef;
  }
  
  .flip-stat-value {
    color: #fff;
  }
  
  .flip-stat-label {
    color: #adb5bd;
  }
  
  .flip-difficulty-section h2 {
    color: #fff;
  }
  
  .flip-fp-label {
    color: #adb5bd;
  }
}
