/* ============================================================
   Stats v2 — scoped styles
   All selectors are namespaced under .stats-v2-* to avoid
   any collision with legacy stats CSS.
   ============================================================ */

.stats-v2-shell {
  padding: 1rem;
}

.stats-v2-shell .stats-v2-pagehead {
  display: none;
  margin-bottom: 1rem;
}

.stats-v2-shell .stats-v2-head-card {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem 1.1rem;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 0.9rem;
  background: linear-gradient(180deg, rgba(46, 196, 255, 0.08), rgba(46, 196, 255, 0.02));
}

.stats-v2-shell .stats-v2-head-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
}

.stats-v2-shell .stats-v2-head-subtitle {
  margin: 0.35rem 0 0;
  font-size: 0.92rem;
  opacity: 0.8;
}

.stats-v2-shell .stats-v2-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.stats-v2-shell .stats-v2-head-link,
.stats-v2-shell .stats-v2-table a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 2rem;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  border: 1px solid rgba(46, 196, 255, 0.35);
  background: rgba(46, 196, 255, 0.08);
  color: #0b5f7b;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
}

.stats-v2-shell .stats-v2-head-link:hover,
.stats-v2-shell .stats-v2-table a:hover {
  background: rgba(46, 196, 255, 0.16);
  color: #08485d;
  text-decoration: none;
}


.stats-v2-shell .stats-v2-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #2ec4ff #eaf6fb;
}

.stats-v2-shell .stats-v2-tabs::-webkit-scrollbar {
  height: 6px;
  background: #eaf6fb;
}
.stats-v2-shell .stats-v2-tabs::-webkit-scrollbar-thumb {
  background: #2ec4ff;
  border-radius: 3px;
}

.stats-v2-shell .stats-v2-tab {
  flex: 0 0 auto;
  /* keep tab width auto, prevent shrinking */
}

.stats-v2-shell .stats-v2-tab {
  padding: 0.5rem 1rem;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  font-size: 0.95rem;
}

