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

:root {
  /* Brand Colors - Emerald Green for Sports/WorldCup vibe */
  --brand-50: #ecfdf5;
  --brand-100: #d1fae5;
  --brand-500: #10b981;
  --brand-600: #059669;
  --brand-700: #047857;

  /* Neutrals */
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-500: #64748b;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;

  /* Semantic */
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --warning: #f59e0b;
  --success: #10b981;

  /* Surfaces */
  --bg-body: var(--gray-50);
  --bg-card: rgba(255, 255, 255, 0.95);
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-glow: 0 0 20px rgba(16, 185, 129, 0.15);
}

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

body {
  min-height: 100vh;
  color: var(--gray-800);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-body);
  background-image: 
    radial-gradient(circle at 15% 50%, rgba(16, 185, 129, 0.04), transparent 25%),
    radial-gradient(circle at 85% 30%, rgba(245, 158, 11, 0.04), transparent 25%);
  background-attachment: fixed;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Layout */
.shell {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

/* Typography */
h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--gray-900);
  margin-bottom: 16px;
}

h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 20px;
}

h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--gray-800);
  margin: 24px 0 16px;
}

p {
  color: var(--gray-500);
  margin-bottom: 16px;
}

p:last-child {
  margin-bottom: 0;
}

strong {
  color: var(--gray-900);
  font-weight: 600;
}

/* Cards & Surfaces */
.card {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  padding: 32px;
  margin-bottom: 24px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Hero Section */
.hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  align-items: center;
  background: linear-gradient(145deg, #ffffff, var(--brand-50));
  border: 1px solid var(--brand-100);
  box-shadow: var(--shadow-glow);
}

@media (min-width: 768px) {
  .hero {
    grid-template-columns: 1.2fr 0.8fr;
    padding: 48px;
  }
}

/* Form Elements */
input, select, textarea {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--gray-300);
  padding: 12px 16px;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--gray-900);
  background-color: #fff;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

input::placeholder {
  color: var(--gray-400);
}

/* Buttons */
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  border: none;
  border-radius: 10px;
  background-color: var(--brand-600);
  color: white;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 12px 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(5, 150, 105, 0.2);
}

@media (min-width: 640px) {
  button {
    width: auto;
    min-width: 120px;
  }
}

button:hover {
  background-color: var(--brand-700);
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(5, 150, 105, 0.3);
}

button:active {
  transform: translateY(0);
}

button:disabled {
  background-color: var(--gray-300);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

button.secondary {
  background-color: var(--gray-100);
  color: var(--gray-700);
  box-shadow: var(--shadow-sm);
}

button.secondary:hover {
  background-color: var(--gray-200);
  color: var(--gray-900);
}

button.danger {
  background-color: var(--danger);
  box-shadow: 0 2px 4px rgba(239, 68, 68, 0.2);
}

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

/* Tabs Navigation */
.tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  margin: 16px 0;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tabs button {
  background-color: transparent;
  color: var(--gray-500);
  box-shadow: none;
  font-weight: 500;
  padding: 8px 16px;
  white-space: nowrap;
  border-radius: 8px;
  min-width: max-content;
}

.tabs button:hover {
  background-color: var(--gray-100);
  color: var(--gray-800);
  transform: none;
}

.tabs button.active {
  background-color: var(--brand-50);
  color: var(--brand-700);
  font-weight: 600;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 9999px;
  padding: 4px 12px;
  background-color: var(--brand-100);
  color: var(--brand-700);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

/* Grid Layouts */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.row {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@media (min-width: 640px) {
  .row {
    flex-direction: row;
    align-items: center;
  }
}

/* Match/Stat Cards */
.match {
  background: #ffffff;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 20px;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.match:hover {
  border-color: var(--brand-300);
  box-shadow: var(--shadow-md);
}

.match strong {
  display: block;
  font-size: 1.75rem;
  color: var(--gray-900);
  line-height: 1.2;
}

.match p {
  margin-top: 4px;
  font-size: 0.9rem;
  color: var(--gray-500);
}

/* Tables for Backend Admin */
.table-container {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--gray-200);
  background: #fff;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: left;
}

th {
  background-color: var(--gray-50);
  color: var(--gray-500);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 16px;
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}

td {
  padding: 16px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-800);
  font-size: 0.95rem;
  vertical-align: middle;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background-color: var(--gray-50);
}

td button {
  padding: 6px 12px;
  font-size: 0.85rem;
  min-width: auto;
}

td input {
  padding: 8px 12px;
  min-width: 100px;
}

/* Score Inputs */
.score-inputs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 16px 0;
}

.score-inputs input {
  width: 70px;
  text-align: center;
  font-size: 1.2rem;
  font-weight: 600;
}

.score-inputs strong {
  font-size: 1.5rem;
  color: var(--gray-400);
}

/* QR Code Box */
.qrbox {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 240px;
  border: 2px dashed var(--gray-300);
  border-radius: 16px;
  background: var(--gray-50);
  padding: 24px;
  margin: 16px 0;
  text-align: center;
}

.qrbox img, .qrbox canvas {
  margin-bottom: 16px;
  border-radius: 8px;
  padding: 12px;
  background: white;
  box-shadow: var(--shadow-sm);
}

.qrbox p {
  word-break: break-all;
  font-size: 0.85rem;
}

/* Camera Scanner */
.scanner-box {
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  background: #fff;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

#coupon-scanner {
  overflow: hidden;
  border-radius: 10px;
  background: var(--gray-900);
}

#coupon-scanner video {
  width: 100% !important;
  max-height: 360px;
  object-fit: cover;
}

#scan-status {
  margin-top: 12px;
  font-size: 0.9rem;
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%) translateY(20px);
  background: var(--gray-900);
  color: white;
  border-radius: 9999px;
  padding: 12px 24px;
  font-size: 0.95rem;
  font-weight: 500;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  z-index: 50;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Utility Classes */
.hidden {
  display: none !important;
}

.text-center {
  text-align: center;
}

.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }

/* Responsive adjustments for Mobile/H5 */
@media (max-width: 640px) {
  .shell {
    padding: 16px 12px 40px;
  }
  
  .card {
    padding: 24px 16px;
    border-radius: 12px;
  }
  
  h1 {
    font-size: 2rem;
  }

  /* Make tables scrollable on mobile */
  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}
