/**
 * Game List View Styles
 * Heavy Metal Main Event Aesthetic
 */

/* Game View Container */
#gameView {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Game Controls Header */
.game-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* Filter Buttons */
.game-filter-btn {
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-primary);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.game-filter-btn:hover {
  background: var(--bg-card);
  border-color: var(--accent-game);
  color: var(--text-primary);
}

.game-filter-btn.active {
  background: linear-gradient(135deg, var(--accent-game), #10b981);
  border-color: var(--accent-game);
  color: white;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

/* Game List Container */
.game-list-container {
  position: relative;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
}

/* Animated background bokeh effect */
.game-list-container::before {
  content: '';
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 600px 400px at 20% 30%, rgba(58, 127, 213, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse 500px 350px at 80% 70%, rgba(124, 58, 237, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse 450px 300px at 50% 50%, rgba(5, 150, 105, 0.05) 0%, transparent 50%);
  background-size: 100% 100%;
  animation: bokehShift 20s ease-in-out infinite;
}

@keyframes bokehShift {
  0%, 100% {
    background-position: 0% 0%, 100% 100%, 50% 50%;
    opacity: 1;
  }
  25% {
    background-position: 10% 20%, 90% 80%, 45% 55%;
    opacity: 0.8;
  }
  50% {
    background-position: 20% 10%, 80% 90%, 55% 45%;
    opacity: 1;
  }
  75% {
    background-position: 5% 15%, 95% 85%, 50% 50%;
    opacity: 0.9;
  }
}

/* Game Grid */
.game-grid {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

/* Game Card - Main Event Poster */
.game-card {
  position: relative;
  background: linear-gradient(135deg, rgba(58, 127, 213, 0.03) 0%, rgba(0, 0, 0, 0.3) 100%);
  border: 2px solid var(--border-subtle);
  border-radius: 4px;
  padding: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  overflow: hidden;
}

/* Shine effect behind cards */
.game-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse 80% 50% at 50% 50%,
    rgba(58, 127, 213, 0.15) 0%,
    rgba(124, 58, 237, 0.1) 30%,
    transparent 70%
  );
  pointer-events: none;
  z-index: 0;
  opacity: 0.6;
}

.game-card:hover::after {
  opacity: 1;
}

/* Animated gradient border on hover */
.game-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 4px;
  padding: 2px;
  background: linear-gradient(
    135deg,
    #3a7fd5 0%,
    #7c3aed 25%,
    #059669 50%,
    #7c3aed 75%,
    #3a7fd5 100%
  );
  background-size: 200% 200%;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.3s ease;
  animation: borderShift 4s ease infinite;
  z-index: 1;
}

@keyframes borderShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.game-card:hover::before {
  opacity: 0.6;
}

.game-card:hover {
  background: linear-gradient(135deg, rgba(58, 127, 213, 0.08) 0%, rgba(124, 58, 237, 0.05) 50%, rgba(0, 0, 0, 0.4) 100%);
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(124, 58, 237, 0.3);
  border-color: rgba(124, 58, 237, 0.5);
}

/* Status Badge - Upper Left Corner */
.game-status-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: 3px;
  white-space: nowrap;
}

