@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
  /* Color Palette - HSL values for design control */
  --bg-primary-hsl: 222, 47%, 8%;
  --bg-secondary-hsl: 222, 47%, 4%;
  
  --accent-cyan: hsl(190, 100%, 50%);
  --accent-cyan-glow: hsla(190, 100%, 50%, 0.15);
  --accent-neon: hsl(142, 76%, 45%);
  --accent-neon-glow: hsla(142, 76%, 45%, 0.15);
  --accent-gold: hsl(45, 100%, 50%);
  --accent-gold-glow: hsla(45, 100%, 50%, 0.2);
  --accent-crimson: hsl(342, 100%, 50%);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --glass-bg: rgba(15, 23, 42, 0.45);
  --glass-border: rgba(255, 255, 255, 0.06);
  --glass-border-focus: rgba(190, 100%, 50%, 0.4);
  --glass-highlight: rgba(255, 255, 255, 0.03);

  --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --glow-shadow: 0 0 20px rgba(6, 182, 212, 0.15);
  
  --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

body {
  font-family: var(--font-main);
  background: radial-gradient(circle at 50% 0%, hsl(222, 47%, 12%), hsl(var(--bg-secondary-hsl)));
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 2rem 1rem;
  overflow-x: hidden;
  line-height: 1.5;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: hsl(var(--bg-secondary-hsl));
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Typography */
h1 {
  font-size: 2.5rem;
  font-weight: 800;
  text-align: center;
  background: linear-gradient(135deg, #ffffff 30%, var(--accent-cyan) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
  letter-spacing: -0.025em;
  text-transform: uppercase;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
  text-align: center;
  margin-bottom: 2rem;
  font-weight: 400;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Glassmorphism Card base */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 2rem;
  width: 100%;
  max-width: 580px;
  box-shadow: var(--card-shadow);
  position: relative;
  overflow: hidden;
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.glass-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 100%;
  background: linear-gradient(180deg, var(--glass-highlight) 0%, transparent 100%);
  pointer-events: none;
}

/* Configuration Warning Banner */
.config-banner {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 16px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  color: #fca5a5;
  text-align: center;
  max-width: 580px;
  width: 100%;
}
.config-banner h4 {
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.config-banner code {
  background: rgba(0, 0, 0, 0.3);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-family: monospace;
}

/* Match Header & Flag Logos */
.match-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 1.5rem 0;
  gap: 1rem;
}

.team-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  text-align: center;
}

.team-logo-wrapper {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.03);
  border: 2px dashed rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
  margin-bottom: 1rem;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), border-color 0.3s ease;
  box-shadow: inset 0 0 15px rgba(0,0,0,0.5);
  user-select: none;
}

.team-logo-wrapper.has-logo {
  border-style: solid;
  border-color: rgba(255, 255, 255, 0.2);
}

.team-container:hover .team-logo-wrapper {
  transform: scale(1.1) rotate(5deg);
  border-color: var(--accent-cyan);
}

.team-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  min-height: 2.5rem;
  display: flex;
  align-items: center;
}

.vs-divider {
  font-size: 1.5rem;
  font-weight: 900;
  font-style: italic;
  color: var(--text-muted);
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.05);
}

/* Score Input Controls */
.score-selector {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
}

.score-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  font-size: 1.5rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

.score-btn:hover:not(:disabled) {
  background: var(--accent-cyan);
  color: #0b0f19;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.3);
  transform: translateY(-2px);
}

.score-btn:active:not(:disabled) {
  transform: translateY(0);
}

.score-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.score-value {
  font-size: 3rem;
  font-weight: 800;
  width: 50px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
  user-select: none;
}

/* Timer styles */
.timer-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 1.5rem 0;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 16px;
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.timer-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.timer-display {
  display: flex;
  gap: 1rem;
}

.timer-segment {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.timer-val {
  font-size: 1.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent-cyan);
  text-shadow: 0 0 10px var(--accent-cyan-glow);
}

.timer-unit {
  font-size: 0.65rem;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.timer-divider {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-muted);
  line-height: 1;
}

.progress-bar-bg {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
  margin-top: 1rem;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-neon));
  border-radius: 3px;
  transition: width 1s linear;
}

/* Locked Prediction UI */
.locked-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
  padding: 0.5rem 1rem;
  border-radius: 50px;
  font-size: 0.875rem;
  font-weight: 600;
  margin-top: 0.5rem;
  animation: pulse 2s infinite;
}

