/* ========================================
   R6 STATS - Design System
   Tema: Tático, militar, limpo
   Cores baseadas no universo R6 Siege
   ======================================== */

:root {
  /* Cores principais - Paleta R6 */
  --r6-orange: #FF6B00;        /* Laranja principal R6 */
  --r6-orange-dim: #E85D00;    /* Hover/active */
  --r6-orange-light: #FF8C33;  /* Accents claros */
  --r6-orange-bg: rgba(255, 107, 0, 0.08);

  --r6-blue: #00A3E0;          /* Azul atacante */
  --r6-blue-dim: #0088B8;
  --r6-blue-bg: rgba(0, 163, 224, 0.08);

  --r6-green: #00C853;         /* Verde defensor/sucesso */
  --r6-red: #FF3D00;           /* Vermelho morte/derrota */

  /* Neutros - Dark theme base */
  --bg-deep: #0A0C0E;          /* Quase preto - base */
  --bg-card: #111418;          /* Cards */
  --bg-card-hover: #151A20;    /* Cards hover */
  --bg-elevated: #1A1F26;      /* Modais, dropdowns */
  --bg-input: #161B22;         /* Inputs */

  --border-subtle: #242A33;    /* Bordas sutis */
  --border-muted: #2D3540;     /* Bordas normais */
  --border-focus: var(--r6-orange);

  --text-primary: #E8ECEF;     /* Texto principal */
  --text-secondary: #9AA4B2;   /* Texto secundário */
  --text-muted: #6B7688;       /* Texto muted */
  --text-inverse: #0A0C0E;     /* Texto sobre laranja/azul */

  /* Tipografia */
  --font-display: 'Rajdhani', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Escala de tipo */
  --text-xs: 0.6875rem;   /* 11px */
  --text-sm: 0.8125rem;   /* 13px */
  --text-base: 0.9375rem; /* 15px */
  --text-lg: 1.0625rem;   /* 17px */
  --text-xl: 1.25rem;     /* 20px */
  --text-2xl: 1.5rem;     /* 24px */
  --text-3xl: 2rem;       /* 32px */
  --text-4xl: 2.75rem;    /* 44px */

  /* Espaçamento */
  --space-1: 0.25rem;  /* 4px */
  --space-2: 0.5rem;   /* 8px */
  --space-3: 0.75rem;  /* 12px */
  --space-4: 1rem;     /* 16px */
  --space-5: 1.25rem;  /* 20px */
  --space-6: 1.5rem;   /* 24px */
  --space-8: 2rem;     /* 32px */
  --space-10: 2.5rem;  /* 40px */
  --space-12: 3rem;    /* 48px */
  --space-16: 4rem;    /* 64px */

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Sombras */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 24px rgba(255, 107, 0, 0.15);

  /* Transições */
  --transition-fast: 120ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;

  /* Layout */
  --header-height: 64px;
  --sidebar-width: 260px;
  --content-max: 1280px;
  --container-padding: var(--space-6);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg-deep: #F5F7FA;
    --bg-card: #FFFFFF;
    --bg-card-hover: #EEF2F7;
    --bg-elevated: #FFFFFF;
    --bg-input: #F0F3F8;

    --border-subtle: #E1E6ED;
    --border-muted: #D0D7E0;

    --text-primary: #1A1F26;
    --text-secondary: #4A5363;
    --text-muted: #7A8494;
    --text-inverse: #FFFFFF;
  }
}

/* ========================================
   Reset & Base
   ======================================== */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-deep);
  min-height: 100vh;
}

/* Tipografia */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-primary);
}

h1 { font-size: var(--text-4xl); font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: var(--text-3xl); font-weight: 600; letter-spacing: -0.01em; }
h3 { font-size: var(--text-2xl); font-weight: 600; }
h4 { font-size: var(--text-xl); font-weight: 600; }
h5 { font-size: var(--text-lg); font-weight: 600; }
h6 { font-size: var(--text-base); font-weight: 600; }

.text-display {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.text-mono {
  font-family: var(--font-mono);
}

/* Links */
a {
  color: var(--r6-orange);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: var(--r6-orange-light); }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-muted); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Selection */
::selection {
  background: var(--r6-orange-bg);
  color: var(--text-primary);
}

/* Focus visible */
:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