.stats-v2-shell .stats-v2-tab.is-active {
  background: var(--cyan, #2ec4ff);
  color: #fff;
  border-color: transparent;
}

.stats-v2-shell .stats-v2-views {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.stats-v2-shell .stats-v2-view-tab {
  padding: 0.4rem 0.9rem;
  border: 1px solid rgba(11, 95, 123, 0.18);
  border-radius: 999px;
  background: rgba(46, 196, 255, 0.06);
  color: #0b5f7b;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
}

.stats-v2-shell .stats-v2-view-tab.is-active {
  background: #0b5f7b;
  color: #fff;
  border-color: transparent;
}

.stats-v2-shell .stats-v2-breadcrumb {
  font-size: 0.85rem;
  opacity: 0.75;
  margin-bottom: 0.75rem;
}

.stats-v2-shell .stats-v2-filters {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 0.75rem;
  border: 1px dashed rgba(0, 0, 0, 0.15);
  border-radius: 0.5rem;
  overflow: visible;
}

.stats-v2-shell .stats-v2-filter-row {
  width: 100%;
  margin: 0;
  align-items: flex-end;
}

.stats-v2-shell .stats-v2-filter-field,
.stats-v2-shell .stats-v2-filter-player-wrap,
.stats-v2-shell .stats-v2-filter-search-wrap {
  position: relative;
  min-width: 0;
}

.stats-v2-shell .stats-v2-filter-label {
  color: rgba(15, 23, 42, 0.7);
}

.stats-v2-shell .stats-v2-filter-player-wrap,
.stats-v2-shell .stats-v2-filter-search-wrap {
  min-width: 0;
}

.stats-v2-shell .stats-v2-filter-field.form-floating > .form-control,
.stats-v2-shell .stats-v2-filter-player-wrap.form-floating > .form-control,
.stats-v2-shell .stats-v2-filter-search-wrap.form-floating > .form-control {
  min-height: calc(3.5rem + 2px);
  padding-top: 2rem;
  /* padding-bottom: 0.625rem; */
}

.stats-v2-shell .stats-v2-filter-field.form-floating > .stats-v2-filter-label,
.stats-v2-shell .stats-v2-filter-player-wrap.form-floating > .stats-v2-filter-label,
.stats-v2-shell .stats-v2-filter-search-wrap.form-floating > .stats-v2-filter-label {
  padding: 0.75rem 0.5rem;
  font-size: 0.85rem;
}

.stats-v2-shell .stats-v2-filter-from,
.stats-v2-shell .stats-v2-filter-to,
.stats-v2-shell .stats-v2-filter-player,
.stats-v2-shell .stats-v2-filter-search {
  width: 100%;
  min-width: 0;
}

.stats-v2-shell .stats-v2-filter-search-feedback {
  display: none;
  margin-top: 0.35rem;
  color: #c0392b;
  font-size: 0.78rem;
}

.stats-v2-shell .stats-v2-filter-search-wrap.is-invalid .stats-v2-filter-search-feedback {
  /* display: block; */
}

.stats-v2-shell .stats-v2-filter-search.stats-v2-filter-search--invalid {
  border-color: #dc3545;
  box-shadow: 0 0 0 0.16rem rgba(220, 53, 69, 0.14);
}

.stats-v2-shell .stats-v2-filter-search.stats-v2-filter-search--valid {
  border-color: #198754;
  box-shadow: 0 0 0 0.16rem rgba(25, 135, 84, 0.14);
}

.stats-v2-shell .stats-v2-filter-actions-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.stats-v2-shell .stats-v2-filter-actions-group .btn {
  min-width: 15rem;
}

.stats-v2-shell .stats-v2-filter-player-wrap .vanilla-ac-dropdown,
.stats-v2-shell .stats-v2-filter-search-wrap .vanilla-ac-dropdown {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  right: 0;
  z-index: 40;
  max-height: 18rem;
  overflow-y: auto;
  padding: 0.35rem;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 0.9rem;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.14);
  backdrop-filter: blur(8px);
}

.stats-v2-shell .stats-v2-filter-player-wrap .vanilla-ac-item {
  border-radius: 0.7rem;
}

.stats-v2-shell .stats-v2-filter-player-wrap .vanilla-ac-item + .vanilla-ac-item {
  margin-top: 0.2rem;
}

.stats-v2-shell .stats-v2-filter-search-wrap .vanilla-ac-item {
  padding: 0;
  border: 0;
  border-radius: 0.7rem;
  background: transparent;
}

.stats-v2-shell .stats-v2-filter-search-wrap .vanilla-ac-item + .vanilla-ac-item {
  margin-top: 0.2rem;
}

.stats-v2-shell .stats-v2-filter-search-wrap .vanilla-ac-item:hover,
.stats-v2-shell .stats-v2-filter-search-wrap .vanilla-ac-item:focus {
  background: rgba(46, 196, 255, 0.1);
}

.stats-v2-shell .stats-v2-filter-search-wrap .vanilla-ac-no-result,
.stats-v2-shell .stats-v2-filter-search-wrap .vanilla-ac-no-result:hover {
  padding: 0.8rem 0.9rem;
  background: transparent;
  color: rgba(15, 23, 42, 0.6);
}

.stats-v2-shell .stats-v2-filter-result {
  /* display: flex; */
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem;
}

.stats-v2-shell .stats-v2-filter-result-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 0.15rem;
}

.stats-v2-shell .stats-v2-filter-result-title {
  display: block;
  font-size: 0.92rem;
  font-weight: 600;
  color: #102a43;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stats-v2-shell .stats-v2-filter-result-meta {
  display: block;
  font-size: 0.73rem;
  color: rgba(16, 42, 67, 0.7);
}

.stats-v2-shell .stats-v2-filter-result-badge {
  flex: 0 0 auto;
}

.stats-v2-shell .stats-v2-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.stats-v2-shell .stats-v2-kpi-card {
  padding: 1rem;
  border-radius: 0.9rem;
  /* background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(247, 252, 255, 0.92));
  border: 1px solid rgba(0, 0, 0, 0.06); */
  box-shadow: 0 10px 22px rgba(18, 38, 63, 0.04);
  text-align: center;
}

.stats-v2-shell .stats-v2-kpi-card .stats-v2-kpi-value {
  font-size: 1.75rem;
  font-weight: 700;
  display: block;
  margin-bottom: 0.25rem;
}

