/* Shared by every page with pageId "profiles" (search + all player tabs). Split out of styles.css; rules are body[data-page="profiles"]-scoped. */
/* =============================================================================
   PLAYER SEARCH PAGE  (body[data-page="profiles"])
   Reuses .page/.page-header/.page-title/.page-sub, .server-bar/.server-pill(s),
   .lb-wrap/.lb-meta/.lb-meta-title/.lb-meta-note, .table-scroll, .player-cell,
   .list-av, .player-name, td.num(.lo/.hi/.kd/.em), .level-badge, .act-btns/
   .act-btn, .state-box/.spinner/.state-icon/.state-msg/.state-err - all
   already defined above. Only the search bar, platform-id text, and this
   page's pagination variant are new.
   ============================================================================= */

/* Same treatment as the matches page: bigger, bolder header. */

body[data-page="profiles"] .page-title {
  font-weight: 800;
  font-size: 1.6rem;
  letter-spacing: -.4px;
  line-height: 1;
  color: var(--text);
}

/* This page's pagination looks different from the matches page's (numbered
   page buttons with an .active state, vs prev/next + "Page N"), so it's
   scoped to avoid colliding with the unscoped .pagination/.page-btn rules
   matches/index.html already relies on. */

body[data-page="profiles"] .pagination {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 14px 18px; border-top: 1px solid var(--border2);
}

body[data-page="profiles"] .page-btn {
  padding: 5px 12px;
  font-family: var(--mono); font-size: .72rem;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--muted); cursor: pointer; border-radius: 4px;
  transition: all .15s;
}

body[data-page="profiles"] .page-btn:hover { border-color: rgba(255,255,255,.15); color: var(--text); }

body[data-page="profiles"] .page-btn.active { border-color: var(--accent-border); color: var(--accent); background: var(--accent-dim); }

body[data-page="profiles"] .page-btn:disabled { opacity: .3; cursor: not-allowed; }

/* =============================================================================
   PLAYER PROFILE PAGE  (body[data-page="profiles"], player detail view)
   Page-specific rules only - resets, tokens, topbar/nav, .server-bar/
   .server-bar-label/.server-pill(s), generic table/th/td, .state-box/
   .spinner/.state-msg/.state-err, .act-btns/.act-btn, and the spin/fadeUp
   keyframes are already defined above and reused as-is.

   NOTE: the search page (index.html, immediately above) and this detail
   page (player/index.html) share body[data-page="profiles"], so that
   attribute alone can't tell them apart. The detail page's <main> is the
   only element with id="page-main" - used below to scope rules that must
   NOT leak onto the search page (like the tighter .page padding). The
   search page has no .tab-btn at all, so scoping .tab-btn just to
   body[data-page="profiles"] is safe on its own - it can't collide with
   the pill-style .tab-btn used elsewhere (leaderboards/matches), which
   lives on unscoped .tab-row .tab-btn. Do NOT unscope this block - that's
   what used to make it a same-specificity, source-order hack; scoping is
   what makes it robust instead.
   ============================================================================= */

/* This page uses a tighter, no-bottom-padding .page (community strip below
   supplies its own spacing) instead of the shared default. Scoped via
   #page-main (unique to player/index.html) so it doesn't leak onto the
   profiles search page, which also carries body[data-page="profiles"]. */

body[data-page="profiles"] #page-main.page {
  max-width: 1060px; margin: 0 auto;
  padding: 24px 24px 0;
  animation: fadeUp .22s ease;
}

body[data-page="profiles"] .profile-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  margin-bottom: 16px;
}

body[data-page="profiles"] .hero { padding: 16px 20px; }

body[data-page="profiles"] .hero-top {
  display: flex; align-items: center; gap: 14px;
  flex-wrap: wrap;
}

/* Slim header: just avatar + identity + level box, no stat cards (those
   live on the Stats tab now). Avatar is a fixed square (not stretched to
   row height, or the taller level-box row skews it into a rectangle). */

body[data-page="profiles"] .avatar-wrap {
  position: relative;
  width: 96px;
  aspect-ratio: 1 / 1;
  align-self: center;
  flex-shrink: 0;
  /* No rounded corners on avatars anywhere in the product — keep this square. */
  border-radius: 0;
  overflow: hidden;
  background: var(--surface2);
}

body[data-page="profiles"] .avatar {
  width: 100%; height: 100%;
  border: 1px solid rgba(255,255,255,.1);
  background: var(--surface2);
}

body[data-page="profiles"] img.avatar { display: block; object-fit: cover; position: absolute; inset: 0; }

body[data-page="profiles"] .avatar-fb {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 24px; font-weight: 500; color: var(--accent);
}

/* Middle column: name/id/streak on top, a compact level bar underneath.
   Stretches to match the avatar segment / stats panel height, with the
   level box taking whatever vertical room name-block doesn't use. */

body[data-page="profiles"] .identity-col {
  display: flex; flex-direction: row; align-items: stretch; gap: 16px;
  flex: 1 1 auto;
  min-width: 0;
}

body[data-page="profiles"] .identity-col .name-block { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; justify-content: center; }

body[data-page="profiles"] .identity-col .level-box { flex: 0 1 480px; min-width: 280px; }

body[data-page="profiles"] .name-block { min-width: 0; }

body[data-page="profiles"] .profile-name {
  font-size: 1.25rem; font-weight: 500; color: var(--text);
  line-height: 1; letter-spacing: -.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

body[data-page="profiles"] .profile-meta-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 5px;
}

body[data-page="profiles"] .meta-item { font-size: .74rem; color: var(--muted); font-family: var(--mono); }

body[data-page="profiles"] .tier-badge {
  background: var(--accent-dim); color: var(--accent); font-size: .68rem; font-weight: 500;
  padding: 2px 8px; border-radius: 20px; border: 1px solid var(--accent-border);
  font-family: var(--mono);
}

body[data-page="profiles"] .xp-strip { padding: 12px 24px; border-top: 1px solid var(--border2); display: flex; align-items: center; gap: 12px; }

body[data-page="profiles"] .xp-left  { font-size: .74rem; color: var(--muted); white-space: nowrap; font-family: var(--mono); }

body[data-page="profiles"] .xp-track { flex: 1; height: 3px; background: rgba(255,255,255,.07); border-radius: 2px; }

body[data-page="profiles"] .xp-fill  { height: 100%; border-radius: 2px; background: var(--accent); transition: width .5s ease; }

body[data-page="profiles"] .xp-right { font-size: .72rem; color: var(--muted2); white-space: nowrap; font-family: var(--mono); }

/* ── Shared profile header extras ─────────────────────────────────────
   Level box, rank chip, streak chip, click-to-copy PID, and the meta-row
   platform icon treatment. This is the single source of truth for these
   rules — used by every profile sub-page regardless of whether its header
   markup comes from the src/_includes/partials/profile-header.njk partial (via
   initProfileHeader) or is still hand-authored, so nothing should be
   redefining these locally. */

body[data-page="profiles"] .profile-name { line-height: 1.25; padding-bottom: 2px; }

body[data-page="profiles"] .pid-copy.copied { color: #6fcf97; }

body[data-page="profiles"] .tabs { scrollbar-width: none; -ms-overflow-style: none; }

body[data-page="profiles"] .tabs::-webkit-scrollbar { display: none; height: 0; }

/* Underline-style tabs - deliberately distinct from the shared pill .tab-row
   .tab-btn used by leaderboards/matches. Scoped to this page so both can
   coexist in one stylesheet without relying on source order. */

body[data-page="profiles"] .tabs {
  display: flex;
  gap: 0;
  padding: 0;
  background: var(--surface2);
  border-radius: 0;
  border: none;
  border-top: 1px solid var(--border2);
  overflow-x: auto;
}

body[data-page="profiles"] .tabs::-webkit-scrollbar { height: 0; }

body[data-page="profiles"] .tabs .tab-btn {
  flex: 1 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  padding: 0 10px;
  border-radius: 0;
  font-family: 'Inter', sans-serif;
  font-size: .78rem;
  font-weight: 500;
  letter-spacing: 0;
  border: none;
  border-right: 1px solid var(--border2);
  border-bottom: 2px solid transparent;
  box-sizing: border-box;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color .15s, background .15s, border-color .15s;
}

body[data-page="profiles"] .tabs .tab-btn:last-child { border-right: none; }

body[data-page="profiles"] .tabs .tab-btn-icon { flex-shrink: 0; }

body[data-page="profiles"] .tabs .tab-btn span { overflow: hidden; text-overflow: ellipsis; }

body[data-page="profiles"] .tabs .tab-btn:hover {
  color: var(--text);
  background: rgba(255,255,255,.03);
}

body[data-page="profiles"] .tabs .tab-btn.active {
  color: var(--text);
  background: var(--accent-dim);
  border-bottom-color: var(--accent);
}

/* Tabs size to content and scroll horizontally when they don't fit -
   avoids the equal-width flex squashing long labels ("Achievements",
   "Rankings") into an ellipsis on narrower desktop widths too. */

body[data-page="profiles"] .section-panel { display: none; }

body[data-page="profiles"] .section-panel.active { display: block; }

/* ── Day/Night filter toolbar ──────────────────────────────────────────
   Shared by every profile sub-tab that filters by lighting (stats, maps,
   modes, patterns, weapons). Previously each page duplicated this block
   in its own inline <style>; now defined once here.
   Wrapped in .lighting-toolbar, which is what actually separates it from
   the tab bar above: its own background + top/bottom border read as
   "start of a filter row" rather than more tabs, and the padding keeps it
   from butting up against the underline tabs. No rounded corners on the
   segmented control itself, matching the square-cornered treatment used
   elsewhere on this page. */

body[data-page="profiles"] .lighting-toolbar {
  padding: 14px 20px;
  background: var(--surface2);
  border-top: 1px solid var(--border2);
  border-bottom: 1px solid var(--border2);
  border-radius: 0;
}

body[data-page="profiles"] .lighting-toggle {
  display: flex;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0;
  overflow: hidden;
}

body[data-page="profiles"] .lighting-toggle-seg {
  flex: 1;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-left: 1px solid var(--border); border-radius: 0; background: transparent; cursor: pointer;
  padding: 9px 6px;
  font-family: var(--mono); font-size: .72rem; font-weight: 500;
  letter-spacing: .04em; text-transform: uppercase; color: var(--muted);
  transition: color .15s ease, background .15s ease;
  -webkit-appearance: none; appearance: none;
}

body[data-page="profiles"] .lighting-toggle-seg:first-child { border-left: none; }

body[data-page="profiles"] .lighting-toggle-seg svg { width: 14px; height: 14px; flex-shrink: 0; }

body[data-page="profiles"] .lighting-toggle-seg:hover { color: var(--text); }

body[data-page="profiles"] .lighting-toggle-seg[data-value="day"][data-selected="true"] {
  color: #f2c94c; background: rgba(242,201,76,.12);
}

body[data-page="profiles"] .lighting-toggle-seg[data-value="night"][data-selected="true"] {
  color: #7d9bd8; background: rgba(91,141,238,.14);
}

body[data-page="profiles"] .lighting-toggle-seg[data-value=""][data-selected="true"] {
  color: #a9bce0; background: rgba(169,188,224,.1);
}

body[data-page="profiles"] .stat-section { border-top: 1px solid var(--border2); }

body[data-page="profiles"] .table-scroll thead tr { border-top: 1px solid var(--border2); }

body[data-page="profiles"] .stat-section-head {
  padding: 10px 20px 8px;
  font-size: .65rem; font-weight: 500; color: var(--muted2);
  text-transform: uppercase; letter-spacing: .09em;
  border-bottom: 1px solid var(--border2);
  background: var(--surface2); font-family: var(--mono);
}

body[data-page="profiles"] .stat-grid { display: grid; grid-template-columns: repeat(4,1fr); }

body[data-page="profiles"] .stat-card { padding: var(--space-5) var(--space-6); border-right: 1px solid var(--border2); border-bottom: 1px solid var(--border2); }

body[data-page="profiles"] .stat-card:nth-child(4n) { border-right: none; }

body[data-page="profiles"] .stat-grid.cols-3 { grid-template-columns: repeat(3,1fr); }

body[data-page="profiles"] .stat-grid.cols-3 .stat-card { border-right: 1px solid var(--border2); }

body[data-page="profiles"] .stat-grid.cols-3 .stat-card:nth-child(3n) { border-right: none; }

body[data-page="profiles"] .stat-grid.cols-2 { grid-template-columns: repeat(2,1fr); }

body[data-page="profiles"] .stat-grid.cols-2 .stat-card:nth-child(2n) { border-right: none; }

body[data-page="profiles"] .stat-grid.cols-6 { grid-template-columns: repeat(6,1fr); }

body[data-page="profiles"] .stat-grid.cols-6 .stat-card:nth-child(6n) { border-right: none; }

body[data-page="profiles"] .stat-last .stat-card { border-bottom: none; }

body[data-page="profiles"] .stat-card-val { font-size: 1.2rem; font-weight: 500; color: var(--text); line-height: 1; letter-spacing: -.02em; font-family: var(--mono); }

body[data-page="profiles"] .stat-card-label { font-size: .65rem; color: var(--muted2); margin-top: 5px; text-transform: uppercase; letter-spacing: .07em; }

/* Right-aligned header cells use .r (data cells use the shared .num, which
   already covers alignment + mono/weight/size styling - no need to redefine
   it here). */

body[data-page="profiles"] th.r, body[data-page="profiles"] td.r { text-align: right; }

body[data-page="profiles"] .map-name-cell { font-weight: 500; }

body[data-page="profiles"] .mode-cell   { font-size: .76rem; color: var(--muted); font-family: var(--mono); }

body[data-page="profiles"] .server-cell { font-size: .72rem; color: var(--muted2); font-family: var(--mono); }

body[data-page="profiles"] .breakdown { display: flex; align-items: center; gap: 14px; padding: 11px 20px; border-bottom: 1px solid var(--border2); }

body[data-page="profiles"] .breakdown:last-child { border-bottom: none; }

body[data-page="profiles"] .bd-label { width: 110px; flex-shrink: 0; font-size: .8rem; font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

body[data-page="profiles"] .bd-track { flex: 1; height: 3px; background: rgba(255,255,255,.07); border-radius: 2px; }

body[data-page="profiles"] .bd-fill  { height: 100%; border-radius: 2px; background: var(--accent); opacity: .6; }

body[data-page="profiles"] .bd-stats { display: flex; gap: 18px; flex-shrink: 0; }

body[data-page="profiles"] .bd-s     { text-align: right; }

body[data-page="profiles"] .bd-sv { font-size: .84rem; font-weight: 500; color: var(--text); display: block; font-family: var(--mono); }

body[data-page="profiles"] .bd-sl { font-size: .62rem; color: var(--muted2); text-transform: uppercase; letter-spacing: .07em; margin-top: 2px; display: block; }

@media (max-width: 640px) {
  body[data-page="profiles"] #page-main.page { padding: 14px 12px 0; }
  body[data-page="profiles"] .hero { padding: 14px 14px; }
  /* Below this width, name and level box stack instead of sitting side
     by side in identity-col. */
  body[data-page="profiles"] .avatar-wrap { width: 68px; }
  body[data-page="profiles"] .identity-col { flex-direction: column; align-items: stretch; gap: 8px; }
  body[data-page="profiles"] .identity-col .level-box { flex: 1 1 auto; min-width: 0; padding: 10px 0 0; border-left: none; border-top: 1px solid var(--border2); }
  body[data-page="profiles"] .xp-strip { padding: 11px 16px; }
  body[data-page="profiles"] .stat-grid        { grid-template-columns: repeat(2,1fr); }
  body[data-page="profiles"] .stat-grid.cols-3 { grid-template-columns: repeat(2,1fr); }
  body[data-page="profiles"] .stat-grid.cols-3 .stat-card:nth-child(3n) { border-right: 1px solid var(--border2); }
  body[data-page="profiles"] .stat-grid.cols-3 .stat-card:nth-child(2n) { border-right: none; }
  body[data-page="profiles"] .stat-grid.cols-6 { grid-template-columns: repeat(2,1fr); }
  body[data-page="profiles"] .stat-card:nth-child(2n) { border-right: none; }
  body[data-page="profiles"] .ach-grid { grid-template-columns: 1fr; }
  body[data-page="profiles"] .ach-card { border-right: none; }
  body[data-page="profiles"] .ach-card:last-child { border-bottom: none; }
  body[data-page="profiles"] .bd-label { width: 80px; }
  body[data-page="profiles"] .bd-stats { gap: 10px; }
  body[data-page="profiles"] .community-strip { flex-direction: column; align-items: flex-start; }
  body[data-page="profiles"] .weapons-hero { grid-template-columns: 1fr; }
  body[data-page="profiles"] .sig-panel { border-right: none; border-bottom: 1px solid var(--border2); }
  body[data-page="profiles"] .nem-panel { border-right: none; border-bottom: 1px solid var(--border2); }
  body[data-page="profiles"] .donut-panel { flex-direction: row; gap: 16px; align-items: flex-start; }
  body[data-page="profiles"] .pat-grid { grid-template-columns: 1fr 1fr; }
  body[data-page="profiles"] .pat-panel { border-right: 1px solid var(--border2); min-height: 96px; padding: var(--space-5) var(--space-5); }
  body[data-page="profiles"] .pat-grid > .pat-panel:nth-child(4n) { border-right: 1px solid var(--border2); }
  body[data-page="profiles"] .pat-grid > .pat-panel:nth-child(2n) { border-right: none; }
  body[data-page="profiles"] .pat-panel.no-bottom { border-bottom: 1px solid var(--border2); }
  body[data-page="profiles"] .pat-grid > .pat-panel:nth-child(11),
  body[data-page="profiles"] .pat-grid > .pat-panel:nth-child(12) { border-bottom: none; }
  body[data-page="profiles"] .dn-row { flex-direction: column; gap: 14px; }
}

/* ── Profile tab tables: give rows room to breathe (only inside profile tab bodies) ── */
body[data-page="profiles"] .tab-content th { padding: var(--space-3) var(--space-5); }
body[data-page="profiles"] .tab-content td { padding: var(--space-4) var(--space-5); }
@media (max-width: 640px) {
  body[data-page="profiles"] .tab-content th { padding: var(--space-3) var(--space-3); }
  body[data-page="profiles"] .tab-content td { padding: var(--space-3) var(--space-3); }
}
