/* === SIRAN - Tema Utama === */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --success: #16a34a;
  --warning: #f59e0b;
  --danger: #dc2626;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
}

* { box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  min-height: 100vh;
  line-height: 1.6;
}

/* === Navbar === */
.navbar-copa {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  padding: 0.75rem 1.5rem;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}
.navbar-copa .navbar-brand {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}
.navbar-copa .navbar-brand i { font-size: 1.5rem; }
.navbar-copa .nav-link {
  color: var(--gray-600);
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  transition: all 0.15s;
}
.navbar-copa .nav-link:hover,
.navbar-copa .nav-link.active {
  color: var(--primary);
  background: var(--primary-light);
}

/* === Kad / Panel === */
.card-copa {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}
.card-copa-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--gray-100);
}
.card-copa-header h2, .card-copa-header h3 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--gray-800);
}

/* === Butang === */
.btn-primary-copa {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.5rem 1.25rem;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
  font-size: 0.9rem;
}
.btn-primary-copa:hover { background: var(--primary-dark); }
.btn-primary-copa:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-outline-copa {
  background: white;
  color: var(--primary);
  border: 1.5px solid var(--primary);
  padding: 0.5rem 1.25rem;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 0.9rem;
}
.btn-outline-copa:hover { background: var(--primary-light); }

.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
.btn-xs { padding: 0.2rem 0.5rem; font-size: 0.75rem; border-radius: 6px; }

.btn-success { background: var(--success); color: white; border: none; }
.btn-warning { background: var(--warning); color: white; border: none; }
.btn-danger { background: var(--danger); color: white; border: none; }
.btn-success:hover { background: #15803d; }
.btn-warning:hover { background: #d97706; }
.btn-danger:hover { background: #b91c1c; }

/* === Borang === */
.form-label {
  display: block;
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--gray-700);
  margin-bottom: 0.3rem;
}
.form-control {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 1.5px solid var(--gray-300);
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--gray-800);
  transition: border-color 0.15s;
  font-family: inherit;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.form-select {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 1.5px solid var(--gray-300);
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--gray-800);
  background: white;
  cursor: pointer;
  font-family: inherit;
}
.form-group { margin-bottom: 1rem; }
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* === Jadual === */
.table-copa {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.table-copa th {
  background: var(--gray-100);
  padding: 0.65rem 0.75rem;
  text-align: left;
  font-weight: 600;
  color: var(--gray-600);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--gray-200);
}
.table-copa td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}
.table-copa tr:hover td { background: var(--gray-50); }
.table-copa .text-center { text-align: center; }
.table-copa .text-right { text-align: right; }

/* === Badge === */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-blue { background: var(--primary-light); color: var(--primary); }
.badge-green { background: #dcfce7; color: #166534; }
.badge-yellow { background: #fef3c7; color: #854d0e; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-gray { background: var(--gray-100); color: var(--gray-600); }

/* === Score Display === */
.score-display {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.1rem;
}
.score-num {
  background: var(--gray-800);
  color: white;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  min-width: 2rem;
  text-align: center;
}
.score-divider { color: var(--gray-400); }

/* === Bracket Visual === */
.bracket-container {
  overflow-x: auto;
  padding: 1.5rem 0;
}
.bracket-rounds {
  display: flex;
  gap: 2rem;
  min-width: max-content;
}
.bracket-round {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  min-width: 180px;
}
.bracket-round-title {
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--gray-500);
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  text-align: center;
}
.bracket-match {
  background: white;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  padding: 0.5rem;
  margin-bottom: 0.5rem;
  min-height: 60px;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.bracket-match.winner {
  border-color: var(--success);
  background: #f0fdf4;
}
.bracket-team {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  padding: 0.15rem 0.25rem;
}
.bracket-team .team-name { font-weight: 500; }
.bracket-team .team-score { font-weight: 700; color: var(--gray-600); }
.bracket-team.winner .team-name { color: var(--success); font-weight: 700; }

/* === Tab === */
.tab-nav {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--gray-200);
  margin-bottom: 1.25rem;
  overflow-x: auto;
}
.tab-btn {
  padding: 0.6rem 1.25rem;
  border: none;
  background: none;
  font-weight: 500;
  color: var(--gray-500);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  font-size: 0.875rem;
  white-space: nowrap;
  transition: all 0.15s;
}
.tab-btn:hover { color: var(--gray-700); }
.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* === Match Grid (Liga) === */
.match-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 0.75rem;
}
.match-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}
.match-card .teams { flex: 1; font-weight: 500; font-size: 0.85rem; }
.match-card .score input {
  width: 40px;
  text-align: center;
  padding: 0.3rem;
  border: 1.5px solid var(--gray-300);
  border-radius: 6px;
  font-weight: 700;
}
.match-card.completed {
  border-left: 3px solid var(--success);
}

