:root {
  /* Faceit-inspired Palette */
  --bg-main: #121212;
  --bg-surface: #1e1e1e;
  --bg-surface-alt: #262626;
  --bg-header: #0f0f0f;

  --brand-primary: #ff5500; /* Faceit Orange */
  --brand-hover: #ff6a22;

  /* CS2 Faction Colors - High Contrast */
  --ct-color: #54a9ff;
  --ct-bg: rgba(84, 169, 255, 0.08);
  --t-color: #ebb045;
  --t-bg: rgba(235, 176, 69, 0.08);

  /* Typography */
  --text-primary: #ffffff;
  --text-secondary: #cccccc;
  --text-muted: #777777;
  --text-inverse: #000000;

  /* Status Colors */
  --success: #00ff55;
  --danger: #ff4444;
  --warning: #ffcc00;

  /* Dimensions */
  --max-width: 1280px;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  /* Fonts */
  --font-base: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Roboto Mono', monospace;
}

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

body {
  font-family: var(--font-base);
  background-color: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { border: none; background: none; font-family: inherit; }

/* ---------------- HEADER ---------------- */
.header {
  background-color: var(--bg-header);
  border-bottom: 1px solid #333;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  text-transform: uppercase;
  color: var(--text-primary);
}
.logo span { color: var(--brand-primary); }

.header-actions {
  display: flex;
  gap: 12px;
}

.api-status {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 8px;
  background: #333;
  border-radius: var(--radius-sm);
  color: #aaa;
}

/* ---------------- MAIN LAYOUT ---------------- */
.main {
  flex: 1;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 32px 24px;
}

/* ---------------- INPUT HERO ---------------- */
.input-section {
  margin-bottom: 40px;
  text-align: center;
}

.input-group {
  display: inline-flex;
  background: var(--bg-surface);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid #333;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  transition: border-color 0.2s;
  width: 100%;
  max-width: 600px;
}

.input-group:focus-within {
  border-color: var(--brand-primary);
}

.input-group input {
  flex: 1;
  background: transparent;
  border: none;
  color: white;
  padding: 12px 16px;
  font-size: 1rem;
  outline: none;
  font-family: var(--font-mono);
}

.btn-primary {
  background: var(--brand-primary);
  color: white;
  padding: 10px 24px;
  font-weight: 700;
  font-size: 0.9rem;
  text-transform: uppercase;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary:hover { background: var(--brand-hover); }
.btn-primary:disabled { background: #444; color: #888; cursor: not-allowed; }

.input-hint {
  margin-top: 12px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ---------------- STATUS BAR ---------------- */
.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
  border: 1px solid #333;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  margin-bottom: 24px;
}

.status-indicator { display: flex; align-items: center; gap: 10px; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: #444; }
.status-text { font-weight: 600; font-size: 0.9rem; }

.status-indicator.connecting .status-dot { background: var(--warning); animation: pulse 1s infinite; }
.status-indicator.waiting-match .status-dot { background: var(--brand-primary); animation: pulse 2s infinite; }
.status-indicator.done .status-dot { background: var(--success); }
.status-indicator.error .status-dot { background: var(--danger); }

.match-info {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text-secondary);
}

@keyframes pulse { 50% { opacity: 0.5; } }

/* ---------------- TABS ---------------- */
.tab-nav {
  display: flex;
  gap: 32px;
  margin-bottom: 24px;
  border-bottom: 1px solid #333;
}

.tab-btn {
  padding: 12px 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
}

.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active {
  color: var(--brand-primary);
  border-bottom-color: var(--brand-primary);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeUp 0.3s ease; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------------- GRID & LAYOUT ---------------- */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

/* ---------------- CARDS ---------------- */
.card {
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  padding: 24px;
  margin-bottom: 24px;
  border: 1px solid transparent;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ---------------- TEAM CARDS ---------------- */
.team-card {
  background: var(--bg-surface);
  border-top: 4px solid #444;
  padding: 0;
}

.team-card.ct { border-top-color: var(--ct-color); }
.team-card.t { border-top-color: var(--t-color); }

.team-header {
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-surface-alt);
  border-bottom: 1px solid #333;
}

.team-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  font-size: 1.2rem;
  text-transform: uppercase;
  font-style: italic;
}

.team-card.ct .team-title { color: var(--ct-color); }
.team-card.t .team-title { color: var(--t-color); }

.team-icon { width: 0; display: none; }

/* ---------------- TEAM STATS ROW ---------------- */
.team-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 16px;
  gap: 1px;
  background: #333;
}

.stat-card {
  background: var(--bg-surface);
  text-align: center;
  padding: 8px;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: 4px;
  font-weight: 600;
}

/* ---------------- TABLES ---------------- */
.table-wrapper {
  width: 100%;
  overflow-x: auto;
}

.player-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.player-table th {
  text-align: left;
  padding: 12px 16px;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  border-bottom: 1px solid #333;
}

.player-table td {
  padding: 12px 16px;
  vertical-align: middle;
  border-bottom: 1px solid #2a2a2a;
  color: var(--text-secondary);
}

.player-table tr:last-child td { border-bottom: none; }
.player-table tbody tr:hover { background: var(--bg-surface-alt); }

.player-table tr.self {
  background: rgba(255, 255, 255, 0.05);
}

/* Player Cell */
.player-cell { min-width: 200px; }
.player { display: flex; align-items: center; gap: 12px; }

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 4px;
  background: #333;
  object-fit: cover;
}
.avatar.placeholder { display: flex; align-items: center; justify-content: center; color: #555; }

.player-meta { display: flex; flex-direction: column; line-height: 1.3; }
.player-name { font-weight: 700; color: var(--text-primary); }
.player-sub { font-size: 0.75rem; color: var(--text-muted); font-family: var(--font-mono); }

/* ---------------- BADGES & PILLS ---------------- */
.pill {
  display: inline-block;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-primary);
}

.pill-good { color: var(--success); }
.pill-warn { color: var(--warning); }
.pill-bad { color: var(--danger); }
.pill-neutral { color: var(--text-muted); }

.tag {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}

.tag-green { background: rgba(0, 255, 85, 0.15); color: var(--success); }
.tag-no { background: rgba(255, 68, 68, 0.15); color: var(--danger); }
.tag-pac { background: var(--danger); color: white; }
.tag-ready { background: var(--success); color: black; }
.tag-pending { background: var(--warning); color: black; }

/* ---------------- ANALYSIS WIDGET ---------------- */
.analysis-bar {
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  padding: 24px;
  margin-bottom: 24px;
  border: 1px solid #333;
}

.analysis-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.analysis-metrics { display: flex; gap: 16px; }

.analysis-pill {
  font-size: 0.9rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 4px;
  background: #2a2a2a;
}
.analysis-pill.your { border-left: 3px solid var(--ct-color); }
.analysis-pill.opp { border-left: 3px solid var(--t-color); }

.analysis-chart {
  background: #151515;
  border-radius: var(--radius-sm);
  padding: 16px;
  height: 200px;
}
.trend-chart { width: 100%; height: 100%; }

.analysis-legend {
  margin-top: 16px;
  display: flex;
  justify-content: center;
  gap: 24px;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; }
.legend-dot.your { background: var(--ct-color); }
.legend-dot.opp { background: var(--t-color); }

/* ---------------- OVERVIEW & SCOREBOARD ---------------- */
.match-scoreboard {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 40px;
  padding: 20px;
  background: var(--bg-surface-alt);
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  border: 1px solid #333;
}

.score-team {
  text-align: center;
}
.score-team-name {
  font-weight: 800;
  font-size: 1.2rem;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.score-team.ct .score-team-name { color: var(--ct-color); }
.score-team.t .score-team-name { color: var(--t-color); }

.score-val {
  font-family: var(--font-mono);
  font-size: 3rem;
  font-weight: 700;
  line-height: 1;
}

.score-divider {
  font-size: 1.5rem;
  color: #444;
  font-weight: 300;
}

.match-meta-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.meta-item {
  background: var(--bg-surface-alt);
  padding: 12px;
  border-radius: var(--radius-sm);
  text-align: center;
}
.meta-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; margin-bottom: 4px; }
.meta-value { font-weight: 700; font-size: 0.95rem; }

/* ---------------- UTILS & MOBILE ---------------- */
.hide-sm { display: table-cell; }
.mono { font-family: var(--font-mono); }
.text-muted { color: var(--text-muted); }
.hint { font-size: 0.85rem; color: var(--text-muted); margin-top: 4px; }
.hint.error { color: var(--danger); }

.control-row { display: flex; align-items: center; gap: 12px; }
.select {
  background: var(--bg-surface-alt);
  border: 1px solid #444;
  color: white;
  padding: 6px 10px;
  border-radius: 4px;
  outline: none;
}
.select:focus { border-color: var(--brand-primary); }

.btn-secondary {
  background: var(--bg-surface-alt);
  color: white;
  border: 1px solid #444;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-secondary:hover { border-color: white; }

.btn-xs {
  padding: 4px 8px;
  font-size: 0.75rem;
}

.footer {
  text-align: center;
  padding: 40px;
  color: #444;
  font-size: 0.8rem;
  border-top: 1px solid #222;
  margin-top: auto;
}

/* ---------------- RESPONSIVE ---------------- */
@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
  .team-stats { grid-template-columns: repeat(2, 1fr); gap: 1px; }
}

@media (max-width: 600px) {
  .header { padding: 0 16px; }
  .main { padding: 24px 16px; }
  .hide-sm { display: none; }
  .input-group { flex-direction: column; border: none; background: transparent; box-shadow: none; gap: 12px; }
  .input-group input { background: var(--bg-surface); border: 1px solid #333; border-radius: var(--radius-sm); width: 100%; }
  .btn-primary { width: 100%; }
  .status-bar { flex-direction: column; align-items: flex-start; gap: 12px; }
  .analysis-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .tab-nav { gap: 20px; }
  .match-scoreboard { gap: 20px; }
  .score-val { font-size: 2rem; }
  .match-meta-grid { grid-template-columns: 1fr 1fr; }
}