.stats-v2-shell .stats-v2-kpi-card .stats-v2-kpi-label {
  font-size: 0.85rem;
  opacity: 0.8;
}

.stats-v2-shell .stats-v2-table-wrap {
  overflow-x: auto;
  border-radius: 0.85rem;
  border: 1px solid rgba(0, 0, 0, 0.08);
  margin-bottom: 1rem;
  background: #fff;
}

.stats-v2-shell .stats-v2-table-toolbar,
.stats-v2-shell .stats-v2-table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
}

.stats-v2-shell .stats-v2-table-toolbar {
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  background: linear-gradient(180deg, rgba(248, 252, 255, 0.92), rgba(255, 255, 255, 0.98));
}

.stats-v2-shell .stats-v2-table-toolbar-copy,
.stats-v2-shell .stats-v2-table-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.stats-v2-shell .stats-v2-table-toolbar-status,
.stats-v2-shell .stats-v2-table-toolbar-range,
.stats-v2-shell .stats-v2-page-status {
  font-size: 0.85rem;
  color: rgba(18, 38, 63, 0.78);
}

.stats-v2-shell .stats-v2-table-page-size-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: rgba(18, 38, 63, 0.82);
}

.stats-v2-shell .stats-v2-page-size,
.stats-v2-shell .stats-v2-page-nav,
.stats-v2-shell .stats-v2-current-player-jump,
.stats-v2-shell .stats-v2-table-sort-button {
  border-radius: 999px;
  border: 1px solid rgba(18, 38, 63, 0.12);
  background: #fff;
  color: #123045;
}

.stats-v2-shell .stats-v2-page-size {
  padding: 0.35rem 0.65rem;
}

.stats-v2-shell .stats-v2-page-nav,
.stats-v2-shell .stats-v2-current-player-jump {
  padding: 0.45rem 0.8rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.stats-v2-shell .stats-v2-page-nav:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.stats-v2-shell .stats-v2-current-player-jump {
  background: linear-gradient(180deg, rgba(255, 202, 58, 0.2), rgba(255, 202, 58, 0.08));
  border-color: rgba(255, 202, 58, 0.38);
}

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

.stats-v2-shell .stats-v2-table th,
.stats-v2-shell .stats-v2-table td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.stats-v2-shell .stats-v2-table th {
  background: rgba(46, 196, 255, 0.07);
  font-weight: 600;
}

.stats-v2-shell .stats-v2-table th.is-sorted {
  background: rgba(46, 196, 255, 0.14);
}

.stats-v2-shell .stats-v2-table-sort-button {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 0;
  font: inherit;
  font-weight: inherit;
  text-align: left;
}

.stats-v2-shell .stats-v2-table-sort-button.is-sorted {
  color: #0b6e8a;
}

.stats-v2-shell .stats-v2-table-sort-indicator {
  font-size: 0.8rem;
  opacity: 0.75;
}

.stats-v2-shell .stats-v2-table tbody tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.015);
}

.stats-v2-shell .stats-v2-table tbody tr.stats-v2-row-current {
  background: linear-gradient(90deg, rgba(255, 202, 58, 0.16), rgba(255, 244, 213, 0.65));
}

.stats-v2-shell .stats-v2-table tbody tr.stats-v2-row-current td {
  font-weight: 600;
}

.stats-v2-shell .stats-v2-table tbody tr.stats-v2-row-current.is-flash {
  animation: stats-v2-current-row-flash 1.8s ease;
}

.stats-v2-shell .stats-v2-current-player-pill {
  color: rgba(18, 38, 63, 0.72);
}

.stats-v2-shell .stats-v2-table-title {
  background: linear-gradient(180deg, rgba(46, 196, 255, 0.08), rgba(46, 196, 255, 0.03));
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.stats-v2-shell .stats-v2-empty,
.stats-v2-shell .stats-v2-loading,
.stats-v2-shell .stats-v2-error {
  padding: 1rem;
  text-align: center;
  font-size: 0.95rem;
}

.stats-v2-shell .stats-v2-guided-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  padding: 1.2rem 1rem 1.35rem;
  text-align: center;
}