.status-draft {
  background: linear-gradient(135deg, #6b7280 0%, #9ca3af 100%);
  color: white;
}

.status-pending {
  background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
  color: white;
}

.status-playing {
  background: linear-gradient(135deg, var(--accent-game) 0%, #10b981 100%);
  color: white;
  animation: pulse-playing 2s ease-in-out infinite;
}

@keyframes pulse-playing {
  0%, 100% {
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
  }
  50% {
    box-shadow: 0 2px 12px rgba(16, 185, 129, 0.6);
  }
}

.status-complete {
  background: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%);
  color: white;
}

.status-error {
  background: linear-gradient(135deg, #ef4444 0%, #f87171 100%);
  color: white;
}

/* Main Event Arena - Head to Head */
.game-main-event {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
  margin-bottom: 0;
  padding: 0;
}

/* Player Section */
.game-player-side {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}

.game-player-side.left {
  align-items: flex-end;
  text-align: right;
}

.game-player-side.right {
  align-items: flex-start;
  text-align: left;
}

/* Player Info Wrapper - Contains name and deck, overlays cards */
.game-player-info {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: -14px;
  pointer-events: none;
  max-width: 100%;
}

.game-player-side.left .game-player-info {
  align-items: flex-end;
  text-align: right;
}

.game-player-side.right .game-player-info {
  align-items: flex-start;
  text-align: left;
}

/* Heavy Metal Player Name - Overlays top of cards */
.game-player-name-metal {
  position: relative;
  font-size: 28px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 2px;
  line-height: 1;
  margin: 0;
  padding: 0 8px;
  color: white;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;

  /* Darker shadows with multi-color glow */
  text-shadow:
    0 0 10px rgba(58, 127, 213, 0.9),
    0 0 20px rgba(124, 58, 237, 0.7),
    0 0 30px rgba(5, 150, 105, 0.5),
    0 2px 8px rgba(0, 0, 0, 0.9),
    0 4px 20px rgba(0, 0, 0, 0.8),
    0 0 40px rgba(124, 58, 237, 0.4);

  transition: text-shadow 0.3s ease;
}

.game-card:hover .game-player-name-metal {
  text-shadow:
    0 0 14px rgba(58, 127, 213, 1),
    0 0 28px rgba(124, 58, 237, 0.8),
    0 0 40px rgba(5, 150, 105, 0.6),
    0 2px 10px rgba(0, 0, 0, 0.95),
    0 6px 24px rgba(0, 0, 0, 0.85),
    0 0 60px rgba(124, 58, 237, 0.5);
}

/* Deck Name - Under player name, both overlay cards */
.game-player-deck-name {
  position: relative;
  font-size: 11px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.9);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0;
  padding: 0 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow:
    0 1px 3px rgba(0, 0, 0, 1),
    0 2px 6px rgba(0, 0, 0, 1),
    0 3px 9px rgba(0, 0, 0, 0.95),
    0 4px 12px rgba(0, 0, 0, 0.9),
    0 6px 18px rgba(0, 0, 0, 0.85),
    0 0 20px rgba(0, 0, 0, 0.8);
}

/* VS Divider - Bold Heavy Metal with Flowy Border */
.game-vs-divider {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.5);

  /* Soft glowing border with animated colors */
  box-shadow:
    0 0 0 2px rgba(58, 127, 213, 0.4),
    0 0 15px rgba(58, 127, 213, 0.5),
    0 0 30px rgba(124, 58, 237, 0.3),
    inset 0 0 20px rgba(58, 127, 213, 0.1);
  animation: vsBorderGlow 4s ease-in-out infinite;
}

@keyframes vsBorderGlow {
  0%, 100% {
    box-shadow:
      0 0 0 2px rgba(58, 127, 213, 0.5),
      0 0 15px rgba(58, 127, 213, 0.6),
      0 0 30px rgba(124, 58, 237, 0.4),
      inset 0 0 20px rgba(58, 127, 213, 0.15);
  }
  33% {
    box-shadow:
      0 0 0 2px rgba(124, 58, 237, 0.6),
      0 0 18px rgba(124, 58, 237, 0.7),
      0 0 35px rgba(58, 127, 213, 0.5),
      inset 0 0 25px rgba(124, 58, 237, 0.2);
  }
  66% {
    box-shadow:
      0 0 0 2px rgba(5, 150, 105, 0.5),
      0 0 15px rgba(5, 150, 105, 0.6),
      0 0 30px rgba(124, 58, 237, 0.4),
      inset 0 0 20px rgba(5, 150, 105, 0.15);
  }
}

.game-vs-text-metal {
  font-size: 32px;
  font-weight: 900;
  letter-spacing: 3px;
  color: white;
  line-height: 1;

  /* Static multi-color glow using text-shadow */
  text-shadow:
    0 0 10px rgba(58, 127, 213, 0.9),
    0 0 20px rgba(124, 58, 237, 0.7),
    0 0 30px rgba(5, 150, 105, 0.5),
    0 3px 15px rgba(0, 0, 0, 0.6),
    0 0 40px rgba(124, 58, 237, 0.4);
}

/* Player Cards Carousel - Full Width */
.game-player-cards {
  width: 100%;
  overflow: hidden;
  border-radius: 6px;
}

