/* ============================================
   LQM Analytics - Global Styles
   Dark Gaming Theme: Navy / Purple / Gold
   ============================================ */

:root {
  --bg-darkest: #0a0c14;
  --bg-dark: #0f1220;
  --bg-card: #151929;
  --bg-card-hover: #1c2235;
  --bg-sidebar: #0c0f1a;
  --bg-input: #1a1f30;

  --accent-primary: #7c3aed;
  --accent-primary-glow: rgba(124, 58, 237, 0.35);
  --accent-secondary: #a855f7;
  --accent-gold: #f59e0b;
  --accent-gold-glow: rgba(245, 158, 11, 0.3);
  --accent-blue: #3b82f6;
  --accent-cyan: #06b6d4;

  --team-blue: #3b82f6;
  --team-red: #ef4444;
  --win-color: #10b981;
  --loss-color: #ef4444;
  --win-bg: rgba(16, 185, 129, 0.15);
  --loss-bg: rgba(239, 68, 68, 0.15);

  --text-primary: #f0f2ff;
  --text-secondary: #8892b0;
  --text-muted: #4a5568;

  --border-color: rgba(255, 255, 255, 0.07);
  --border-accent: rgba(124, 58, 237, 0.4);

  --sidebar-width: 240px;
  --header-height: 56px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;

  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 20px var(--accent-primary-glow);
  --transition: all 0.2s ease;
}

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

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-darkest);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

/* ==================== SIDEBAR ==================== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.5rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.logo-icon { font-size: 2rem; }

.logo-title {
  display: block;
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-gold);
  letter-spacing: 0.05em;
}

.logo-sub {
  display: block;
  font-size: 0.7rem;
  color: var(--text-secondary);
}

.nav-links { list-style: none; padding: 1rem 0; flex: 1; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
  border-left: 3px solid transparent;
  margin: 2px 0;
}

.nav-link:hover {
  color: var(--text-primary);
  background: rgba(124, 58, 237, 0.1);
  border-left-color: var(--accent-primary);
}

.nav-link.active {
  color: var(--text-primary);
  background: rgba(124, 58, 237, 0.15);
  border-left-color: var(--accent-primary);
}

.nav-icon { font-size: 1.1rem; }

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border-color);
}

.stats-mini {
  color: var(--text-muted);
  font-size: 0.8rem;
  text-align: center;
}

/* ==================== MOBILE HEADER ==================== */
.mobile-header {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-height);
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-color);
  align-items: center;
  gap: 1rem;
  padding: 0 1rem;
  z-index: 99;
}

.menu-toggle {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.3rem;
  cursor: pointer;
}

.mobile-title {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  color: var(--accent-gold);
}

/* ==================== MAIN CONTENT ==================== */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 2rem;
  min-height: 100vh;
}

/* ==================== PAGES ==================== */
.page { display: none; }
.page.active { display: block; }

.page-header { margin-bottom: 2rem; }
.page-header h1 {
  font-family: 'Rajdhani', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--text-primary), var(--accent-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-subtitle { color: var(--text-secondary); margin-top: 0.25rem; font-size: 0.9rem; }

/* ==================== CARDS ==================== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
  transition: var(--transition);
}

.card-title {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

/* ==================== SUMMARY CARDS ==================== */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.summary-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem;
  background: linear-gradient(135deg, var(--bg-card), var(--bg-card-hover));
  cursor: default;
}

.summary-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-glow); }

.card-icon { font-size: 2rem; }

.card-value {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent-gold);
}

.card-label { font-size: 0.78rem; color: var(--text-secondary); margin-top: 0.1rem; }

/* ==================== FILTER BAR ==================== */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* ==================== CHARTS ==================== */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.chart-card { min-height: 260px; margin-bottom: 1.5rem; }
.chart-full { grid-column: 1 / -1; }