/* ========================================
   Layout Principal - Top Nav
   ======================================== */

.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header + Nav combined */
.header {
  height: var(--header-height);
  background: rgba(10, 12, 14, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--container-padding);
  position: sticky;
  top: 0;
  z-index: 100;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.header-brand::before {
  content: "";
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--r6-orange), var(--r6-orange-light));
  border-radius: var(--radius-md);
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M12 2L2 7v10l10 5 10-5V7L12 2zm0 2.5L19 6.5V17.5L12 21.5 5 17.5V6.5L12 4.5zM10 17V11h4v6h-4z'/%3E%3C/svg%3E") center/contain;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M12 2L2 7v10l10 5 10-5V7L12 2zm0 2.5L19 6.5V17.5L12 21.5 5 17.5V6.5L12 4.5zM10 17V11h4v6h-4z'/%3E%3C/svg%3E") center/contain;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex: 1;
  justify-content: center;
  overflow-x: auto;
  padding: var(--space-1) 0;
  margin: 0 var(--space-4);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}

/* Nav tabs - horizontal */
.nav-tabs {
  display: flex;
  gap: var(--space-1);
  background: var(--bg-input);
  padding: var(--space-1);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: all var(--transition-fast);
  border: none;
  cursor: pointer;
  background: transparent;
  white-space: nowrap;
}
.nav-tab:hover {
  color: var(--text-primary);
  background: var(--bg-card-hover);
}
.nav-tab.active {
  color: var(--text-inverse);
  background: var(--r6-orange);
}
.nav-tab svg { width: 18px; height: 18px; flex-shrink: 0; }

@media (max-width: 768px) {
  .header {
    height: auto;
    padding: var(--space-3) var(--container-padding);
    gap: var(--space-3);
  }
  .header-nav {
    order: 3;
    width: 100%;
    justify-content: flex-start;
    margin: var(--space-2) 0 0 0;
  }
  .header-brand {
    order: 1;
  }
  .header-actions {
    order: 2;
  }
}

/* Main Content */
.main {
  flex: 1;
  padding: var(--container-padding);
  max-width: var(--content-max);
  width: 100%;
  margin: 0 auto;
}

.page { display: none; }
.page.active { display: block; animation: fadeIn 0.2s ease; }

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

/* ========================================
   Componentes Base
   ======================================== */

/* Botões */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--r6-orange);
  color: var(--text-inverse);
  border-color: var(--r6-orange);
}
.btn-primary:hover:not(:disabled) {
  background: var(--r6-orange-dim);
  border-color: var(--r6-orange-dim);
  box-shadow: var(--shadow-glow);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-muted);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--bg-card-hover);
  border-color: var(--border-focus);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover:not(:disabled) {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.btn-danger {
  background: transparent;
  color: var(--r6-red);
  border-color: var(--r6-red);
}
.btn-danger:hover:not(:disabled) {
  background: rgba(255, 61, 0, 0.1);
}

.btn-sm { padding: var(--space-1) var(--space-3); font-size: var(--text-xs); }
.btn-lg { padding: var(--space-3) var(--space-6); font-size: var(--text-base); }

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  transition: all var(--transition-fast);
}
.card:hover { border-color: var(--border-muted); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
}
.card-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
}

/* Inputs */
.form-group { margin-bottom: var(--space-4); }
.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--r6-orange-bg);
  outline: none;
}
.form-input::placeholder { color: var(--text-muted); }
.form-textarea { min-height: 100px; resize: vertical; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-ranked { background: var(--r6-orange-bg); color: var(--r6-orange); }
.badge-unranked { background: var(--r6-blue-bg); color: var(--r6-blue); }
.badge-win { background: rgba(0, 200, 83, 0.12); color: var(--r6-green); }
.badge-loss { background: rgba(255, 61, 0, 0.12); color: var(--r6-red); }
.badge-season { background: var(--bg-elevated); color: var(--text-secondary); border: 1px solid var(--border-subtle); }

/* Tabs */
.tabs {
  display: flex;
  gap: var(--space-1);
  background: var(--bg-input);
  padding: var(--space-1);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}
.tab-btn {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active {
  color: var(--text-inverse);
  background: var(--r6-orange);
}

/* Table */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.table th {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  font-weight: 600;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-input);
}
.table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition-fast);
}
.table tr:hover td { background: var(--bg-card-hover); }
.table tr:last-child td { border-bottom: none; }