/* === Modal === */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal-copa {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  width: 90%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal-copa h3 { margin: 0 0 1rem 0; font-size: 1.1rem; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

/* === Toast === */
.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.toast {
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  color: white;
  font-weight: 500;
  font-size: 0.875rem;
  box-shadow: var(--shadow-md);
  animation: slideIn 0.2s ease-out;
  max-width: 380px;
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--primary); }
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* === Empty State === */
.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--gray-400);
}
.empty-state i { font-size: 2.5rem; display: block; margin-bottom: 0.75rem; }
.empty-state p { font-size: 0.9rem; margin: 0; }

/* === Quick Links === */
.quick-links {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.quick-link {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  background: var(--gray-100);
  color: var(--gray-700);
  border-radius: 20px;
  font-size: 0.8rem;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.15s;
}
.quick-link:hover { background: var(--primary-light); color: var(--primary); }

/* === Tournament Card === */
.tournament-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  transition: box-shadow 0.15s;
}
.tournament-card:hover { box-shadow: var(--shadow-md); }
.tournament-card .sport-type {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--primary-light);
  color: var(--primary);
  margin-bottom: 0.5rem;
}
.tournament-card h3 { margin: 0.25rem 0; font-size: 1.05rem; }
.tournament-card .meta {
  font-size: 0.8rem;
  color: var(--gray-500);
  margin-bottom: 0.75rem;
}

/* === Login Page === */
.login-container {
  max-width: 420px;
  margin: 5rem auto;
  padding: 1rem;
}
.login-card {
  background: white;
  border-radius: 12px;
  padding: 2rem;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--gray-200);
}
.login-card .logo {
  text-align: center;
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}
.login-card h1 {
  text-align: center;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 1.5rem;
}

/* ============================================================
   RESPONSIF — Desktop, Laptop, Tablet, Phone
   ============================================================ */

/* --- Phone (< 480px) --- */
@media (max-width: 480px) {
  body { font-size: 13px; }
  .container { padding: 0 0.4rem !important; }

  /* Navbar */
  .navbar-copa { padding: 0.4rem 0.5rem; flex-wrap: wrap; gap: 0.3rem; }
  .navbar-copa .navbar-brand { font-size: 0.9rem; }

  /* Cards */
  .card-copa { padding: 0.6rem; border-radius: 8px; }
  .card-copa-header { flex-direction: column; gap: 0.4rem; align-items: flex-start; }
  .card-copa-header h3 { font-size: 0.9rem; }

  /* Forms */
  .form-row { grid-template-columns: 1fr; gap: 0.4rem; }
  .form-control, .form-select { font-size: 0.85rem; padding: 0.5rem; }
  .modal-copa { width: 95%; padding: 1rem; max-height: 90vh; }

  /* Tabs - scrollable */
  .tab-nav { overflow-x: auto; flex-wrap: nowrap; gap: 0; }
  .tab-btn { padding: 0.4rem 0.65rem; font-size: 0.7rem; white-space: nowrap; flex-shrink: 0; }
  .sub-tab-nav { overflow-x: auto; flex-wrap: nowrap; }
  .sub-tab-btn { padding: 0.3rem 0.5rem; font-size: 0.7rem; white-space: nowrap; flex-shrink: 0; }

  /* Tables */
  .table-copa, .standings-table { font-size: 0.65rem; }
  .table-copa th, .table-copa td, .standings-table th, .standings-table td { padding: 0.25rem 0.3rem; }

  /* Grids */
  .match-grid { grid-template-columns: 1fr; gap: 0.4rem; }
  .public-match-grid { grid-template-columns: 1fr; gap: 0.5rem; }
  .group-grid { grid-template-columns: 1fr; gap: 0.5rem; }
  .tournament-card h3 { font-size: 0.85rem; }

  /* Bracket */
  .bracket-column { min-width: 110px; }
  .bracket-rounds { gap: 0.5rem; }
  .bracket-tree { justify-content: flex-start; }
  .bracket-column-header { font-size: 0.6rem; padding: 0.25rem; }
  .bracket-node { padding: 0.3rem 0.4rem; }
  .bracket-node .team-name { font-size: 0.6rem; }
  .bracket-node .team-score { font-size: 0.65rem; }

  /* Match cards */
  .judge-match-card { padding: 0.6rem; }
  .judge-match-card .match-teams { font-size: 0.85rem; }
  .judge-score-input input { width: 45px; font-size: 0.9rem; }

  /* Buttons */
  .btn-primary-copa, .btn-outline-copa { padding: 0.4rem 0.75rem; font-size: 0.78rem; }
  .btn-xs { padding: 0.2rem 0.4rem; font-size: 0.65rem; }
  .btn-sm { padding: 0.3rem 0.6rem; font-size: 0.7rem; }
  .judge-controls { gap: 0.3rem; }
  .judge-controls button { flex: 1 1 auto; min-width: 80px; }

  /* Login */
  .login-container { margin: 2rem auto; padding: 0.5rem; }
  .login-card { padding: 1.25rem; }
  .login-card h1 { font-size: 1rem; }

  /* Quick links */
  .quick-links { gap: 0.3rem; }
  .quick-link { padding: 0.25rem 0.5rem; font-size: 0.7rem; }

  /* Score display */
  .score-num { font-size: 0.8rem; padding: 0.15rem 0.4rem; }
  .public-score-big { font-size: 1.4rem; }
  .public-team-badge { font-size: 0.65rem; padding: 0.2rem 0.3rem; }
  .public-match-card { padding: 0.75rem 0.5rem; }

  /* Empty state */
  .empty-state { padding: 1.5rem 0.5rem; }
  .empty-state i { font-size: 1.8rem; }

  /* Status badge */
  .status-badge { font-size: 0.65rem; padding: 0.2rem 0.5rem; min-width: auto; }
}