.chart-tabs {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.chart-tab {
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.chart-tab:hover {
  border-color: var(--accent-primary);
  color: var(--text-primary);
}

.chart-tab.active {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: #fff;
  border-color: transparent;
}

/* ==================== TABLE ==================== */
.table-card { overflow: hidden; }

.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.table-header .card-title { margin-bottom: 0; }

.table-wrapper { overflow-x: auto; }

.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.stats-table th {
  text-align: left;
  padding: 0.65rem 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stats-table th.sortable { cursor: pointer; }
.stats-table th.sortable:hover { color: var(--accent-secondary); }

.stats-table td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

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

.stats-table tr:hover td { background: rgba(255,255,255,0.03); }

.champion-cell {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.champ-avatar-sm {
  width: 36px; height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-accent);
  flex-shrink: 0;
}

.champ-avatar-placeholder-sm {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--bg-input);
  border: 2px solid var(--border-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-pick { background: rgba(59,130,246,0.2); color: #60a5fa; }
.badge-ban { background: rgba(239,68,68,0.2); color: #f87171; }
.badge-win { background: var(--win-bg); color: #34d399; }
.badge-loss { background: var(--loss-bg); color: #f87171; }
.badge-role {
  background: rgba(124,58,237,0.2);
  color: var(--accent-secondary);
  font-size: 0.7rem;
}

.wr-bar-container { display: flex; align-items: center; gap: 0.5rem; }
.wr-bar { height: 6px; border-radius: 4px; background: var(--bg-input); width: 80px; overflow: hidden; flex-shrink: 0; }
.wr-fill { height: 100%; border-radius: 4px; transition: width 0.4s ease; }
.wr-fill.high { background: var(--win-color); }
.wr-fill.mid { background: var(--accent-gold); }
.wr-fill.low { background: var(--loss-color); }

.empty-row td { text-align: center; color: var(--text-muted); padding: 2rem; }

/* ==================== FORM / INPUTS ==================== */
.input-field {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 0.6rem 0.9rem;
  font-size: 0.875rem;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: var(--transition);
  width: 100%;
}

.input-field:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-primary-glow);
}

.input-field::placeholder { color: var(--text-muted); }

.select-input {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 0.6rem 0.9rem;
  font-size: 0.875rem;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: var(--transition);
  cursor: pointer;
}

.select-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-primary-glow);
}

.search-input { max-width: 260px; }

/* ==================== BUTTONS ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: white;
  box-shadow: 0 4px 15px var(--accent-primary-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--accent-primary-glow);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--accent-primary);
  color: var(--accent-secondary);
}
.btn-outline:hover { background: rgba(124,58,237,0.1); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover { background: rgba(255,255,255,0.05); color: var(--text-primary); }

.btn-danger {
  background: rgba(239,68,68,0.15);
  color: #f87171;
  border: 1px solid rgba(239,68,68,0.3);
}
.btn-danger:hover { background: rgba(239,68,68,0.25); }

.btn-lg { padding: 0.85rem 2rem; font-size: 1rem; border-radius: var(--radius); }
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.8rem; }

/* ==================== FORM CARD ==================== */
.match-form-container { display: flex; flex-direction: column; gap: 1.25rem; }
.form-card { }

.game-btn-group {
  display: flex;
  gap: 0.25rem;
}

.game-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
}

.game-btn:hover {
  border-color: var(--accent-primary);
  color: var(--text-primary);
}

.game-btn.active {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: #fff;
  border-color: transparent;
}

.form-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.form-group { flex: 1; min-width: 160px; }
.form-group label { display: block; font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 0.4rem; text-transform: uppercase; letter-spacing: 0.05em; }

/* ==================== DROP ZONE ==================== */
.drop-zone {
  border: 2px dashed var(--border-accent);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: rgba(124,58,237,0.04);
}

.drop-zone:hover, .drop-zone.dragging {
  border-color: var(--accent-secondary);
  background: rgba(124,58,237,0.1);
}

.drop-icon { font-size: 3rem; margin-bottom: 0.75rem; }
.drop-zone p { color: var(--text-secondary); font-size: 0.9rem; }
.drop-hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.5rem; }
.upload-link { color: var(--accent-secondary); cursor: pointer; text-decoration: underline; }

.preview-img {
  max-width: 100%;
  max-height: 400px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  margin-top: 1rem;
}

/* ==================== RESULT TOGGLE ==================== */
.result-toggle { display: flex; gap: 0.5rem; }

.result-btn {
  flex: 1;
  padding: 0.65rem;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-secondary);
  cursor: pointer;
  font-weight: 700;
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.95rem;
  transition: var(--transition);
}

.result-btn.active[data-result="blue_win"] {
  border-color: var(--team-blue, #3b82f6);
  background: rgba(59,130,246,0.15);
  color: #60a5fa;
}

.result-btn.active[data-result="red_win"] {
  border-color: var(--team-red, #ef4444);
  background: rgba(239,68,68,0.15);
  color: #f87171;
}

/* ==================== SLOTS ==================== */
.slots-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.75rem;
}

.bans-grid { grid-template-columns: repeat(4, 1fr); }

.bans-container { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
.bans-container h4 { font-size: 0.85rem; font-weight: 600; margin-bottom: 0.5rem; text-transform: uppercase; letter-spacing: 0.05em; }

.slot {
  background: var(--bg-input);
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
  transition: var(--transition);
  min-height: 80px;
  justify-content: center;
  text-align: center;
}

.slot:hover {
  border-color: var(--accent-primary);
  background: rgba(124,58,237,0.08);
  transform: scale(1.03);
}

.slot.filled { border-style: solid; border-color: var(--accent-primary); }
.slot.ban-slot.filled { border-color: var(--loss-color); }

.slot img {
  width: 48px; height: 48px;
  border-radius: 50%;
  object-fit: cover;
}

.slot-placeholder { font-size: 1.5rem; color: var(--text-muted); }
.slot-name { font-size: 0.7rem; font-weight: 600; color: var(--text-primary); line-height: 1.2; }
.slot-label { font-size: 0.65rem; color: var(--text-muted); }

.slot .slot-clear {
  display: none;
  font-size: 0.65rem;
  color: var(--loss-color);
  cursor: pointer;
  background: none;
  border: none;
}
.slot:hover .slot-clear { display: block; }

/* ==================== BAN/PICK PHASE LAYOUT ==================== */
.phase-section {
  margin-bottom: 1.25rem;
  border-radius: var(--radius-sm);
  padding: 1rem;
  border: 1px solid var(--border-color);
  background: rgba(255,255,255,0.015);
}

.phase-section.phase-ban {
  background: rgba(239,68,68,0.03);
  border-color: rgba(239,68,68,0.15);
}

.phase-section.phase-pick {
  background: rgba(59,130,246,0.03);
  border-color: rgba(59,130,246,0.15);
}

.phase-title {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.75rem;
  color: var(--text-secondary);
}

.phase-slots {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.phase-slots .slot {
  flex: 1 1 80px;
  max-width: 120px;
  min-width: 75px;
  position: relative;
}

/* Team color indicators on slots */
.slot.team-blue {
  border-color: rgba(59,130,246,0.4);
}

.slot.team-blue.filled {
  border-color: var(--team-blue);
  border-style: solid;
}

.slot.team-red {
  border-color: rgba(239,68,68,0.4);
}

.slot.team-red.filled {
  border-color: var(--team-red);
  border-style: solid;
}

/* Team indicator dot */
.slot-team-dot {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.slot.team-blue .slot-team-dot {
  background: var(--team-blue);
  box-shadow: 0 0 4px rgba(59,130,246,0.5);
}

.slot.team-red .slot-team-dot {
  background: var(--team-red);
  box-shadow: 0 0 4px rgba(239,68,68,0.5);
}

/* Step number badge */
.slot-step {
  position: absolute;
  top: 3px;
  right: 4px;
  font-size: 0.55rem;
  font-weight: 700;
  color: var(--text-muted);
  background: rgba(255,255,255,0.06);
  padding: 1px 4px;
  border-radius: 4px;
  line-height: 1;
}

@media (max-width: 900px) {
  .phase-slots .slot {
    flex: 1 1 60px;
    max-width: 100px;
    min-width: 60px;
  }
}

@media (max-width: 480px) {
  .phase-slots .slot {
    flex: 1 1 55px;
    min-width: 55px;
    max-width: 90px;
  }
  .phase-slots { gap: 0.4rem; }
}

/* ==================== CHAMPIONS PAGE ==================== */
.champion-add-form {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  flex-wrap: wrap;
}

.avatar-upload-zone {
  width: 100px; height: 100px;
  border-radius: 50%;
  border: 3px dashed var(--border-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 2rem;
  flex-shrink: 0;
  transition: var(--transition);
  overflow: hidden;
  position: relative;
}

.avatar-upload-zone:hover { border-color: var(--accent-secondary); background: rgba(124,58,237,0.1); }

.avatar-preview {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 50%;
  position: absolute;
  top: 0; left: 0;
}

.champion-fields { display: flex; flex-direction: column; gap: 0.6rem; flex: 1; min-width: 240px; }

.champion-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
  max-height: 500px;
  overflow-y: auto;
  padding: 0.25rem;
}

.champion-item {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  text-align: center;
}

.champion-item:hover { border-color: var(--accent-primary); background: var(--bg-card-hover); }

.champion-item-avatar {
  width: 60px; height: 60px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-accent);
}

.champion-item-avatar-placeholder {
  width: 60px; height: 60px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--border-accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
}

.champion-item-name { font-size: 0.8rem; font-weight: 600; color: var(--text-primary); }

.champion-item-delete {
  position: absolute; top: 4px; right: 4px;
  background: rgba(239,68,68,0.2);
  border: none;
  color: #f87171;
  border-radius: 50%;
  width: 20px; height: 20px;
  font-size: 0.7rem;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
}

.champion-item:hover .champion-item-delete { display: flex; }

.team-a { color: var(--team-blue); }
.team-b { color: var(--team-red); }

/* ==================== MATCH FILTERS ==================== */
.match-filter-row {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  align-items: flex-start;
  flex-wrap: wrap;
}

.filter-group {
  flex: 1;
  min-width: 180px;
}

.filter-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.3rem;
}

.filter-input-wrap {
  position: relative;
}

.filter-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--bg-card);
  border: 1px solid var(--border-accent);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  max-height: 260px;
  overflow-y: auto;
  box-shadow: var(--shadow-card);
}

.filter-dropdown-header {
  padding: 0.4rem 0.75rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-primary);
  background: rgba(124,58,237,0.06);
  border-top: 1px solid var(--border-color);
}

