/* Seket Admin - Dark Sports UI */
/* Design tokens */
:root {
  --navy-900: #081836;
  --panel-950: #0b1222;
  --panel-900: #0e1930;
  --panel-800: #122140;
  --accent-yellow: #ffd200;
  --blue-500: #1158ed;
  --blue-300: #3f7cff;
  --text: #e8eef6;
  --text-muted: #a9b8cc;
  --text-tertiary: #7d8ca3;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --shadow-color: rgba(0, 0, 0, 0.4);

  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
}

/* Global */
* { box-sizing: border-box; }
html, body {
  background: var(--navy-900);
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", sans-serif;
  line-height: 1.45;
}
body { margin: 0; }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--space-4);
}

.vis-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: linear-gradient(180deg, var(--panel-950), var(--panel-900));
  border-bottom: 1px solid var(--border);
  box-shadow: 0 6px 24px -12px var(--shadow-color);
}
.app-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
}
.app-header-cards {
  padding: 0 var(--space-4) var(--space-3);
}
.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}
.brand-badge {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent-yellow);
  color: #0b0f19;
  font-weight: 900;
  letter-spacing: 0.2px;
}
.brand-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.brand-title .title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.2px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-title .subtitle {
  font-size: 12px;
  color: var(--text-tertiary);
}

.scoreboard {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--panel-800);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  white-space: nowrap;
}
.chip strong { font-weight: 800; }
.chip-accent {
  border-color: var(--accent-yellow);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.06);
}
.chip-muted {
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

/* Sync banner */
.sync-banner {
  background: var(--panel-900);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin: var(--space-4) 0;
}
.sync-banner .status {
  font-size: 13px;
  color: var(--text-muted);
}
.sync-banner .status strong {
  color: var(--text);
}

/* Buttons */
.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--panel-800);
  color: var(--text);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 160ms ease, transform 120ms ease, border-color 160ms ease, color 160ms ease, box-shadow 120ms ease;
}
.btn:hover { background: #162a52; }
.btn:active { transform: translateY(1px); }
.btn[disabled],
.btn[aria-busy="true"] {
  opacity: 0.6;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--accent-yellow);
  color: #0b0f19;
  border-color: rgba(0,0,0,0.2);
}
.btn-primary:hover {
  background: #ffdb33;
}
.btn-secondary {
  background: var(--panel-900);
  color: var(--text);
}
.btn-quiet {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
}
.btn-quiet:hover {
  color: var(--text);
  background: rgba(255,255,255,0.04);
}

/* Inputs */
input[type="text"], input[type="search"], select {
  width: 100%;
  background: var(--panel-900);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
  transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}
input::placeholder { color: var(--text-tertiary); }
input:focus-visible {
  border-color: var(--accent-yellow);
  box-shadow: 0 0 0 2px rgba(255,210,0,0.25);
}

/* Sections */
.card {
  background: linear-gradient(180deg, var(--panel-950), var(--panel-900));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: 0 10px 30px -18px var(--shadow-color);
}
.section-title {
  margin: 0 0 var(--space-3) 0;
  font-size: 16px;
  font-weight: 800;
  color: #fff;
}
.section-description { color: var(--text-muted); font-size: 13px; margin-top: -2px; }

.config-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-3);
  align-items: center;
}

/* Match list */
.list-title {
  margin: var(--space-5) 0 var(--space-3);
  font-size: 18px;
  font-weight: 800;
  color: #fff;
}
.empty-state {
  display: grid;
  place-items: center;
  padding: 36px 16px;
  color: var(--text-tertiary);
  background: var(--panel-900);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
}
.loading-state {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--panel-900);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-muted);
}
.loading-spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: var(--accent-yellow);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.match-card {
  background: linear-gradient(180deg, var(--panel-950), var(--panel-900));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-3);
  box-shadow: 0 8px 28px -16px var(--shadow-color);
  transition: transform 120ms ease, box-shadow 160ms ease, border-color 160ms ease;
}
.match-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 34px -16px var(--shadow-color);
}
.match-card.is-next {
  border-color: var(--accent-yellow);
  box-shadow: 0 10px 36px -14px rgba(255,210,0,0.18);
}
.match-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-3);
  border-bottom: 1px solid var(--border);
  padding-bottom: var(--space-3);
  margin-bottom: var(--space-3);
}
.teams {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--space-3);
}
.team {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}
.team .name {
  font-weight: 800;
  color: #fff;
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vs {
  font-weight: 900;
  color: var(--text-tertiary);
  letter-spacing: 0.6px;
}
.logo {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--panel-800);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  overflow: hidden;
  flex: 0 0 auto;
}
.logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.avatar-initials {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  font-weight: 900;
  color: #0b0f19;
  background: var(--accent-yellow);
  letter-spacing: 0.3px;
}
.match-meta {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-top: 4px;
}
.match-date-inline {
  display: none;
  margin-right: 8px;
  color: var(--text);
  font-weight: 800;
}
.match-badge {
  background: rgba(255,255,255,0.06);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-weight: 800;
  font-size: 12px;
  white-space: nowrap;
}