/* User Form fields */
.form-group {
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 1rem;
  color: var(--text-muted);
  pointer-events: none;
  font-size: 1.1rem;
}

.form-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 0.85rem 1rem 0.85rem 2.75rem;
  font-size: 1rem;
  font-family: var(--font-main);
  color: var(--text-primary);
  outline: none;
  transition: all 0.3s ease;
}

.form-input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px var(--accent-cyan-glow);
  background: rgba(0, 0, 0, 0.4);
}

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

/* Submit and Action Buttons */
.submit-btn {
  width: 100%;
  background: linear-gradient(135deg, var(--accent-cyan), #0284c7);
  color: #0b0f19;
  border: none;
  border-radius: 14px;
  padding: 1rem;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 15px rgba(6, 182, 212, 0.2);
  margin-top: 1.5rem;
}

.submit-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(6, 182, 212, 0.4);
  background: linear-gradient(135deg, #22d3ee, var(--accent-cyan));
}

.submit-btn:active:not(:disabled) {
  transform: translateY(0);
}

.submit-btn:disabled {
  background: var(--text-muted);
  color: rgba(255, 255, 255, 0.3);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Submitted Success State Card */
.success-state {
  text-align: center;
  padding: 1rem 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.success-icon-ring {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: var(--accent-neon-glow);
  border: 2px solid var(--accent-neon);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.25rem;
  color: var(--accent-neon);
  margin-bottom: 1.5rem;
  animation: scaleUp 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  box-shadow: 0 0 20px var(--accent-neon-glow);
}

.success-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: #fff;
}

.success-desc {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
  max-width: 300px;
}

.prediction-receipt {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 1.25rem;
  border-radius: 16px;
  width: 100%;
  margin-bottom: 1.5rem;
}

.receipt-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
}
.receipt-row:last-child {
  margin-bottom: 0;
  border-top: 1px dashed rgba(255, 255, 255, 0.1);
  padding-top: 0.75rem;
}

.receipt-label {
  color: var(--text-secondary);
}

.receipt-value {
  font-weight: 600;
  color: var(--text-primary);
}

.receipt-value.highlight {
  color: var(--accent-cyan);
}

.reset-btn {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.reset-btn:hover {
  border-color: var(--text-secondary);
  color: white;
}

/* Admin Dashboard layout */
.admin-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  width: 100%;
  max-width: 1200px;
}

@media(min-width: 900px) {
  .admin-grid {
    grid-template-columns: 450px 1fr;
    align-items: start;
  }
  .admin-panel-card {
    max-width: 100%;
  }
}

.admin-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 0.75rem;
}

.admin-card-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.badge-count {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  padding: 0.15rem 0.5rem;
  font-size: 0.75rem;
  border-radius: 50px;
  color: var(--text-secondary);
}

/* Tabs or Section switch */
.tab-container {
  display: flex;
  background: rgba(0,0,0,0.2);
  border-radius: 12px;
  padding: 0.25rem;
  margin-bottom: 1.5rem;
  border: 1px solid rgba(255,255,255,0.03);
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 0.6rem;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.875rem;
  transition: all 0.2s ease;
}

.tab-btn.active {
  background: rgba(255,255,255,0.08);
  color: white;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}

/* Custom Toggle Switch for Admin settings */
.switch-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

/* Flag selection preset helper */
.flag-preset-container {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.5rem;
  margin-top: 0.5rem;
  background: rgba(0,0,0,0.15);
  padding: 0.5rem;
  border-radius: 8px;
}

.flag-preset-btn {
  font-size: 1.5rem;
  background: transparent;
  border: none;
  cursor: pointer;
  border-radius: 6px;
  padding: 0.25rem;
  transition: background 0.2s ease;
}

.flag-preset-btn:hover {
  background: rgba(255,255,255,0.08);
}

/* Submissions Table / Cards */
.sub-table-container {
  overflow-x: auto;
  margin-top: 1rem;
}

.sub-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.sub-table th, .sub-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.sub-table th {
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
}

.sub-table td {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.sub-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
  color: white;
}

.name-cell {
  font-weight: 600;
  color: white !important;
}

.phone-cell {
  font-family: monospace;
}

.prediction-cell {
  font-weight: 700;
  color: var(--accent-cyan);
}

