/* Western Cup 2026 Scavenger Hunt — Mobile-First Stylesheet */

:root {
  --primary: #6B21A8;
  --primary-dark: #581C87;
  --accent: #FACC15;
  --accent-dark: #EAB308;
  --success: #16a34a;
  --success-light: #dcfce7;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.12);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--gray-800);
  background: var(--gray-50);
  line-height: 1.5;
  min-height: 100dvh;
}

/* ---------- Layout ---------- */

.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px;
}

.container--wide {
  max-width: 960px;
}

/* ---------- Typography ---------- */

h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: 4px; }
h2 { font-size: 1.25rem; font-weight: 600; margin-bottom: 8px; }
h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 4px; }

.subtitle {
  color: var(--gray-500);
  font-size: 0.875rem;
}

/* ---------- Header ---------- */

.header {
  background: var(--primary);
  color: white;
  padding: 24px 16px;
  text-align: center;
  border-radius: var(--radius);
  margin: 16px;
  box-shadow: var(--shadow-md);
}

.header h1 {
  color: white;
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.header .subtitle {
  color: var(--accent);
  font-weight: 700;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  min-width: 44px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
  text-decoration: none;
}

.btn--primary {
  background: var(--primary);
  color: white;
}
.btn--primary:hover { background: var(--primary-dark); }
.btn--primary:disabled { background: var(--gray-300); cursor: not-allowed; }

.btn--loading {
  pointer-events: none;
  opacity: 0.7;
  position: relative;
}
.btn--loading .btn__label { visibility: hidden; }
.btn--loading::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.btn--outline.btn--loading::after,
.btn--ghost.btn--loading::after {
  border-color: rgba(0,0,0,0.15);
  border-top-color: var(--gray-600);
}

.btn--danger {
  background: var(--danger);
  color: white;
}

.btn--outline {
  background: white;
  color: var(--gray-700);
  border: 1px solid var(--gray-300);
}
.btn--outline:hover { background: var(--gray-100); }

.btn--ghost {
  background: transparent;
  color: white;
  border: 1px solid rgba(255,255,255,0.4);
}
.btn--ghost:hover { background: rgba(255,255,255,0.15); }

.btn--small {
  min-height: 36px;
  padding: 6px 14px;
  font-size: 0.85rem;
}

.btn--block {
  display: flex;
  width: 100%;
}

/* ---------- Cards ---------- */

.card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 12px;
}

.card--submitted {
  border-left: 4px solid var(--success);
}

.card--empty {
  border-left: 4px solid var(--gray-300);
}

.card--warning {
  background: #fffbeb;
  border-left: 4px solid #f59e0b;
}

.card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.card__number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.card__status {
  font-size: 0.8rem;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 500;
}

.card__status--submitted {
  background: var(--success-light);
  color: var(--success);
}

.card__status--pending {
  background: var(--gray-100);
  color: var(--gray-500);
}

/* ---------- Upload Zone ---------- */

.upload-zone {
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius);
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  min-height: 44px;
}

.upload-zone:hover,
.upload-zone--dragover {
  border-color: var(--primary);
  background: rgba(107, 33, 168, 0.04);
}

.upload-zone__text {
  color: var(--gray-500);
  font-size: 0.9rem;
}

.upload-zone__icon {
  font-size: 2rem;
  color: var(--gray-400);
  margin-bottom: 8px;
}

.upload-zone__hint {
  color: var(--gray-400);
  font-size: 0.75rem;
  margin-top: 6px;
}

/* ---------- Thumbnail ---------- */

.thumbnail {
  width: 100%;
  max-height: 300px;
  object-fit: contain;
  border-radius: var(--radius);
  background: var(--gray-100);
}

.thumbnail--selfie {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
}

.thumbnail--small {
  width: 60px;
  height: 60px;
  border-radius: 6px;
  object-fit: cover;
}

/* ---------- Members ---------- */

.member-slot {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--gray-100);
}

.member-slot:last-child {
  border-bottom: none;
}

.member-thumb {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.member-thumb--empty {
  background: var(--gray-100);
  border: 2px dashed var(--gray-300);
}

.member-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.member-name-input {
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 14px;
  width: 100%;
  max-width: 200px;
}

.member-actions {
  display: flex;
  gap: 6px;
  margin-top: 2px;
}

.member-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.member-grid__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.member-grid__item img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
}

/* ---------- Toggle ---------- */

.toggle-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
}

.toggle {
  position: relative;
  width: 52px;
  height: 30px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle__slider {
  position: absolute;
  inset: 0;
  background: var(--gray-300);
  border-radius: 15px;
  cursor: pointer;
  transition: background 0.2s;
}

.toggle__slider::before {
  content: '';
  position: absolute;
  width: 24px;
  height: 24px;
  left: 3px;
  top: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
}

.toggle input:checked + .toggle__slider {
  background: var(--success);
}

.toggle input:checked + .toggle__slider::before {
  transform: translateX(22px);
}

.toggle__label {
  font-size: 0.9rem;
  color: var(--gray-700);
}

/* Small toggle variant for per-photo sharing */
.toggle--small {
  width: 40px;
  height: 24px;
}

.toggle--small .toggle__slider::before {
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
}

.toggle--small input:checked + .toggle__slider::before {
  transform: translateX(16px);
}

.sharing-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0 4px;
  border-top: 1px solid var(--gray-200);
}

