/* Base styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-dark: #0a0a0a;
  --bg-card: #1a1a1a;
  --bg-card-hover: #252525;
  --text-primary: #ffffff;
  --text-secondary: #888888;
  --accent: #ffd700;
  --accent-dim: #b8860b;
  --success: #4caf50;
  --error: #f44336;
  --border: #333333;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

/* Typography */
h1 {
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

h2 {
  font-size: 2rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

h3 {
  font-size: 1.5rem;
  font-weight: 500;
}

/* Layout */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
}

.tv-container {
  padding: 3rem;
  min-height: 100vh;
}

/* Navigation */
nav {
  background: var(--bg-card);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

nav a {
  color: var(--text-primary);
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  transition: background 0.2s;
}

nav a:hover {
  background: var(--bg-card-hover);
}

nav .nav-links {
  display: flex;
  gap: 0.5rem;
}

.nav-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--accent);
}

/* Leaderboard (TV Display) */
.leaderboard {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.leaderboard-header {
  text-align: center;
  padding: 2rem 0;
}

.leaderboard-header h1 {
  font-size: 4rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.leaderboard-header .year {
  font-size: 2rem;
  color: var(--text-secondary);
}

.player-row {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border-radius: 12px;
  padding: 1.5rem 2rem;
  gap: 2rem;
  transition: transform 0.2s, background 0.2s;
}

.player-row:hover {
  background: var(--bg-card-hover);
  transform: scale(1.01);
}

.player-rank {
  font-size: 3rem;
  font-weight: 700;
  color: var(--text-secondary);
  min-width: 80px;
  text-align: center;
}

.player-rank.gold { color: #ffd700; }
.player-rank.silver { color: #c0c0c0; }
.player-rank.bronze { color: #cd7f32; }

.player-info {
  flex: 1;
}

.player-name {
  font-size: 2.5rem;
  font-weight: 600;
}

.player-stats {
  color: var(--text-secondary);
  font-size: 1.25rem;
}

.player-score {
  font-size: 4rem;
  font-weight: 700;
  color: var(--accent);
}

.player-recent {
  display: flex;
  gap: 0.5rem;
}

.recent-prediction {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--bg-dark);
  overflow: hidden;
}

.recent-prediction img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Deaths List */
.deaths-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.death-card {
  background: var(--bg-card);
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.2s;
}

.death-card:hover {
  transform: translateY(-4px);
}

.death-card-photo {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: var(--bg-dark);
}

.death-card-photo.no-photo {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  color: var(--text-secondary);
}

.death-card-content {
  padding: 1rem;
}

.death-card-name {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.death-card-profession {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.death-card-meta {
  display: flex;
  justify-content: space-between;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.death-card-predictors {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.predictor-tag {
  display: inline-block;
  background: var(--accent-dim);
  color: var(--bg-dark);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-right: 0.25rem;
}

/* Forms */
.form-group {
  margin-bottom: 1.5rem;
}

label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

input, select {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 1rem;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
}

button {
  padding: 0.75rem 1.5rem;
  background: var(--accent);
  color: var(--bg-dark);
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

button:hover {
  background: var(--accent-dim);
}

button.secondary {
  background: var(--bg-card);
  color: var(--text-primary);
}

button.secondary:hover {
  background: var(--bg-card-hover);
}

button.danger {
  background: var(--error);
  color: white;
}

/* Search Results */
.search-results {
  background: var(--bg-card);
  border-radius: 8px;
  margin-top: 0.5rem;
  max-height: 400px;
  overflow-y: auto;
}

.search-result {
  display: flex;
  align-items: center;
  padding: 1rem;
  gap: 1rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.2s;
}

.search-result:hover {
  background: var(--bg-card-hover);
}

.search-result:last-child {
  border-bottom: none;
}

.search-result-photo {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--bg-dark);
}

.search-result-info {
  flex: 1;
}

.search-result-name {
  font-weight: 600;
}

.search-result-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Predictions List */
.predictions-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.prediction-item {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border-radius: 8px;
  padding: 1rem;
  gap: 1rem;
}

.prediction-item.hit {
  border-left: 4px solid var(--success);
}

.prediction-photo {
  width: 50px;
  height: 50px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--bg-dark);
  flex-shrink: 0;
}

.prediction-photo.no-photo {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--text-secondary);
}

.prediction-info {
  flex: 1;
}

.prediction-name {
  font-weight: 600;
}

.prediction-quarter {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.prediction-points {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
}

/* Messages */
.message {
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
}

.message.success {
  background: rgba(76, 175, 80, 0.2);
  border: 1px solid var(--success);
}

.message.error {
  background: rgba(244, 67, 54, 0.2);
  border: 1px solid var(--error);
}

/* Loading */
.loading {
  text-align: center;
  padding: 2rem;
  color: var(--text-secondary);
}

.loading::after {
  content: '';
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--accent);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-left: 0.5rem;
}

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

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

  .leaderboard-header h1 {
    font-size: 2.5rem;
  }

  .player-row {
    flex-wrap: wrap;
    padding: 1rem;
  }

  .player-rank {
    font-size: 2rem;
    min-width: 50px;
  }

  .player-name {
    font-size: 1.5rem;
  }

  .player-score {
    font-size: 2.5rem;
  }

  .player-recent {
    display: none;
  }

  h1 {
    font-size: 2rem;
  }
}

/* Admin */
.admin-section {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.admin-section h3 {
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.admin-table th {
  color: var(--text-secondary);
  font-weight: 500;
}

.toggle-btn {
  padding: 0.25rem 0.5rem;
  font-size: 0.85rem;
}

/* Footer */
.footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-secondary);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  margin-top: 3rem;
}

.footer a {
  color: var(--accent);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}
