@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@500;600;700&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;700&display=swap');

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

:root {
  --font-display: 'Rajdhani', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Base - Dark gaming aesthetic (exact values from React app) */
  --background: hsl(240 10% 4%);
  --foreground: hsl(0 0% 100%);

  /* Primary - Competitive Red */
  --primary: hsl(0 84% 60%);
  --primary-foreground: hsl(0 0% 100%);

  /* Secondary - Dark Metal/Slate */
  --secondary: hsl(240 6% 10%);
  --secondary-foreground: hsl(0 0% 100%);

  /* Muted - For de-emphasized text */
  --muted: hsl(240 6% 16%);
  --muted-foreground: hsl(240 5% 65%);

  /* Accent - Gold for top ranks */
  --accent: hsl(43 96% 58%);
  --accent-foreground: hsl(240 10% 4%);

  /* Destructive - For delete actions */
  --destructive: hsl(0 84% 60%);
  --destructive-foreground: hsl(0 0% 100%);

  /* Borders & Inputs */
  --border: hsl(240 6% 16%);
  --input: hsl(240 6% 16%);
  --ring: hsl(0 84% 60%);

  /* Card */
  --card: hsl(240 6% 8%);
  --card-foreground: hsl(0 0% 100%);

  /* Radius */
  --radius: 0.25rem;

  /* Rank Colors (exact matches) */
  --gold: hsl(43 96% 58%);
  --silver: hsl(215 20% 80%);
  --bronze: hsl(28 80% 52%);
}

body {
  font-family: var(--font-body);
  background-color: var(--background);
  color: var(--foreground);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-image: 
    radial-gradient(circle at 50% 0%, hsla(0, 84%, 60%, 0.15), transparent 40%),
    linear-gradient(to bottom, transparent, var(--background));
}

::selection {
  background-color: hsla(0, 84%, 60%, 0.3);
  color: white;
}

/* Background Effects */
.background-effects {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
}

.glow-primary {
  top: -10%;
  right: -5%;
  width: 500px;
  height: 500px;
  background: hsla(0, 84%, 60%, 0.1);
  filter: blur(120px);
}

.glow-blue {
  bottom: -10%;
  left: -5%;
  width: 400px;
  height: 400px;
  background: hsla(217, 91%, 60%, 0.05);
  filter: blur(100px);
}

.noise-overlay {
  position: absolute;
  inset: 0;
  background-image: url('https://grainy-gradients.vercel.app/noise.svg');
  opacity: 0.2;
}

/* Container */
.container {
  position: relative;
  max-width: 56rem;
  margin: 0 auto;
  padding: 3rem 1rem 5rem;
}

@media (min-width: 640px) {
  .container {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

/* Header Section */
.header-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 3rem;
  text-align: center;
}

.header-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.trophy-icon {
  width: 32px;
  height: 32px;
  color: var(--primary);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.header-badge-text {
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--primary);
}

.main-title {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: white;
  filter: drop-shadow(0 20px 30px rgba(0, 0, 0, 0.5));
}

@media (min-width: 768px) {
  .main-title {
    font-size: 3.5rem;
  }
}

.sub-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.3));
}

@media (min-width: 768px) {
  .sub-title {
    font-size: 1.875rem;
  }
}

.arabic-subtitle {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.9);
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.3));
}

@media (min-width: 768px) {
  .arabic-subtitle {
    font-size: 1.25rem;
  }
}

.admin-link {
  margin-top: 1rem;
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-foreground);
  text-decoration: none;
  padding: 0.5rem 1rem;
  border: 1px solid var(--muted);
  border-radius: 0.25rem;
  transition: all 0.2s;
}

.admin-link:hover {
  color: white;
  border-color: var(--primary);
  background-color: hsla(0, 84%, 60%, 0.1);
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

@media (min-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.glass-panel {
  background-color: hsla(240, 6%, 8%, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.stat-card {
  border-radius: 0.75rem;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.stat-card-desktop {
  display: none;
}

@media (min-width: 768px) {
  .stat-card-desktop {
    display: flex;
  }
}

.stat-label {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--muted-foreground);
  margin-bottom: 0.25rem;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 1.875rem;
  font-weight: 700;
  color: white;
}

.stat-primary {
  color: var(--primary);
}

.stat-small {
  font-size: 0.875rem;
}

/* Leaderboard Container */
.leaderboard-container {
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
}

.leaderboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background-color: rgba(0, 0, 0, 0.4);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted-foreground);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 2rem;
  padding-left: 0.5rem;
}

.header-rank {
  width: 2rem;
  text-align: center;
}

.header-score {
  padding-right: 0.5rem;
}

.leaderboard-list {
  /* No max-height - show all players without scroll */
}

/* Scrollbar */
.leaderboard-list::-webkit-scrollbar {
  width: 6px;
}

.leaderboard-list::-webkit-scrollbar-track {
  background: var(--secondary);
}

.leaderboard-list::-webkit-scrollbar-thumb {
  background: var(--muted);
  border-radius: 3px;
}

.leaderboard-list::-webkit-scrollbar-thumb:hover {
  background: var(--muted-foreground);
}

/* Player Row */
.player-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background-color: hsla(240, 6%, 8%, 0.4);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(4px);
  transition: background-color 0.2s;
}

@media (min-width: 768px) {
  .player-row {
    padding: 1.5rem;
  }
}

.player-row:hover {
  background-color: hsla(240, 6%, 8%, 0.6);
}

.player-row:last-child {
  border-bottom: none;
  border-radius: 0 0 1rem 1rem;
}

.player-row.top-rank {
  background: linear-gradient(90deg, hsla(240, 6%, 8%, 0.8), hsla(240, 6%, 8%, 0.4));
  border-left: 4px solid;
}

.player-row.rank-1 {
  border-left-color: var(--gold);
}

.player-row.rank-2 {
  border-left-color: var(--silver);
}

.player-row.rank-3 {
  border-left-color: var(--bronze);
}

.player-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
  min-width: 0;
}

@media (min-width: 768px) {
  .player-left {
    gap: 2rem;
  }
}

.player-rank {
  flex-shrink: 0;
  width: 3rem;
  text-align: center;
  font-family: var(--font-display);
}

.rank-number {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--muted-foreground);
}

@media (min-width: 768px) {
  .rank-number {
    font-size: 1.875rem;
  }
}

.rank-gold {
  color: var(--gold);
  text-shadow: 0 0 8px hsla(48, 96%, 53%, 0.5);
}

.rank-silver {
  color: var(--silver);
  text-shadow: 0 0 8px hsla(215, 20%, 80%, 0.3);
}

.rank-bronze {
  color: var(--bronze);
  text-shadow: 0 0 8px hsla(28, 80%, 52%, 0.3);
}

.medal-icon {
  width: 32px;
  height: 32px;
  color: var(--gold);
  animation: pulse 2s infinite;
}

.player-info {
  flex: 1;
  min-width: 0;
}

.player-name {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.9);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.05em;
}

@media (min-width: 768px) {
  .player-name {
    font-size: 1.25rem;
  }
}

.player-name.leader {
  color: white;
  text-shadow: 0 0 20px hsla(0, 84%, 60%, 0.5);
}

.player-subtitle {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--muted-foreground);
  margin-top: 2px;
}

.player-score {
  text-align: right;
}

.score-value {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.025em;
}

@media (min-width: 768px) {
  .score-value {
    font-size: 1.875rem;
  }
}

.score-label {
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted-foreground);
}

/* Footer */
.footer-text {
  margin-top: 2rem;
  text-align: center;
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted-foreground);
  opacity: 0.5;
}

/* Admin Page Specific */
.admin-header-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 2rem;
  text-align: center;
}

.add-player-section {
  margin-bottom: 2rem;
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: white;
  margin-bottom: 1rem;
}

.add-player-form {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.input-field {
  flex: 1;
  min-width: 150px;
  padding: 0.75rem 1rem;
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: white;
  background-color: var(--secondary);
  border: 1px solid var(--muted);
  border-radius: 0.25rem;
  outline: none;
  transition: border-color 0.2s;
}

.input-field:focus {
  border-color: var(--primary);
}

.input-field::placeholder {
  color: var(--muted-foreground);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: none;
  border-radius: 0.25rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background-color: var(--primary);
  color: white;
}

.btn-primary:hover {
  background-color: hsl(0 84% 50%);
}

.btn-secondary {
  background-color: transparent;
  color: var(--muted-foreground);
  border: 1px solid var(--muted);
}

.btn-secondary:hover {
  background-color: var(--muted);
  color: white;
}

.btn-danger {
  background-color: var(--primary);
  color: white;
}

.btn-danger:hover {
  background-color: hsl(0 84% 50%);
}

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  background-color: transparent;
  color: var(--muted-foreground);
  border: none;
  border-radius: 0.25rem;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

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

.btn-icon.edit:hover {
  color: hsl(217 91% 60%);
  background-color: hsla(217, 91%, 60%, 0.1);
}

.btn-icon.delete:hover {
  color: var(--primary);
  background-color: hsla(0, 84%, 60%, 0.1);
}

/* Admin Player Row */
.player-row.admin-row {
  position: relative;
}

.player-actions {
  display: flex;
  gap: 0.25rem;
  opacity: 0;
  transition: opacity 0.2s;
}

.player-row:hover .player-actions {
  opacity: 1;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.7);
}

.modal-content {
  position: relative;
  width: 100%;
  max-width: 400px;
  padding: 1.5rem;
  background-color: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.5rem;
  margin: 1rem;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
  color: white;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
}

.modal-description {
  color: var(--muted-foreground);
  margin-bottom: 1.5rem;
  line-height: 1.5;
  font-size: 0.875rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  color: var(--muted-foreground);
  margin-bottom: 0.5rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

/* Responsive Adjustments */
@media (max-width: 640px) {
  .container {
    padding: 2rem 1rem 4rem;
  }

  .main-title {
    font-size: 2.5rem;
  }

  .sub-title {
    font-size: 1.25rem;
  }

  .arabic-subtitle {
    font-size: 1rem;
  }

  .add-player-form {
    flex-direction: column;
  }

  .input-field {
    min-width: 100%;
  }

  .player-actions {
    opacity: 1;
  }
}
