/* Import Inter font and Lucide Icons */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');
@import url('https://unpkg.com/lucide-static@latest/font/lucide.css');

/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Enhanced dark mode color palette */
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --accent-primary: #3b82f6;
  --accent-primary-hover: #2563eb;
  --accent-secondary: #8b5cf6;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --border-color: #475569;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4), 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.4), 0 4px 6px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.3);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* Header */
header {
  background: var(--bg-secondary);
  box-shadow: var(--shadow-md);
  margin-bottom: 32px;
  border-radius: var(--radius-md);
  padding: 24px 28px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  position: relative;
  overflow: hidden;
}

header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary), var(--accent-primary));
  background-size: 200% 100%;
  animation: headerGradient 3s ease infinite;
}

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

header h1 {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 8px;
  text-balance: balance;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.player-info {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  color: var(--text-secondary);
  font-size: 14px;
}

.player-info button {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--accent-primary);
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  transition: all 150ms ease;
  min-height: 24px;
}

.player-info button:hover {
  background: var(--bg-tertiary);
  border-color: var(--accent-primary);
}

/* Navigation */
nav {
  margin-top: 16px;
}

nav a {
  color: var(--accent-primary);
  text-decoration: none;
  margin-right: 20px;
  font-weight: 500;
  transition: color 150ms ease;
}

nav a:hover {
  color: var(--accent-primary-hover);
}

/* Cards */
.card {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: all 200ms ease;
}

.card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
  border-color: rgba(59, 130, 246, 0.2);
}