/* ---------- Favourite Button ---------- */

.favourite-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.favourite-btn {
  background: none;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 1.25rem;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
  color: var(--gray-400);
  transition: color 0.15s, border-color 0.15s;
}
.favourite-btn:hover {
  color: var(--danger);
  border-color: var(--danger);
}
.favourite-btn--active {
  color: var(--danger);
  border-color: var(--danger);
}
.favourite-btn--claimed {
  color: var(--gray-300);
  border-color: var(--gray-200);
  cursor: default;
  opacity: 0.6;
}

/* ---------- Progress Bar ---------- */

.progress {
  width: 100%;
  height: 6px;
  background: var(--gray-200);
  border-radius: 3px;
  overflow: hidden;
}

.progress__bar {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
  transition: width 0.3s;
}

.progress__bar--complete {
  background: var(--success);
}

/* ---------- Countdown ---------- */

.countdown {
  background: var(--warning-light);
  padding: 12px 16px;
  border-radius: var(--radius);
  text-align: center;
  font-weight: 500;
  margin-bottom: 16px;
}

.countdown--expired {
  background: var(--danger-light);
  color: var(--danger);
}

/* ---------- Star Rating ---------- */

.stars {
  display: flex;
  gap: 4px;
}

.star {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--gray-300);
  transition: color 0.1s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.star--filled {
  color: var(--warning);
}

.star:hover {
  color: var(--warning);
}

.score-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.score-label {
  font-size: 0.8rem;
  color: var(--gray-500);
  min-width: 70px;
}

/* ---------- Modal ---------- */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay--active {
  display: flex;
}

.modal {
  background: white;
  border-radius: var(--radius);
  max-width: 500px;
  width: 100%;
  max-height: 90dvh;
  overflow-y: auto;
  padding: 20px;
  position: relative;
}

.modal__close {
  position: absolute;
  top: 8px;
  right: 8px;
  min-height: 44px;
  min-width: 44px;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--gray-500);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal img {
  width: 100%;
  border-radius: var(--radius);
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--gray-800);
  color: white;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  z-index: 2000;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.toast--visible {
  opacity: 1;
}

.toast--success { background: var(--success); }
.toast--error { background: var(--danger); }

/* ---------- Forms ---------- */

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 4px;
}

.form-input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 1rem;
  color: var(--gray-800);
  background: white;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(107, 33, 168, 0.15);
}

/* ---------- Tabs ---------- */

.tabs {
  display: flex;
  border-bottom: 2px solid var(--gray-200);
  margin-bottom: 16px;
  overflow-x: auto;
}

.tab {
  min-height: 44px;
  padding: 10px 16px;
  border: none;
  background: none;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--gray-500);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
}

.tab--active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ---------- Table ---------- */

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--gray-200);
}

th {
  font-weight: 600;
  color: var(--gray-600);
  background: var(--gray-50);
}

/* ---------- Badge ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge--success { background: var(--success-light); color: var(--success); }
.badge--warning { background: var(--warning-light); color: var(--warning); }
.badge--gray { background: var(--gray-100); color: var(--gray-500); }

/* ---------- Save Indicator ---------- */

.save-indicator {
  font-size: 0.8rem;
  color: var(--success);
  opacity: 0;
  transition: opacity 0.3s;
}

.save-indicator--visible {
  opacity: 1;
}

/* ---------- Navigation ---------- */

.nav-buttons {
  display: flex;
  gap: 8px;
  justify-content: space-between;
  padding: 12px 0;
  position: sticky;
  bottom: 0;
  background: var(--gray-50);
  border-top: 1px solid var(--gray-200);
}

/* ---------- Upload Progress ---------- */

.upload-progress {
  margin-top: 8px;
}

.upload-progress__bar {
  width: 100%;
  height: 4px;
  background: var(--gray-200);
  border-radius: 2px;
  overflow: hidden;
}

.upload-progress__fill {
  height: 100%;
  background: var(--primary);
  transition: width 0.2s;
}

/* ---------- Responsive ---------- */

@media (min-width: 768px) {
  .container { padding: 24px; }
  h1 { font-size: 1.75rem; }

  .judge-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
}

/* ---------- Utilities ---------- */

.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.text-center { text-align: center; }
.text-small { font-size: 0.85rem; }
.text-muted { color: var(--gray-500); }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; }
.hidden { display: none !important; }

/* ---------- Loading Spinner ---------- */

@keyframes spin { to { transform: rotate(360deg); } }

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto;
}

.loading-container {
  text-align: center;
  padding: 48px 16px;
}

.loading-container .spinner {
  margin-bottom: 12px;
}

.loading-container p {
  color: var(--gray-500);
  font-size: 0.875rem;
}