.filter-dropdown-header:first-child {
  border-top: none;
}

.filter-dropdown-item {
  padding: 0.45rem 0.75rem;
  font-size: 0.8rem;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.15s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-dropdown-item:hover {
  background: rgba(124,58,237,0.12);
}

.filter-dropdown-item img {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border-color);
  flex-shrink: 0;
}

.filter-dropdown-item .filter-champ-ph {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  flex-shrink: 0;
}

/* Selected champion tags */
.filter-champ-tags {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-top: 0.35rem;
}

.filter-champ-tag {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(124,58,237,0.15);
  border: 1px solid rgba(124,58,237,0.3);
  border-radius: 20px;
  padding: 0.15rem 0.5rem 0.15rem 0.2rem;
  font-size: 0.7rem;
  color: var(--text-primary);
}

.filter-champ-tag img {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
}

.filter-champ-tag .filter-champ-tag-ph {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg-input);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.5rem;
}

.filter-champ-tag-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 0;
  line-height: 1;
  margin-left: 0.15rem;
}

.filter-champ-tag-remove:hover {
  color: var(--loss-color);
}

/* ==================== MATCHES LIST ==================== */
.matches-list { display: flex; flex-direction: column; gap: 0.5rem; }

.match-item {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.match-item.win { border-left: 3px solid var(--win-color); }
.match-item.loss { border-left: 3px solid var(--loss-color); }

.match-result-badge {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  flex-shrink: 0;
}

.match-result-badge.win { background: var(--win-bg); color: #34d399; }
.match-result-badge.loss { background: var(--loss-bg); color: #f87171; }

.match-champs { display: flex; gap: 0.3rem; flex-wrap: wrap; }

.match-champ-icon {
  width: 28px; height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border-color);
}

.match-champ-icon-placeholder {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.6rem;
  overflow: hidden;
}

.match-meta { font-size: 0.78rem; color: var(--text-muted); }

.match-btn-group {
  display: flex;
  gap: 0.4rem;
  margin-left: auto;
  flex-shrink: 0;
}

.match-edit-btn {
  background: none;
  border: 1px solid rgba(124,58,237,0.3);
  color: #a78bfa;
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.75rem;
  transition: var(--transition);
}
.match-edit-btn:hover { background: rgba(124,58,237,0.15); }

.match-delete-btn {
  background: none;
  border: 1px solid rgba(239,68,68,0.3);
  color: #f87171;
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.75rem;
  transition: var(--transition);
}
.match-delete-btn:hover { background: rgba(239,68,68,0.15); }

/* ── Detailed match cards ── */
.match-item-detailed {
  flex-direction: column;
  align-items: stretch;
  gap: 0.75rem;
}

.match-header-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.match-teams-row {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
}

.match-team-col {
  flex: 1;
  padding: 0.6rem;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
}

.match-team-blue { border-top: 2px solid var(--team-blue); }
.match-team-red { border-top: 2px solid var(--team-red); }

/* Winner column – prominent glow & background */
.match-team-col.team-winner {
  border: 1px solid rgba(52,211,153,0.35);
  background: linear-gradient(135deg, rgba(52,211,153,0.08) 0%, rgba(16,185,129,0.04) 100%);
  box-shadow: 0 0 12px rgba(52,211,153,0.1), inset 0 0 20px rgba(52,211,153,0.03);
}

.match-team-col.team-winner.match-team-blue {
  border-top: 3px solid var(--team-blue);
  box-shadow: 0 0 14px rgba(59,130,246,0.15), inset 0 0 20px rgba(59,130,246,0.04);
  background: linear-gradient(135deg, rgba(59,130,246,0.1) 0%, rgba(52,211,153,0.05) 100%);
}

.match-team-col.team-winner.match-team-red {
  border-top: 3px solid var(--team-red);
  box-shadow: 0 0 14px rgba(239,68,68,0.15), inset 0 0 20px rgba(239,68,68,0.04);
  background: linear-gradient(135deg, rgba(239,68,68,0.1) 0%, rgba(52,211,153,0.05) 100%);
}

/* Loser column – slightly dimmed */
.match-team-col.team-loser {
  opacity: 0.65;
}

.match-team-name {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 0.4rem;
}

.match-section-label {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.4rem;
  margin-bottom: 0.2rem;
}

.match-champ-ban {
  opacity: 0.55;
  border-color: rgba(239,68,68,0.4) !important;
}

.match-empty-text {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.match-vs {
  display: flex;
  align-items: center;
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 0 0.2rem;
  align-self: center;
}

/* ── Draft order timeline ── */
.match-draft-order {
  border-top: 1px solid var(--border-color);
  padding-top: 0.5rem;
}

.match-draft-toggle {
  font-size: 0.75rem !important;
}

.draft-order-content {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.5rem;
}

.draft-step {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-color);
}

.draft-step-blue {
  border-left: 2px solid var(--team-blue);
}

.draft-step-red {
  border-left: 2px solid var(--team-red);
}

.draft-step-num {
  font-weight: 700;
  color: var(--text-muted);
  font-size: 0.6rem;
  min-width: 18px;
}

.draft-step-name {
  font-weight: 600;
  color: var(--text-primary);
}

.draft-step-phase {
  font-size: 0.6rem;
  color: var(--text-muted);
  opacity: 0.7;
}

@media (max-width: 600px) {
  .match-teams-row { flex-direction: column; }
  .match-vs { align-self: center; }
}

/* ==================== IMPORT/EXPORT ==================== */
.import-export-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.import-export-grid .card { display: flex; flex-direction: column; gap: 0.75rem; }
.import-export-grid p { color: var(--text-secondary); font-size: 0.875rem; }
.import-status { font-size: 0.85rem; padding: 0.5rem; border-radius: var(--radius-sm); }
.import-status.success { background: var(--win-bg); color: #34d399; }
.import-status.error { background: var(--loss-bg); color: #f87171; }

/* ==================== MODAL ==================== */
.modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; }

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
}

.modal-box {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  width: 520px;
  max-width: 95vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-shadow: var(--shadow-glow), var(--shadow-card);
  z-index: 1;
}

.modal-header { display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { font-family: 'Rajdhani', sans-serif; font-size: 1.3rem; font-weight: 700; }

.modal-close {
  background: none; border: none;
  color: var(--text-secondary);
  font-size: 1.2rem;
  cursor: pointer;
  transition: var(--transition);
}
.modal-close:hover { color: var(--text-primary); }

.modal-champ-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0.5rem;
  overflow-y: auto;
  max-height: 400px;
}

.modal-champ-item {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.modal-champ-item:hover { border-color: var(--accent-primary); background: rgba(124,58,237,0.1); transform: scale(1.03); }
.modal-champ-item:active { transform: scale(0.97); }

.modal-champ-img {
  width: 52px; height: 52px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-accent);
}

.modal-champ-placeholder {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--border-accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
}

.modal-champ-name { font-size: 0.7rem; font-weight: 600; color: var(--text-primary); line-height: 1.2; }

/* ── Role Selector Overlay ── */
.role-selector-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  border-radius: inherit;
  backdrop-filter: blur(4px);
}

.role-selector-box {
  background: var(--bg-card);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius);
  padding: 1.5rem;
  max-width: 320px;
  width: 90%;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

.role-selector-info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.role-selector-info img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent-primary);
}