.prediction-cell.correct {
  color: var(--accent-neon);
}

.time-cell {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Winner Podium Design */
.podium-container {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 0.75rem;
  margin-top: 2rem;
  margin-bottom: 2.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  min-height: 200px;
}

.podium-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100px;
  position: relative;
}

.podium-winner-card {
  text-align: center;
  margin-bottom: 0.75rem;
  width: 100%;
}

.podium-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin: 0 auto 0.5rem;
  position: relative;
  box-shadow: 0 5px 15px rgba(0,0,0,0.5);
  font-weight: bold;
}

.podium-step-1 .podium-avatar {
  background: linear-gradient(135deg, #ffe066, var(--accent-gold));
  color: #5c4300;
  border: 2px solid #fff;
  width: 56px;
  height: 56px;
  font-size: 1.75rem;
}

.podium-step-2 .podium-avatar {
  background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
  color: #334155;
  border: 2px solid #f1f5f9;
}

.podium-step-3 .podium-avatar {
  background: linear-gradient(135deg, #f59e0b, #b45309);
  color: #fff;
  border: 2px solid #fbbf24;
}

.podium-crown {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%) rotate(-5deg);
  font-size: 1.25rem;
  filter: drop-shadow(0 2px 5px rgba(0,0,0,0.5));
}

.podium-w-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 95px;
}

.podium-w-time {
  font-size: 0.65rem;
  color: var(--text-muted);
}

.podium-w-pred {
  font-size: 0.75rem;
  font-weight: bold;
  color: var(--accent-neon);
}

.podium-pillar {
  width: 100%;
  border-radius: 12px 12px 0 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.06) 0%, rgba(255,255,255,0.01) 100%);
  border: 1px solid rgba(255,255,255,0.05);
  border-bottom: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.5rem;
  color: rgba(255,255,255,0.15);
}

.podium-step-1 .podium-pillar {
  height: 90px;
  border-top-color: var(--accent-gold-glow);
  background: linear-gradient(180deg, rgba(250, 204, 21, 0.1) 0%, rgba(250, 204, 21, 0) 100%);
}

.podium-step-2 .podium-pillar {
  height: 60px;
  border-top-color: rgba(203, 213, 225, 0.3);
}

.podium-step-3 .podium-pillar {
  height: 40px;
  border-top-color: rgba(245, 158, 11, 0.2);
}

/* Admin Passcode screen */
.passcode-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 1.5rem;
}

.passcode-icon {
  font-size: 3rem;
  color: var(--accent-cyan);
  margin-bottom: 1.5rem;
  text-shadow: 0 0 15px var(--accent-cyan-glow);
}

.search-bar {
  margin: 1rem 0;
  position: relative;
}
.search-input {
  width: 100%;
  background: rgba(0,0,0,0.15);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 10px;
  padding: 0.6rem 0.6rem 0.6rem 2.2rem;
  font-size: 0.85rem;
  color: white;
  outline: none;
  transition: border-color 0.2s ease;
}
.search-input:focus {
  border-color: var(--accent-cyan);
}
.search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Toast Notifications */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  padding: 1rem 1.5rem;
  border-radius: 16px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: white;
  font-weight: 500;
  z-index: 1000;
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
  pointer-events: none;
  font-size: 0.95rem;
  max-width: 90%;
  text-align: center;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast-icon {
  font-size: 1.25rem;
}

.toast-success .toast-icon { color: var(--accent-neon); }
.toast-error .toast-icon { color: #ef4444; }
.toast-info .toast-icon { color: var(--accent-cyan); }

/* Confetti canvas */
#confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 999;
}

/* Animations */
@keyframes scaleUp {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

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

/* Helper utilities */
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }
.text-center { text-align: center; }
.flex-row { display: flex; align-items: center; gap: 0.5rem; }
.text-accent-neon { color: var(--accent-neon); }

/* Flag picker grid inside active match configuration */
.flag-picker-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.flag-picker-row input {
  flex: 1;
}
.flag-preview-indicator {
  font-size: 2rem;
  width: 45px;
  height: 45px;
  border-radius: 8px;
  background: rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--glass-border);
}

/* Custom styling for select option elements */
#cfg-match-preset option {
  background-color: #0d121f;
  color: #fff;
  padding: 0.5rem;
}
#cfg-match-preset:focus {
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 3px var(--accent-gold-glow);
}