.game-player-cards .swiper {
  width: 100%;
  height: auto;
}

.game-player-cards .swiper-slide {
  width: 60px;
  height: 84px;
  flex-shrink: 0;
}

.game-player-cards .swiper-slide img,
.game-player-cards .swiper-slide .game-card-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-tertiary);
  transition: all 0.2s ease;
}

.game-player-cards .swiper-slide:hover img,
.game-player-cards .swiper-slide:hover .game-card-thumb {
  transform: scale(1.05);
  border-color: rgba(124, 58, 237, 0.6);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.4);
}

/* Empty states */
.game-player-cards-empty,
.game-players-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  font-size: 13px;
  color: var(--text-tertiary);
  background: var(--bg-tertiary);
  border-radius: 6px;
  border: 1px dashed var(--border-subtle);
}

/* Game Meta - Below Cards, Left-Justified */
.game-meta-corner {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  opacity: 0.6;
}

.game-meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--text-secondary);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.game-meta-item svg {
  color: var(--text-tertiary);
  flex-shrink: 0;
}

/* Loading State */
.game-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 16px;
}

.game-loading .spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border-subtle);
  border-top-color: var(--accent-game);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.game-loading p {
  font-size: 15px;
  color: var(--text-secondary);
  margin: 0;
}

/* Empty State */
.game-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.game-empty-state svg {
  color: var(--text-tertiary);
  margin-bottom: 16px;
}

.game-empty-state h3 {
  margin: 0 0 8px 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.game-empty-state p {
  margin: 0;
  font-size: 14px;
  color: var(--text-secondary);
}

/* Load More Button */
.game-load-more-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 12px;
  margin-top: 16px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-primary);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.game-load-more-btn:hover:not(:disabled) {
  background: var(--bg-card);
  border-color: var(--accent-game);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

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

/* Responsive adjustments */
@media (max-width: 768px) {
  .game-card {
    padding: 8px;
  }

  .game-player-info {
    margin-bottom: -12px;
  }

  .game-player-name-metal {
    font-size: 22px;
    letter-spacing: 1px;
  }

  .game-player-deck-name {
    font-size: 10px;
  }

  .game-vs-text-metal {
    font-size: 24px;
    letter-spacing: 2px;
  }

  .game-vs-divider {
    padding: 4px 8px;
    justify-self: center;
  }

  .game-main-event {
    gap: 10px;
  }

  .game-player-cards .swiper-slide {
    width: 50px;
    height: 70px;
  }
}

@media (max-width: 600px) {
  .game-card {
    padding: 8px;
  }

  .game-player-info {
    margin-bottom: -10px;
  }

  .game-player-name-metal {
    font-size: 18px;
    letter-spacing: 0.5px;
  }

  .game-vs-text-metal {
    font-size: 20px;
    letter-spacing: 1.5px;
  }

  .game-vs-divider {
    padding: 4px 6px;
    justify-self: center;
  }

  .game-player-deck-name {
    font-size: 9px;
  }

  .game-player-cards .swiper-slide {
    width: 45px;
    height: 63px;
  }

  .game-main-event {
    gap: 8px;
  }
}

/* Very narrow screens - stack vertically */
@media (max-width: 480px) {
  .game-card {
    padding: 8px;
  }

  .game-main-event {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    gap: 10px;
  }

  .game-player-side.left,
  .game-player-side.right {
    align-items: center;
    text-align: center;
  }

  .game-player-side.left .game-player-info,
  .game-player-side.right .game-player-info {
    align-items: center;
    text-align: center;
  }

  .game-player-side.left {
    order: 1;
  }

  .game-vs-divider {
    order: 2;
    padding: 3px 6px;
    justify-self: center;
    width: auto;
  }

  .game-player-side.right {
    order: 3;
  }

  .game-player-cards {
    max-width: none;
    margin-left: 0;
    margin-right: 0;
  }

  .game-player-info {
    margin-bottom: -10px;
  }

  .game-player-name-metal {
    font-size: 16px;
  }

  .game-vs-text-metal {
    font-size: 18px;
  }

  .game-player-deck-name {
    font-size: 8px;
  }
}