.role-selector-info span {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-primary);
}

.role-selector-title {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.role-selector-btns {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
}

.role-selector-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1rem;
  background: rgba(124,58,237,0.1);
  border: 2px solid rgba(124,58,237,0.3);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.role-selector-btn:hover {
  background: rgba(124,58,237,0.25);
  border-color: var(--accent-primary);
  transform: scale(1.05);
}

.role-selector-btn .role-icon {
  font-size: 1.1rem;
}

.role-selector-cancel {
  margin-top: 0.75rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  text-decoration: underline;
}

.role-selector-cancel:hover {
  color: var(--text-primary);
}

/* ── Slot Role Badge ── */
.slot-role-badge {
  font-size: 0.55rem;
  color: var(--accent-primary);
  background: rgba(124,58,237,0.12);
  border-radius: 10px;
  padding: 0.1rem 0.4rem;
  margin-top: 0.1rem;
  font-weight: 600;
}

.slot-role-hint {
  color: #fbbf24;
  background: rgba(251,191,36,0.12);
  animation: pulse-hint 2s infinite;
  cursor: pointer;
}

@keyframes pulse-hint {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ── Inline Role Popup (on slot) ── */
.inline-role-popup {
  position: absolute;
  bottom: 105%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 150;
  background: var(--bg-card);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-sm);
  padding: 0.6rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  white-space: nowrap;
  text-align: center;
  min-width: 160px;
}

.inline-role-popup::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--border-accent);
}