.stats-v2-shell .stats-v2-guided-error__title {
  font-size: 1rem;
  font-weight: 700;
  color: #12263f;
}

.stats-v2-shell .stats-v2-guided-error__body {
  max-width: 42rem;
  color: rgba(18, 38, 63, 0.8);
  line-height: 1.5;
}

.stats-v2-shell .stats-v2-guided-error__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
}

.stats-v2-shell .stats-v2-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 2.4rem;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(46, 196, 255, 0.35);
  background: rgba(46, 196, 255, 0.08);
  color: #0b5f7b;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.stats-v2-shell .stats-v2-action:hover {
  background: rgba(46, 196, 255, 0.16);
  color: #08485d;
  text-decoration: none;
}

.stats-v2-shell .stats-v2-action--primary {
  border-color: #0b5f7b;
  background: #0b5f7b;
  color: #ffffff;
}

.stats-v2-shell .stats-v2-action--primary:hover {
  background: #08485d;
  color: #ffffff;
}

.stats-v2-shell .stats-v2-error { color: #c0392b; }

@keyframes stats-v2-current-row-flash {
  0% {
    box-shadow: inset 0 0 0 999px rgba(255, 202, 58, 0.28);
  }

  100% {
    box-shadow: inset 0 0 0 999px rgba(255, 202, 58, 0);
  }
}

@media (max-width: 767.98px) {
  .stats-v2-main-container {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
  }

  .stats-v2-shell {
    gap: 0.85rem;
  }

  .stats-v2-shell .stats-v2-tabs,
  .stats-v2-shell .stats-v2-views {
    display: flex;
    overflow-x: auto;
    gap: 0.5rem;
    padding: 0.5rem;
    /* border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.88); */
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }

  .stats-v2-shell .stats-v2-tab,
  .stats-v2-shell .stats-v2-view-tab {
    flex: 0 0 auto;
    white-space: nowrap;
    scroll-snap-align: start;
  }

  .stats-v2-shell .stats-v2-kpi-grid {
    /* grid-template-columns: 1fr; */
  }

  .stats-v2-shell .stats-v2-kpi-card .stats-v2-kpi-value { font-size: 1.4rem; }
  .stats-v2-shell .stats-v2-head-card { flex-direction: column; }
  .stats-v2-shell .stats-v2-filter-row {
    /* display: grid; */
    grid-template-columns: 1fr;
  }

  .stats-v2-shell .stats-v2-filter-actions-group {
    flex-direction: column;
  }

  .stats-v2-shell .stats-v2-filter-actions-group .btn {
    width: 100%;
  }

  .stats-v2-shell .stats-v2-table-toolbar,
  .stats-v2-shell .stats-v2-table-pagination {
    flex-direction: column;
    align-items: stretch;
  }

  .stats-v2-shell .stats-v2-guided-error__actions {
    flex-direction: column;
    width: 100%;
  }

  .stats-v2-shell .stats-v2-action {
    width: 100%;
  }

  .stats-v2-shell .stats-v2-table-toolbar-copy,
  .stats-v2-shell .stats-v2-table-toolbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .stats-v2-shell .stats-v2-table {
    display: block;
    min-width: 0;
  }

  .stats-v2-shell .stats-v2-table thead {
    display: none;
  }

  .stats-v2-shell .stats-v2-table tbody,
  .stats-v2-shell .stats-v2-table tr,
  .stats-v2-shell .stats-v2-table td {
    display: block;
    width: 100%;
  }

  .stats-v2-shell .stats-v2-table tr {
    padding: 0.75rem 0.75rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  }

  .stats-v2-shell .stats-v2-table tr:last-child {
    border-bottom: 0;
  }

  .stats-v2-shell .stats-v2-table td {
    display: grid;
    grid-template-columns: minmax(7rem, 0.45fr) minmax(0, 1fr);
    gap: 0.75rem;
    padding: 0.42rem 0 !important;
    border: 0;
  }

  .stats-v2-shell .stats-v2-table td::before {
    content: attr(data-label);
    color: #64748b;
    font-size: 0.78rem;
    font-weight: 800;
  }

  .stats-v2-shell .stats-v2-empty {
    display: block;
  }

  .stats-v2-shell .stats-v2-empty::before {
    content: none;
  }
}