/* --- Tablet (481px - 768px) --- */
@media (min-width: 481px) and (max-width: 768px) {
  .container { padding: 0 0.75rem !important; }

  .navbar-copa { padding: 0.5rem 0.75rem; }
  .card-copa { padding: 0.85rem; }
  .card-copa-header h3 { font-size: 1rem; }

  .form-row { gap: 0.6rem; }
  .modal-copa { width: 92%; max-height: 88vh; }

  .tab-btn { padding: 0.5rem 0.85rem; font-size: 0.78rem; }
  .sub-tab-btn { padding: 0.35rem 0.7rem; font-size: 0.75rem; }

  .match-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0.5rem; }
  .public-match-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 0.6rem; }
  .group-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.6rem; }

  .bracket-column { min-width: 130px; }
  .bracket-rounds { gap: 0.75rem; }

  .table-copa, .standings-table { font-size: 0.72rem; }
  .table-copa th, .table-copa td, .standings-table th, .standings-table td { padding: 0.35rem 0.4rem; }

  .login-container { margin: 3rem auto; }
}

/* --- Laptop kecil (769px - 992px) --- */
@media (min-width: 769px) and (max-width: 992px) {
  .match-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
  .public-match-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
  .group-grid { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
  .bracket-column { min-width: 150px; }
}

/* --- Laptop & Desktop (992px+) --- */
@media (min-width: 993px) {
  .match-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
  .public-match-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
  .group-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
}

/* --- Sentuhan mudah (touch devices) --- */
@media (hover: none) and (pointer: coarse) {
  .btn-primary-copa, .btn-outline-copa, .btn-call, .btn-start, .btn-end,
  .tab-btn, .sub-tab-btn, .quick-link {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
  input, select, .form-control, .form-select {
    min-height: 44px;
    font-size: 16px !important; /* Elak iOS zoom */
  }
}

/* === Cetakan === */
@media print {
  /* Reset */
  body { background: white !important; color: black !important; font-size: 10pt; font-family: Arial, sans-serif; }
  .container { max-width: 100% !important; width: 100% !important; padding: 0 !important; margin: 0 !important; }

  /* Hide interactive elements */
  .navbar-copa, .tab-nav, .sub-tab-nav, .modal-overlay, .toast-container,
  .quick-links, .no-print, form, button, .form-row, .card-copa-header button,
  .match-card button, .modal-actions, .btn, .judge-controls,
  select, input, .form-select, #statusBar, #btnGenerate, #btnAdvance,
  .public-status-tag, .live-dot, #liveDot, .bracket-column-header,
  #resultsGroupFilter, #schFilter, #pubStFilter, #pubScheduleFilter,
  #standingsGroupFilter, .sub-tab-btn { display: none !important; }

  /* Show ALL tab content */
  .tab-content { display: block !important; margin-bottom: 1rem; }
  .tab-content > * { display: block !important; }
  [id$=KnockoutContent], [id$=GroupContent] { display: block !important; }

  /* Cards */
  .card-copa, .standings-card, .tournament-card {
    box-shadow: none !important;
    border: 1px solid #ddd !important;
    padding: 0.5rem !important;
    margin-bottom: 0.5rem !important;
    break-inside: avoid;
    background: white !important;
  }
  .card-copa-header, .standings-card-header {
    background: #eee !important;
    color: black !important;
    border-bottom: 2px solid #999 !important;
    padding: 0.3rem 0.5rem !important;
    margin-bottom: 0.3rem !important;
  }
  .card-copa-header h3, .standings-card-header { font-size: 11pt !important; }

  /* Tables */
  .table-copa, .standings-table {
    font-size: 9pt !important;
    width: 100% !important;
    border-collapse: collapse !important;
  }
  .table-copa th, .standings-table th {
    background: #ddd !important;
    color: black !important;
    font-weight: 700 !important;
    padding: 2px 4px !important;
    border: 1px solid #999 !important;
  }
  .table-copa td, .standings-table td {
    padding: 2px 4px !important;
    border: 1px solid #ccc !important;
  }

  /* Match cards */
  .match-card, .public-match-card, .judge-match-card, .bracket-node {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
    background: white !important;
    padding: 0.3rem 0.5rem !important;
    break-inside: avoid;
  }
  .match-card.completed { border-left: 3px solid #333 !important; }
  .score-num { background: #333 !important; color: white !important; }
  .score-display { font-size: 10pt !important; }

  /* Bracket */
  .bracket-container { overflow-x: visible !important; }
  .bracket-tree { overflow-x: visible !important; flex-wrap: wrap !important; }
  .bracket-column { min-width: 120px !important; }
  .bracket-match { border: 1px solid #999 !important; padding: 0.2rem !important; }
  .bracket-team { font-size: 8pt !important; }

  /* Group cards */
  .group-card { border: 1px solid #ccc !important; box-shadow: none !important; }
  .group-grid { display: block !important; }

  /* Links */
  a { color: black !important; text-decoration: none !important; }

  /* Status badges */
  .status-badge {
    background: #eee !important;
    color: black !important;
    border: 1px solid #999 !important;
  }

  /* Public cards */
  .public-team-badge { background: #eee !important; color: black !important; }
  .public-team-badge.home, .public-team-badge.away { background: #eee !important; color: black !important; }
  .public-score-big { font-size: 14pt !important; color: black !important; }
  .public-vs-badge { background: #333 !important; color: white !important; }
  .public-match-card::before { display: none !important; }

  /* Heading */
  h2, h3, h4 { color: black !important; }
  .match-grid, .public-match-grid { gap: 0.25rem !important; }

  /* Empty states */
  .empty-state { color: #999 !important; }

  @page {
    margin: 0.6cm;
    size: auto;
  }
}

/* === Utility === */
.text-muted { color: var(--gray-500); font-size: 0.85rem; }
.text-danger { color: var(--danger); }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.me-1 { margin-right: 0.5rem; }
.ms-1 { margin-left: 0.5rem; }
.gap-2 { gap: 0.5rem; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.w-100 { width: 100%; }
.text-center { text-align: center; }
.font-bold { font-weight: 600; }
.pointer { cursor: pointer; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* === Status Perlawanan (Sistem Juri) === */
.status-badge {
  display: inline-block;
  padding: 0.35rem 0.85rem;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.8rem;
  text-align: center;
  min-width: 130px;
}
.status-pending {
  background: #475569;
  color: white;
}
.status-calling {
  background: #f97316;
  color: #dc2626;
  animation: status-blink 1s infinite;
}
.status-live {
  background: #16a34a;
  color: white;
}
.status-completed {
  background: #dc2626;
  color: white;
}

@keyframes status-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* === Butang Kawalan Juri === */
.judge-controls {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}
.btn-call {
  background: #f97316;
  color: #dc2626;
  border: 2px solid #f97316;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-call:hover { background: #ea580c; color: white; }
.btn-start {
  background: #16a34a;
  color: white;
  border: none;
  padding: 0.5rem 1.5rem;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-start:hover { background: #15803d; }
.btn-end {
  background: #dc2626;
  color: white;
  border: none;
  padding: 0.5rem 1.5rem;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-end:hover { background: #b91c1c; }

/* === Judge Match Panel === */
.judge-match-card {
  background: white;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}
.judge-match-card.calling {
  border-color: #f97316;
  box-shadow: 0 0 12px rgba(249,115,22,0.2);
}
.judge-match-card.live {
  border-color: #16a34a;
  box-shadow: 0 0 12px rgba(22,163,74,0.2);
}
.judge-match-card .match-round {
  font-size: 0.75rem;
  color: var(--gray-500);
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}
.judge-match-card .match-teams {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}
.judge-score-input {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
}
.judge-score-input input {
  width: 60px;
  text-align: center;
  padding: 0.5rem;
  border: 2px solid var(--gray-300);
  border-radius: 8px;
  font-size: 1.2rem;
  font-weight: 700;
}
.judge-score-input input:focus {
  border-color: var(--primary);
  outline: none;
}
.judge-score-input .vs-text {
  font-weight: 700;
  color: var(--gray-400);
}

/* === Public Match Card (Live & Results) - Design Profesional === */
.public-match-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}
.public-match-card {
  background: white;
  border-radius: 14px;
  padding: 1.25rem 1rem 0.9rem;
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  border: 1.5px solid var(--gray-200);
  transition: all 0.3s;
}
.public-match-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.1);
}

/* Status bar at top */
.public-match-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
}
.public-match-card.live::before {
  background: linear-gradient(90deg, #16a34a, #22c55e);
}
.public-match-card.calling::before {
  background: linear-gradient(90deg, #f97316, #fb923c);
  animation: status-blink-bar 1s infinite;
}
.public-match-card.completed::before {
  background: linear-gradient(90deg, #2563eb, #3b82f6);
}
.public-match-card.pending::before {
  background: var(--gray-300);
}

/* Match content */
.public-match-teams {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}
.public-team-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}
.public-team-badge {
  background: var(--gray-100);
  border-radius: 10px;
  padding: 0.4rem 0.6rem;
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--gray-800);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  width: 100%;
  line-height: 1.2;
}
.public-team-badge.home { background: #eff6ff; color: #2563eb; }
.public-team-badge.away { background: #fef2f2; color: #dc2626; }
.public-score-big {
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--gray-900);
  line-height: 1;
  letter-spacing: -1px;
}
.public-score-big.score-live { color: #16a34a; }
.public-score-big.score-wait { color: var(--gray-400); font-size: 1.5rem; }
.public-vs-badge {
  background: var(--gray-800);
  color: white;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.25rem 0.45rem;
  border-radius: 50%;
  width: 28px; height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.public-match-footer {
  font-size: 0.7rem;
  color: var(--gray-500);
  margin-top: 0.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}
.public-status-tag {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 10px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.public-status-tag.live { background: #dcfce7; color: #166534; }
.public-status-tag.calling { background: #fff7ed; color: #c2410c; }
.public-status-tag.completed { background: #dbeafe; color: #1e40af; }
.public-status-tag.pending { background: var(--gray-100); color: var(--gray-500); }

@keyframes status-blink-bar {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* === Standings Table Professional === */
.standings-card {
  background: white;
  border-radius: 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  border: 1px solid var(--gray-200);
  overflow: hidden;
  margin-bottom: 1rem;
}
.standings-card-header {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: white;
  padding: 0.75rem 1.25rem;
  font-weight: 700;
  font-size: 0.95rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.standings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.standings-table th {
  background: var(--gray-50);
  padding: 0.6rem 0.6rem;
  font-weight: 700;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-500);
  border-bottom: 2px solid var(--gray-200);
}
.standings-table td {
  padding: 0.55rem 0.6rem;
  border-bottom: 1px solid var(--gray-100);
}
.standings-table tr:hover td { background: #f8fafc; }
.standings-table .rank-col { width: 36px; text-align: center; font-weight: 700; }
.standings-table .team-col { font-weight: 600; }
.standings-table .stat-col { text-align: center; font-size: 0.8rem; }
.standings-table .points-col {
  text-align: center;
  font-weight: 800;
  font-size: 0.95rem;
  color: #2563eb;
}
.standings-table .top-position td { background: #eff6ff; }
.standings-table tr:first-child td { font-weight: 600; }

/* === Knockout Bracket Tree - Dramatik & Profesional === */
.bracket-tree {
  display: flex;
  align-items: stretch;
  gap: 0;
  overflow-x: auto;
  padding: 1.5rem 0.5rem;
  justify-content: center;
  min-width: max-content;
}
.bracket-column {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  gap: 0;
  min-width: 190px;
  position: relative;
}
.bracket-column-header {
  text-align: center;
  font-weight: 800;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: white;
  background: linear-gradient(135deg, #1e40af, #2563eb);
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
  margin-bottom: 0.75rem;
}
.bracket-column-header.final {
  background: linear-gradient(135deg, #b8860b, #ffd700);
  color: #333;
}
.bracket-node {
  background: white;
  border: 2px solid var(--gray-200);
  border-radius: 12px;
  padding: 0.6rem 0.75rem;
  margin: 0.25rem 0;
  position: relative;
  transition: all 0.3s;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}
.bracket-node:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.1);
}
.bracket-node.winner {
  border-color: #16a34a;
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
  box-shadow: 0 0 12px rgba(22,163,74,0.15);
}
.bracket-node .team-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.2rem 0;
  gap: 0.5rem;
}
.bracket-node .team-row:first-child {
  border-bottom: 1px solid var(--gray-100);
  margin-bottom: 0.15rem;
  padding-bottom: 0.25rem;
}
.bracket-node .team-name {
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--gray-800);
}
.bracket-node .team-name.advancing {
  color: #16a34a;
}
.bracket-node .team-score {
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--gray-900);
  min-width: 24px;
  text-align: center;
}
.bracket-node .team-score.winning {
  color: #16a34a;
}
.bracket-node .team-placeholder {
  color: var(--gray-400);
  font-style: italic;
  font-size: 0.75rem;
}
.bracket-node .node-round-label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-500);
  margin-bottom: 0.2rem;
  text-align: center;
}
.bracket-connector {
  display: flex;
  align-items: center;
  min-width: 40px;
  position: relative;
}
.bracket-connector svg {
  width: 40px;
  height: 100%;
}
.bracket-connector-line {
  stroke: var(--gray-300);
  stroke-width: 2;
  fill: none;
}

/* Gold/Silver/Bronze accents */
.bracket-node.winner.champion {
  border-color: #b8860b;
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
  box-shadow: 0 0 20px rgba(184,134,11,0.25);
}
.bracket-node.winner.champion .team-name { color: #92400e; font-size: 0.85rem; }
.bracket-node.winner.champion .team-score { color: #92400e; font-size: 0.9rem; }

/* Empty live state */
.public-live-empty {
  text-align: center;
  padding: 2rem;
  color: var(--gray-500);
}
.public-live-empty .icon-big {
  font-size: 3rem;
  display: block;
  margin-bottom: 0.5rem;
  color: var(--gray-300);
}
.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #16a34a;
  animation: status-blink 0.8s infinite;
}

/* === User Management Table === */
.user-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  margin-bottom: 0.5rem;
  background: white;
}
.user-list-item .user-info {
  display: flex;
  flex-direction: column;
}
.user-list-item .user-name { font-weight: 600; }
.user-list-item .user-email { font-size: 0.8rem; color: var(--gray-500); }

/* === Group Management === */
.group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.group-card {
  background: white;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}
.group-card h4 {
  margin: 0 0 0.75rem 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.group-team-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.group-team-list li {
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid var(--gray-100);
  font-size: 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.group-team-list li:last-child { border-bottom: none; }
.group-team-list .institution-tag {
  font-size: 0.7rem;
  color: var(--gray-500);
  background: var(--gray-100);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
}
.group-empty {
  text-align: center;
  color: var(--gray-400);
  font-size: 0.8rem;
  padding: 0.5rem;
}
.group-controls {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

/* Unassigned Teams */
.unassigned-section {
  margin-top: 1.5rem;
  border-top: 2px dashed var(--gray-300);
  padding-top: 1rem;
}
