/**
 * Game Framework Styles
 * 
 * Includes:
 * - Bubble (compact view in message thread)
 * - Modal (full-screen game)
 * - Toast notifications
 */

/* =============================================================================
   GAME BUBBLE - Compact view in message thread
   ============================================================================= */

.game-bubble {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 16px;
  padding: 12px 16px;
  color: white;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  max-width: 280px;
  margin: 8px 0;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.game-bubble:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.game-bubble:active {
  transform: scale(0.98);
}

.game-bubble-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-weight: 600;
}

.game-bubble-icon {
  font-size: 1.2em;
}

.game-bubble-name {
  font-size: 0.9em;
  opacity: 0.9;
}

.game-bubble-content {
  font-size: 0.95em;
  line-height: 1.4;
}

.game-bubble-status {
  font-weight: 600;
  margin-bottom: 4px;
}

.game-bubble-info {
  display: flex;
  gap: 12px;
  font-size: 0.85em;
  opacity: 0.85;
}

.game-bubble-tap {
  margin-top: 8px;
  font-size: 0.75em;
  opacity: 0.6;
  text-align: center;
}

/* Winner state */
.game-bubble.winner {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

/* Your turn state */
.game-bubble.my-turn {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(79, 172, 254, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(79, 172, 254, 0); }
}

/* Game over state */
.game-bubble.game-over {
  background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
  color: #333;
}

/* =============================================================================
   GAME MODAL - Full-screen game view
   ============================================================================= */

.game-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.game-modal.open {
  opacity: 1;
  visibility: visible;
}

.game-modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.game-modal-container {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 500px;
  max-height: 90vh;
  background: #1a1a2e;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.9) translateY(20px);
  transition: transform 0.3s ease;
  margin: 20px;
}

.game-modal.open .game-modal-container {
  transform: scale(1) translateY(0);
}

/* Mobile: full screen */
@media (max-width: 540px) {
  .game-modal-container {
    max-width: 100%;
    max-height: 100%;
    height: 100%;
    border-radius: 0;
    margin: 0;
  }
}

.game-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.game-modal-title {
  font-size: 1.2em;
  font-weight: 600;
  color: white;
}

.game-modal-close {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.5em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.game-modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.game-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
}

/* Prevent body scroll when modal open */
body.game-modal-open {
  overflow: hidden;
}

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

.game-toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: white;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 0.9em;
  z-index: 10001;
  animation: toast-in 0.3s ease;
}

.game-toast-error {
  background: #e53935;
}

.game-toast.fade-out {
  animation: toast-out 0.3s ease forwards;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateX(-50%) translateY(0); }
  to { opacity: 0; transform: translateX(-50%) translateY(-20px); }
}

/* =============================================================================
   GAME BOARD COMMON STYLES
   ============================================================================= */

.game-board {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
}

.game-status {
  text-align: center;
  padding: 12px 20px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: white;
  font-size: 1.1em;
}

.game-status.your-turn {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  color: #000;
  font-weight: 600;
}

.game-status.winner {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  font-weight: 600;
}

.game-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.game-btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.game-btn:active {
  transform: scale(0.95);
}

.game-btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.game-btn-primary:hover {
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.game-btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.game-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.2);
}

.game-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* VS Header */
.game-vs-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  width: 100%;
}

.game-player {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.game-player-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid transparent;
}

.game-player.active .game-player-avatar {
  border-color: #4facfe;
  box-shadow: 0 0 12px rgba(79, 172, 254, 0.5);
}

.game-player-name {
  font-size: 0.85em;
  color: rgba(255, 255, 255, 0.8);
}

.game-vs {
  font-size: 1.2em;
  font-weight: bold;
  color: rgba(255, 255, 255, 0.5);
}

/* =============================================================================
   GAME PICKER
   ============================================================================= */

.game-picker-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fade-in 0.2s ease;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.game-picker-menu {
  background: #1a1a2e;
  border-radius: 16px;
  padding: 20px;
  min-width: 250px;
  max-width: 90vw;
}

.game-picker-title {
  text-align: center;
  font-size: 1.1em;
  font-weight: 600;
  color: white;
  margin-bottom: 16px;
}

.game-picker-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 10px;
  color: white;
  font-size: 1em;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}

.game-picker-btn:last-child {
  margin-bottom: 0;
}

.game-picker-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

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

.game-picker-icon {
  font-size: 1.5em;
}

.game-picker-name {
  font-weight: 500;
}