.inline-role-title {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.inline-role-btns {
  display: flex;
  gap: 0.35rem;
  justify-content: center;
}

.role-selector-btn.role-active {
  background: rgba(52,211,153,0.2);
  border-color: #34d399;
}

/* ==================== TOAST ==================== */
.toast {
  position: fixed;
  bottom: 1.5rem; right: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1.25rem;
  font-size: 0.875rem;
  color: var(--text-primary);
  box-shadow: var(--shadow-card);
  z-index: 2000;
  transition: opacity 0.3s;
  max-width: 320px;
}

.toast.success { border-color: var(--win-color); }
.toast.error { border-color: var(--loss-color); }
.toast.toast-centered {
  bottom: auto;
  right: auto;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.1rem;
  font-weight: 700;
  padding: 1rem 2rem;
  max-width: 400px;
  text-align: center;
}

/* ==================== AI RECOGNITION ==================== */
.preview-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.btn-ai {
  background: linear-gradient(135deg, #10b981, #3b82f6);
  color: white;
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(16,185,129,0.3);
  transition: all 0.3s ease;
}

.btn-ai:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(16,185,129,0.4);
}

.btn-ai:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.ai-status {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  background: rgba(59,130,246,0.1);
  border: 1px solid rgba(59,130,246,0.2);
  color: #60a5fa;
  font-size: 0.85rem;
  margin-top: 0.75rem;
}

.ai-status.success {
  background: rgba(16,185,129,0.1);
  border-color: rgba(16,185,129,0.2);
  color: #34d399;
}

.ai-status.error {
  background: rgba(239,68,68,0.1);
  border-color: rgba(239,68,68,0.2);
  color: #f87171;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.ai-spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(96,165,250,0.3);
  border-top-color: #60a5fa;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

/* ==================== SETTINGS PAGE ==================== */
.settings-desc {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 1rem;
  line-height: 1.5;
}

.settings-desc .link {
  color: var(--accent-secondary);
  text-decoration: underline;
}

.api-key-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.api-key-row .input-field { flex: 1; }

.settings-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.api-key-status {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
}

.api-key-status.saved {
  background: var(--win-bg);
  color: #34d399;
}

.api-key-status.cleared {
  background: rgba(239,68,68,0.1);
  color: #f87171;
}

/* ==================== UTILITY ==================== */
.hidden { display: none !important; }
.empty-message { color: var(--text-muted); text-align: center; padding: 2rem; font-size: 0.9rem; }

/* ==================== SCROLLBAR ==================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: rgba(124,58,237,0.5); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-primary); }

/* ==================== RESPONSIVE ==================== */
@media (max-width: 900px) {
  .summary-cards { grid-template-columns: repeat(2, 1fr); }
  .charts-grid { grid-template-columns: 1fr; }
  .chart-full { grid-column: 1; }
  .slots-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
  .mobile-header { display: flex; }
  .sidebar {
    transform: translateX(-100%);
    top: var(--header-height);
  }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; padding: 1rem; padding-top: calc(var(--header-height) + 1rem); }
  .import-export-grid { grid-template-columns: 1fr; }
  .bans-container { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .summary-cards { grid-template-columns: 1fr 1fr; }
  .slots-grid { grid-template-columns: repeat(2, 1fr); }
}



/* ==================== DRAFT ORDER PHASES ==================== */
.draft-order-content {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.draft-phase-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.draft-phase-header {
  padding: 0.4rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.draft-phase-header-ban {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border-bottom: 1px solid rgba(239, 68, 68, 0.2);
}

.draft-phase-header-pick {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border-bottom: 1px solid rgba(16, 185, 129, 0.2);
}

.draft-phase-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
}

.draft-chip {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.6rem 0.3rem 0.4rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  font-size: 0.78rem;
  transition: transform 0.15s, box-shadow 0.15s;
}

.draft-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.draft-chip-blue {
  border-left: 3px solid #3b82f6;
  background: rgba(59, 130, 246, 0.08);
}

.draft-chip-red {
  border-left: 3px solid #ef4444;
  background: rgba(239, 68, 68, 0.08);
}

.draft-chip-num {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 18px;
}

.draft-chip-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--border);
}

.draft-chip-icon-empty {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
}

.draft-chip-name {
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

.draft-phase-ban .draft-chip-icon {
  opacity: 0.6;
  filter: grayscale(40%);
}
