/* css/public.css - ChessCast 2.0 Modern Public Interface */

/* ==========================================================================
   HERO SECTION - MOBILE FIRST
   ========================================================================== */

.hero-section {
  min-height: 60vh;
  padding: var(--space-8) 0;
  background: linear-gradient(
    135deg,
    var(--bg-primary) 0%,
    var(--gray-900) 30%,
    var(--primary-950) 70%,
    var(--bg-primary) 100%
  );
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="chess" x="0" y="0" width="10" height="10" patternUnits="userSpaceOnUse"><rect width="5" height="5" fill="rgba(59,130,246,0.03)"/><rect x="5" y="5" width="5" height="5" fill="rgba(59,130,246,0.03)"/></pattern></defs><rect width="100" height="100" fill="url(%23chess)"/></svg>');
  opacity: 0.3;
  animation: chess-pattern-move 20s linear infinite;
}

@keyframes chess-pattern-move {
  0% { transform: translateX(0) translateY(0); }
  100% { transform: translateX(10px) translateY(10px); }
}

.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

.hero-title {
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  margin-bottom: var(--space-4);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  background: linear-gradient(135deg, var(--text-primary), var(--primary-300));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: var(--font-size-lg);
  color: var(--text-secondary);
  margin-bottom: var(--space-8);
  line-height: var(--line-height-relaxed);
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: var(--space-6);
  margin-top: var(--space-8);
  flex-wrap: wrap;
}

.hero-stat {
  text-align: center;
  padding: var(--space-3);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-backdrop);
  border-radius: var(--radius-xl);
  border: 1px solid var(--glass-border);
  min-width: 100px;
}

.hero-stat-number {
  display: block;
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--primary-400);
}

.hero-stat-label {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  margin-top: var(--space-1);
}

/* ==========================================================================
   PUBLIC TOURNAMENT SELECTION
   ========================================================================== */

#tournament-select, #round-select {
  display: block !important;
  width: 100%;
  background: var(--bg-secondary);
  border: 2px solid var(--border-primary);
  color: var(--text-primary);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  font-size: var(--font-size-base);
  transition: all var(--transition-fast);
  min-height: var(--touch-target-min);
}

#tournament-select:focus, #round-select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

#tournament-select option, #round-select option {
  background: var(--bg-primary);
  color: var(--text-primary);
}

#round-filter-container {
  margin-top: 1rem;
}

/* ==========================================================================
   TOURNAMENT DISPLAY
   ========================================================================== */

#tournament-title {
  text-align: center;
  font-size: var(--font-size-2xl);
  font-weight: bold;
  color: white;
  margin: 1rem 0;
  min-height: 2rem;
}

/* ==========================================================================
   GAMES GRID
   ========================================================================== */

#games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--space-6);
  margin: 2rem 0;
}

.game-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  color: white;
  text-decoration: none;
  display: block;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.game-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--primary-400), transparent);
  transition: left 0.5s ease;
}

.game-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-focus);
  box-shadow: var(--shadow-lg);
  text-decoration: none;
  color: white;
}

.game-card:hover::before {
  left: 100%;
}

/* ==========================================================================
   GAME CARD STATUS BADGES
   ========================================================================== */

.status-badge {
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-block;
  position: relative;
  overflow: hidden;
}

.status-pending { 
  background: rgba(156, 163, 175, 0.2); 
  color: #d1d5db; 
}

.status-live { 
  background: rgba(239, 68, 68, 0.2); 
  color: #f87171; 
  animation: pulse-live 2s infinite;
}

.status-finished { 
  background: rgba(34, 197, 94, 0.2); 
  color: #4ade80; 
}

@keyframes pulse-live {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* ==========================================================================
   PLAYER INFO IN CARDS
   ========================================================================== */

.player-info {
  display: flex;
  align-items: center;
  margin: 0.5rem 0;
  padding: var(--space-2);
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.player-info:hover {
  background: rgba(255, 255, 255, 0.1);
}

.piece-white, .piece-black {
  margin-right: 0.5rem;
  font-size: 1.25rem;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

.player-taken { 
  color: white; 
  font-weight: 500; 
}

.player-available { 
  color: rgba(255, 255, 255, 0.5); 
  font-style: italic; 
}

.game-result {
  margin-top: 1rem;
  padding: 0.5rem;
  background: rgba(34, 197, 94, 0.1);
  border-radius: 6px;
  color: #4ade80;
  font-weight: 600;
  text-align: center;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

/* ==========================================================================
   APPLICATION STATES
   ========================================================================== */

#loading-state, #error-state, #empty-state {
  text-align: center;
  padding: var(--space-8);
  margin: 2rem 0;
  background: var(--bg-elevated);
  border-radius: var(--radius-2xl);
  color: var(--text-secondary);
  border: 1px solid var(--border-secondary);
}

#loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.spinner {
  width: 2rem;
  height: 2rem;
  border: 3px solid var(--border-primary);
  border-left-color: var(--primary-500);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

#retry-button {
  background: var(--primary-500);
  color: white;
  border: none;
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  margin-top: 1rem;
  transition: all var(--transition-fast);
  font-weight: var(--font-weight-medium);
  min-height: var(--touch-target-min);
}

#retry-button:hover {
  background: var(--primary-600);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* ==========================================================================
   FOOTER
   ========================================================================== */

.main-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-secondary);
  padding: var(--space-8) 0;
  margin-top: var(--space-12);
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-4);
  text-align: center;
}

.footer-logo {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  margin-bottom: var(--space-4);
}

.footer-description {
  font-size: var(--font-size-base);
  color: var(--text-secondary);
  margin-bottom: var(--space-6);
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: var(--space-6);
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
}

.footer-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: var(--font-size-sm);
  transition: color var(--transition-fast);
  padding: var(--space-2);
  border-radius: var(--radius-md);
}

.footer-link:hover {
  color: var(--primary-400);
  background: rgba(59, 130, 246, 0.1);
}

.footer-copyright {
  font-size: var(--font-size-sm);
  color: var(--text-tertiary);
  border-top: 1px solid var(--border-secondary);
  padding-top: var(--space-4);
}

/* ==========================================================================
   LOADING INICIAL
   ========================================================================== */

#app-loading {
  transition: opacity 0.3s ease-out;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border-primary);
  border-top-color: var(--primary-500);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loading-text {
  color: var(--text-secondary);
  margin-top: var(--space-4);
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */

@media (min-width: 768px) {
  .hero-section {
    min-height: 50vh;
    padding: var(--space-12) 0;
  }
  
  .hero-title {
    font-size: var(--font-size-5xl);
  }
  
  .hero-subtitle {
    font-size: var(--font-size-xl);
  }
  
  .hero-stats {
    gap: var(--space-8);
  }

  .container {
    padding: 0 var(--space-6);
  }

  .grid-cols-1 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .container {
    padding: 0 var(--space-8);
  }
}

/* ==========================================================================
   ACCESSIBILITY & PERFORMANCE
   ========================================================================== */

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .hero-section::before {
    animation: none;
  }
  
  .status-live {
    animation: none;
  }
  
  .game-card:hover {
    transform: none;
  }
  
  .game-card::before {
    display: none;
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  .game-card {
    border: 2px solid var(--text-primary);
  }
  
  .status-badge {
    border: 1px solid currentColor;
  }
}