.roles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-3);
}
.role-box {
  background: var(--panel-900);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  transition: border-color 160ms ease, background-color 160ms ease;
}
.role-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 800;
  margin-bottom: 6px;
  text-transform: none;
  letter-spacing: 0.2px;
}
.role-badge {
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 800;
  border: 1px solid var(--border);
  color: var(--text-tertiary);
  background: rgba(255,255,255,0.04);
}
.role-badge.filled {
  color: #0f2913;
  background: #bdf7c9;
  border-color: #6bd98a;
}

/* Utilities */
.row { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.grow { flex: 1 1 auto; }
.muted { color: var(--text-tertiary); }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .btn, .match-card { transition: none !important; }
  .btn:active { transform: none !important; }
}

/* Responsive */
@media (max-width: 720px) {
  .app-header-inner {
    /* Stack brand over status chips on small screens for readability */
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-2);
  }
  .brand-title .title { 
    /* Allow full club names to wrap instead of truncating */
    white-space: normal; 
    line-height: 1.2;
  }
  .brand-title .subtitle { white-space: normal; }
  .scoreboard { 
    width: 100%; 
    justify-content: flex-start; 
    overflow-x: auto; 
    padding-bottom: 2px; 
  }
  .chip { font-size: 12px; padding: 6px 10px; }
  .header-actions { width: 100%; justify-content: flex-start; }
  .config-grid { grid-template-columns: 1fr; }
  /* Put kick-off pill under teams on mobile to avoid empty right column */
  .match-header { grid-template-columns: 1fr; }
  .match-badge { justify-self: start; margin-top: 2px; }
  .teams { grid-template-columns: minmax(0,1fr); gap: 6px; }
  .vs { display: none; }
  /* Let long team names wrap on mobile */
  .team .name { white-space: normal; text-overflow: clip; }
  .logo { width: 38px; height: 38px; }
  .roles-grid { grid-template-columns: 1fr 1fr; }
}

/* Show inline date on desktop (keep time pill visible too) */
@media (min-width: 721px) {
  .match-date-inline { display: inline; }
}

@media (max-width: 480px) {
  .roles-grid { grid-template-columns: 1fr; }
  .mini-team .name {
    /* Two-line clamp for long names in header carousel */
    white-space: normal;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
  }
  .mini-logo { width: 24px; height: 24px; }
  .chip { font-size: 12px; padding: 6px 8px; }
}

/* Focus ring */
:where(a, button, input, select, [tabindex]) :focus-visible,
:where(a, button, input, select, [tabindex]):focus-visible {
  outline: 2px solid var(--accent-yellow);
  outline-offset: 2px;
}

/* Header mini-carousel */
.header-carousel {
  position: relative;
}
.carousel-rail {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
  padding-bottom: 2px;
}
.carousel-rail::-webkit-scrollbar { height: 6px; }
.carousel-rail::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 8px; }
.mini-match {
  background: var(--panel-900);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  min-width: 230px;
  scroll-snap-align: start;
  box-shadow: 0 4px 18px -12px var(--shadow-color);
}
.mini-match.active {
  border-color: var(--accent-yellow);
  box-shadow: 0 6px 22px -12px rgba(255,210,0,0.2);
}
.mini-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
}
.mini-team {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.mini-team .name {
  font-weight: 800;
  font-size: 12px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mini-logo {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--panel-800);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  overflow: hidden;
  flex: 0 0 auto;
}
.mini-logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mini-initials {
  font-size: 11px;
  font-weight: 900;
  color: #0b0f19;
  background: var(--accent-yellow);
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
}
.mini-vs { color: var(--text-tertiary); font-weight: 900; }
.mini-meta {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-tertiary);
  font-size: 12px;
}
.mini-date {
  color: #fff;
  font-weight: 900;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  white-space: nowrap;
}
.mini-resources {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.mini-resources-count {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}
.mini-role-dots {
  display: flex;
  align-items: center;
  gap: 4px;
}
.role-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.06);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.06) inset;
}
.role-dot.filled {
  background: #6bd98a;
  border-color: #40c56c;
}
.role-dot.open {
  background: #ff6b6b;
  border-color: #ff6b6b;
  box-shadow: 0 0 0 1px rgba(255,107,107,0.25) inset;
}
.mini-match.has-open {
  border-color: rgba(255,107,107,0.6);
}
.mini-empty {
  color: var(--text-tertiary);
  font-size: 12px;
}
.carousel-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.carousel-nav:hover { background: rgba(255,255,255,0.1); }
.carousel-nav.left { left: -4px; }
.carousel-nav.right { right: -4px; }