.card h2 {
  font-size: 24px;
  margin-bottom: 20px;
  font-weight: 700;
  text-balance: balance;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.card h3 {
  font-size: 18px;
  margin-bottom: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

thead {
  border-bottom: 2px solid var(--border-color);
  background: var(--bg-tertiary);
}

th {
  text-align: left;
  padding: 14px 12px;
  font-weight: 700;
  color: var(--text-primary);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

td {
  padding: 14px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

tbody tr {
  transition: all 200ms ease;
}

tbody tr:hover {
  background: var(--bg-tertiary);
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.2);
}

tbody tr:first-child {
  background: rgba(59, 130, 246, 0.08);
}

tbody tr:first-child:hover {
  background: rgba(59, 130, 246, 0.12);
}

/* Forms */
.form-group {
  margin-bottom: 20px;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 14px;
}

input[type="text"],
input[type="number"],
input[type="datetime-local"],
select {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-tertiary);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 16px;
  min-height: 44px;
  transition: all 200ms ease;
  font-weight: 500;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  background: var(--bg-secondary);
}

input::placeholder {
  color: var(--text-muted);
}

/* Buttons */
button,
.btn {
  background: var(--accent-primary);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 200ms ease;
  min-height: 44px;
  min-width: 100px;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

button:hover:not(:disabled),
.btn:hover:not(:disabled) {
  background: var(--accent-primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

button:active:not(:disabled),
.btn:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

button:disabled,
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-danger {
  background: var(--danger);
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
}

.btn-danger:hover:not(:disabled) {
  background: #dc2626;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.btn-secondary {
  background: var(--bg-tertiary);
  border: 2px solid var(--border-color);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--border-color);
  border-color: var(--text-muted);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-success {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Game cards */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.game-card {
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-md);
  transition: all 200ms ease;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.05);
  position: relative;
  overflow: hidden;
}

.game-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
  opacity: 0;
  transition: opacity 200ms ease;
}

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

.game-card:hover {
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  transform: translateY(-4px);
  border-color: rgba(59, 130, 246, 0.3);
}

.game-card .teams {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 12px;
  text-balance: balance;
  letter-spacing: -0.01em;
  line-height: 1.4;
}

.game-card .kickoff-time {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 8px;
}

.game-card .countdown {
  color: var(--accent-primary);
  font-weight: 500;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.game-card .final-score {
  font-size: 24px;
  font-weight: 700;
  color: var(--success);
  margin-top: 12px;
  font-variant-numeric: tabular-nums;
}

/* Predictions list */
.predictions-list {
  margin-top: 20px;
}

.prediction-item {
  background: var(--bg-tertiary);
  padding: 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.prediction-item .player-name {
  font-weight: 500;
  color: var(--text-secondary);
}

.prediction-item .score {
  font-size: 20px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.prediction-item .points {
  color: var(--success);
  font-weight: 600;
  font-size: 16px;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 36px;
  max-width: 500px;
  width: 100%;
  box-shadow: var(--shadow-lg), 0 0 40px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  animation: modalSlideIn 300ms ease-out;
}

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

.modal-content h2 {
  margin-bottom: 20px;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}

.empty-state p {
  font-size: 18px;
  margin-bottom: 12px;
}

/* Loading skeleton */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-tertiary) 25%,
    var(--border-color) 50%,
    var(--bg-tertiary) 75%
  );
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.skeleton-line {
  height: 20px;
  margin-bottom: 12px;
}

/* Error message */
.error-message {
  background: rgba(245, 101, 101, 0.1);
  border: 1px solid var(--danger);
  color: var(--danger);
  padding: 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
}

/* Success message */
.success-message {
  background: rgba(72, 187, 120, 0.1);
  border: 1px solid var(--success);
  color: var(--success);
  padding: 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 12px;
  }

  header {
    padding: 16px;
    margin-bottom: 20px;
  }

  header h1 {
    font-size: 24px;
  }

  .card {
    padding: 16px;
  }

  .games-grid {
    grid-template-columns: 1fr;
  }

  table {
    font-size: 14px;
  }

  th,
  td {
    padding: 8px 4px;
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus visible for keyboard navigation */
button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid var(--accent-primary);
  outline-offset: 2px;
}

/* Icon styles */
.icon {
  display: inline-block;
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.icon-lg {
  width: 24px;
  height: 24px;
}

/* Rank badge for leaderboard */
.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 14px;
}

.rank-badge.rank-1 {
  background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
  color: #1a202c;
  box-shadow: 0 2px 8px rgba(255, 215, 0, 0.4);
}

.rank-badge.rank-2 {
  background: linear-gradient(135deg, #c0c0c0 0%, #e8e8e8 100%);
  color: #1a202c;
  box-shadow: 0 2px 8px rgba(192, 192, 192, 0.4);
}

.rank-badge.rank-3 {
  background: linear-gradient(135deg, #cd7f32 0%, #e6a35f 100%);
  color: #1a202c;
  box-shadow: 0 2px 8px rgba(205, 127, 50, 0.4);
}

.rank-badge.rank-other {
  background: var(--bg-tertiary);
  color: var(--text-muted);
  border: 2px solid var(--border-color);
}

/* Score display enhancements */
.score-display {
  font-size: 32px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Points display */
.points-display {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: var(--success);
  font-size: 18px;
  padding: 6px 14px;
  background: rgba(16, 185, 129, 0.1);
  border-radius: 20px;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

/* Countdown timer styling */
.countdown-timer {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(59, 130, 246, 0.1);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(59, 130, 246, 0.2);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Prediction item enhancements */
.prediction-item {
  background: var(--bg-tertiary);
  padding: 18px;
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: all 200ms ease;
}

.prediction-item:hover {
  background: var(--bg-secondary);
  border-color: rgba(59, 130, 246, 0.3);
  transform: translateX(4px);
}

/* Smooth page transitions */
@media (prefers-reduced-motion: no-preference) {
  .card {
    animation: fadeInUp 400ms ease-out;
  }

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

/* Improved loading skeleton */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-tertiary) 25%,
    rgba(59, 130, 246, 0.1) 50%,
    var(--bg-tertiary) 75%
  );
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
  border-radius: var(--radius-sm);
}

/* Responsive improvements */
@media (max-width: 768px) {
  header h1 {
    font-size: 26px;
  }

  .card h2 {
    font-size: 20px;
  }

  .game-card .teams {
    font-size: 18px;
  }

  .score-display {
    font-size: 28px;
  }
}