/* KDA Cell */
.kda-cell {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}
.kda-k { color: var(--r6-green); }
.kda-d { color: var(--r6-red); }
.kda-a { color: var(--r6-blue); }
.kda-sep { color: var(--text-muted); }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}
.modal-overlay.open { opacity: 1; visibility: visible; }

.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95) translateY(10px);
  transition: transform var(--transition-base);
  box-shadow: var(--shadow-xl);
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-5);
}
.modal-title { font-family: var(--font-display); font-size: var(--text-xl); font-weight: 600; }
.modal-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.modal-close:hover { background: var(--bg-card-hover); color: var(--text-primary); border-color: var(--border-muted); }

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-4);
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  text-align: center;
}
.stat-value {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 700;
  line-height: 1;
  color: var(--text-primary);
}
.stat-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-top: var(--space-2);
}
.stat-sub { font-size: var(--text-sm); color: var(--text-secondary); margin-top: var(--space-1); }

/* Operator Card */
.operator-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}
.operator-card:hover { border-color: var(--border-muted); background: var(--bg-card-hover); }
.operator-icon { width: 40px; height: 40px; border-radius: var(--radius-md); object-fit: cover; flex-shrink: 0; }
.operator-info { flex: 1; min-width: 0; }
.operator-name { font-weight: 500; font-size: var(--text-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.operator-meta { font-size: var(--text-xs); color: var(--text-muted); display: flex; gap: var(--space-3); margin-top: var(--space-1); }
.operator-stats { font-family: var(--font-mono); font-size: var(--text-sm); color: var(--text-secondary); }

/* Empty State */
.empty-state {
  text-align: center;
  padding: var(--space-12) var(--space-4);
  color: var(--text-muted);
}
.empty-state svg { width: 64px; height: 64px; margin-bottom: var(--space-4); opacity: 0.5; }
.empty-state h3 { font-size: var(--text-lg); color: var(--text-secondary); margin-bottom: var(--space-2); }
.empty-state p { font-size: var(--text-sm); max-width: 320px; margin: 0 auto; }

/* Toast */
.toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 280px;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
}
@keyframes slideIn { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); } }
.toast.success { border-left: 3px solid var(--r6-green); }
.toast.error { border-left: 3px solid var(--r6-red); }
.toast.info { border-left: 3px solid var(--r6-blue); }

/* Mobile Menu Button */
.mobile-menu-btn {
  display: none;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  cursor: pointer;
}
@media (max-width: 1024px) { .mobile-menu-btn { display: flex; } }

/* Grid Layout */
.grid { display: grid; }

/* Form Dots (recent form) */
.form-dots {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.form-dot {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: 700;
  cursor: pointer;
  transition: transform var(--transition-fast);
}
.form-dot:hover { transform: scale(1.1); }
.form-dot.win { background: rgba(0, 200, 83, 0.15); color: var(--r6-green); }
.form-dot.loss { background: rgba(255, 61, 0, 0.15); color: var(--r6-red); }

/* Patch Item */
.patch-item {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-4);
  transition: all var(--transition-fast);
}
.patch-item:hover { border-color: var(--border-muted); }
.patch-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}
.patch-version {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--r6-orange);
  font-weight: 500;
}
.patch-title { font-family: var(--font-display); font-size: var(--text-lg); font-weight: 600; }
.patch-changes { list-style: none; margin-top: var(--space-3); }
.patch-changes li {
  padding: var(--space-2) 0;
  padding-left: var(--space-4);
  position: relative;
  font-size: var(--text-sm);
  color: var(--text-secondary);
}
.patch-changes li::before {
  content: "▸";
  position: absolute;
  left: 0;
  color: var(--r6-orange);
}

/* Season Item */
.season-item {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-4);
}
.season-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}
.season-name { font-family: var(--font-display); font-size: var(--text-xl); font-weight: 600; }
.season-winrate { font-family: var(--font-mono); font-size: var(--text-sm); color: var(--r6-green); }

/* Chart Container */
.chart-container { position: relative; height: 240px; }

/* Utility */
.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; }
.hidden { display: none !important; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.mt-4 { margin-top: var(--space-4); }
.mb-4 { margin-bottom: var(--space-4); }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }