/* 
   Retro Monospace & Pixel-Style Sheet
   Inspired by worldcup.cole.ws
   Simple, high-contrast, data-dense design.
*/

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

:root {
  --color-bg: #dcdcdc; /* Light retro gray background */
  --color-surface: #ffffff;
  --color-text-primary: #000000;
  --color-text-secondary: #333333;
  --color-text-muted: #555555;
  
  --color-primary: #0000ff; /* Solid Retro Blue */
  --color-success: #008000; /* Solid Retro Green */
  --color-warning: #a52a2a; /* Brown/Amber */
  --color-danger: #ff0000; /* Solid Retro Red */
  
  --retro-border: 2px solid #000000;
  --retro-border-thin: 1px solid #000000;
  --retro-shadow: 4px 4px 0px #000000;
  --retro-shadow-sm: 2px 2px 0px #000000;
  --retro-shadow-lg: 6px 6px 0px #000000;
}

/* Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border-radius: 0px !important; /* Absolute pixelated sharp corners */
}

body {
  font-family: 'Fira Mono', 'Courier New', Courier, monospace;
  background-color: var(--color-bg);
  color: var(--color-text-primary);
  min-height: 100vh;
  line-height: 1.4;
  padding: 1rem;
}

@media (min-width: 768px) {
  body {
    padding: 2rem;
  }
}

/* Override Glassmorphism with Retro Solid Panels */
.glass-panel {
  background: var(--color-surface) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border: var(--retro-border) !important;
  box-shadow: var(--retro-shadow) !important;
  transition: none !important; /* No smooth transition, retro snaps instantly */
}

.glass-panel:hover {
  border-color: #000000 !important;
  transform: translate(-1px, -1px);
  box-shadow: 5px 5px 0px #000000 !important;
}

/* Header Design */
header {
  border-bottom: var(--retro-border) !important;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
}

/* API Status Indicator Box */
.status-indicator {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.25rem 0.75rem;
  border: var(--retro-border-thin) !important;
  background: #ffffff !important;
  color: #000000 !important;
}

.status-success { background: #c6f6d5 !important; border-color: #22543d !important; }
.status-warning { background: #fefcbf !important; border-color: #744210 !important; }
.status-danger { background: #fed7d7 !important; border-color: #742a2a !important; }
.status-info { background: #e2e8f0 !important; border-color: #4a5568 !important; }

/* Custom Badge styled like retro console label */
span.text-xs.font-black.uppercase {
  background: #000000 !important;
  color: #ffffff !important;
  border: var(--retro-border-thin) !important;
  padding: 0.2rem 0.5rem !important;
}

/* Leaderboard Rank Badges */
.rank-medal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  font-weight: 800;
  font-size: 0.8rem;
  border: var(--retro-border-thin) !important;
  color: #000000 !important;
}

.rank-medal.gold { background: #f6e05e !important; }
.rank-medal.silver { background: #e2e8f0 !important; }
.rank-medal.bronze { background: #ed8936 !important; }

/* Clickable Table Rows */
tbody tr {
  cursor: pointer;
}
tbody tr:hover td {
  background: #f7fafc !important;
}

/* Tables styling (Simple Grid layout) */
table {
  border-collapse: collapse !important;
  width: 100%;
  border: var(--retro-border) !important;
}

th, td {
  border: var(--retro-border-thin) !important;
  padding: 0.4rem 0.6rem !important;
  text-align: left;
  background: #ffffff;
  color: #000000 !important;
}

th {
  background: #edf2f7 !important;
  font-weight: 700;
  font-size: 0.8rem;
  color: #000000 !important;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

tr:last-child td {
  border-bottom: var(--retro-border-thin) !important;
}

/* Override dynamically rendered badge boxes in app.js */
tbody div.max-w-max {
  background: #ffffff !important;
  border: var(--retro-border-thin) !important;
  box-shadow: 1px 1px 0px #000000 !important;
  color: #000000 !important;
  padding: 0.15rem 0.35rem !important;
}

/* Custom Color Overrides for Retro Cleanliness */
.text-neutral-100 { color: #000000 !important; }
.text-neutral-200 { color: #1a202c !important; }
.text-neutral-400 { color: #4a5568 !important; }
.text-neutral-500 { color: #718096 !important; }
.text-indigo-400 { color: #2b6cb0 !important; } /* Retro Blue */
.text-rose-400 { color: #c53030 !important; } /* Retro Red */
.text-rose-500 { color: #9b2c2c !important; }

/* Custom Status Tags */
.status-tag-active {
  background-color: #c6f6d5 !important;
  color: #22543d !important;
  border: var(--retro-border-thin) !important;
  font-weight: 700;
}

.status-tag-eliminated {
  background-color: #edf2f7 !important;
  color: #4a5568 !important;
  border: var(--retro-border-thin) !important;
  text-decoration: line-through;
}

.status-tag-champion {
  background: #f6e05e !important;
  color: #744210 !important;
  border: var(--retro-border) !important;
  font-weight: 900;
  box-shadow: var(--retro-shadow-sm) !important;
}

.status-tag-runnerup {
  background-color: #cbd5e0 !important;
  color: #2d3748 !important;
  border: var(--retro-border-thin) !important;
}

/* Windows 95 Style View Detail Buttons */
.view-detail-btn {
  background: #edf2f7 !important;
  color: #000000 !important;
  border: var(--retro-border) !important;
  box-shadow: var(--retro-shadow-sm) !important;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  outline: none;
  transition: none !important;
}

.view-detail-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 0px 0px 0px #000000 !important;
}

/* Match Ticker Scroll Box (Now a vertical terminal log style) */
.match-ticker-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.75rem;
  max-height: 280px;
  overflow-y: auto;
  padding: 0.5rem;
  border: var(--retro-border);
  background: #f7fafc;
  scrollbar-width: thin;
}

/* Match Cards */
.match-ticker-container > div {
  background: #ffffff !important;
  border: var(--retro-border) !important;
  box-shadow: var(--retro-shadow-sm) !important;
  border-radius: 0px !important;
}

.match-ticker-container > div:hover {
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0px #000000 !important;
}

/* Classic retro scrollbar */
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: #edf2f7;
  border-left: var(--retro-border-thin);
}

::-webkit-scrollbar-thumb {
  background: #a0aec0;
  border: var(--retro-border-thin);
}

::-webkit-scrollbar-thumb:hover {
  background: #718096;
}

/* Modals styled like old-school popup dialogs */
dialog {
  background: #ffffff !important;
  border: var(--retro-border) !important;
  box-shadow: var(--retro-shadow-lg) !important;
  width: 90%;
  max-width: 650px;
  padding: 0;
  
  /* Bulletproof centering override */
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0 !important;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.4);
}

dialog[open] {
  animation: none !important; /* Retro snaps open instantly */
}

/* Modal Content Card Overrides */
#participant-modal-content > div > div {
  background: #ffffff !important;
  color: #000000 !important;
  border: var(--retro-border) !important;
  box-shadow: var(--retro-shadow-sm) !important;
  border-radius: 0px !important;
}

#participant-modal-content h4 {
  color: #000000 !important;
}

.text-white {
  color: #000000 !important;
}

/* Layout Utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-1 { flex: 1 1 0%; }
.flex-shrink-0 { flex-shrink: 0; }

.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }

@media (min-width: 768px) {
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .md\:col-span-2 { grid-column: span 2 / span 2; }
  .md\:p-8 { padding: 2rem; }
}

@media (max-width: 640px) {
  .hide-mobile { display: none; }
}

/* Spacing Utilities */
.m-0 { margin: 0; }
.mt-1 { margin-top: 0.25rem; }
.mt-1.5 { margin-top: 0.375rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-8 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-1.5 { margin-bottom: 0.375rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.ml-4 { margin-left: 1rem; }
.mr-2 { margin-right: 0.5rem; }
.mx-1 { margin-left: 0.25rem; margin-right: 0.25rem; }
.mx-auto { margin-left: auto; margin-right: auto; }

.p-1.5 { padding: 0.375rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-5 { padding: 1.25rem; }
.py-0.5 { padding-top: 0.125rem; padding-bottom: 0.125rem; }
.py-1.5 { padding-top: 0.375rem; padding-bottom: 0.375rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.px-1 { padding-left: 0.25rem; padding-right: 0.25rem; }
.px-1.5 { padding-left: 0.375rem; padding-right: 0.375rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.pb-2 { padding-bottom: 0.5rem; }

.space-x-1 > * + * { margin-left: 0.25rem; }
.space-x-2 > * + * { margin-left: 0.5rem; }

/* Border utilities overridden */
.border { border: var(--retro-border-thin); }
.border-b { border-bottom: var(--retro-border-thin); }
.border-t { border-top: var(--retro-border-thin); }
.border-neutral-800, .border-neutral-800\/50 { border-color: #000000 !important; }

/* Custom colors overridden to fit retro black-and-white theme */
.bg-neutral-900\/40, .bg-neutral-900\/60, .bg-neutral-900\/80, .bg-neutral-950\/60, .bg-neutral-950\/80 {
  background-color: #ffffff !important;
}

/* Typography Utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-3xl { font-size: 1.875rem; }

.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-extrabold { font-weight: 800; }
.font-black { font-weight: 900; }

.uppercase { text-transform: uppercase; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leading-none { line-height: 1; }
.leading-tight { line-height: 1.25; }
.leading-snug { line-height: 1.375; }

/* Normalized Flag/Crest Styles with clean retro borders */
.flag-crest-sm {
  width: 20px;
  height: 20px;
  object-fit: contain;
  flex-shrink: 0;
  border: var(--retro-border-thin);
  background: #ffffff;
}

.flag-crest-md {
  width: 32px;
  height: 32px;
  object-fit: contain;
  flex-shrink: 0;
  border: var(--retro-border-thin);
  background: #ffffff;
}

.flag-crest-lg {
  width: 48px;
  height: 48px;
  object-fit: contain;
  flex-shrink: 0;
  border: var(--retro-border-thin);
  background: #ffffff;
}
/* Flag Emoji Fallbacks */
.flag-emoji {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  line-height: 1;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  vertical-align: middle;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}
.flag-crest-sm.flag-emoji {
  font-size: 1rem;
  width: 20px;
  height: 20px;
}
.flag-crest-md.flag-emoji {
  font-size: 1.6rem;
  width: 32px;
  height: 32px;
}
.flag-crest-lg.flag-emoji {
  font-size: 2.2rem;
  width: 48px;
  height: 48px;
}

/* Retro icon styling override */
.icon-sm { width: 16px; height: 16px; flex-shrink: 0; }
.icon-md { width: 24px; height: 24px; flex-shrink: 0; }
.icon-lg { width: 32px; height: 32px; flex-shrink: 0; }

/* CSS Spin Loader */
.animate-spin {
  animation: spin 1s linear infinite;
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
