/* Players browse bar — matches Events My events / Discover + Refine pattern */

.pl-module {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  min-height: 0;
}

/* Unified header chrome — browse nav pills + refine triggers */
.pl-module-chrome {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.pl-chrome-nav {
  padding: 12px;
  border-radius: 14px;
  background: linear-gradient(145deg, #ffffff 0%, #f4f7ff 100%);
  border: 1px solid rgba(30, 58, 138, 0.1);
  box-shadow: 0 4px 18px rgba(30, 58, 138, 0.08);
}

/* Players module — topbar subtitle sync lives in module-topbar-sub.js + base.css (.tb-sub--module) */

.pl-browse-panel {
  position: relative;
  z-index: 5;
  min-width: 0;
}

.pl-browse-head {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.pl-browse-primary {
  display: flex;
  flex: 1;
  min-width: 0;
  gap: 6px;
  align-items: stretch;
}
.pl-browse-primary .pl-pill,
.pl-browse-primary .pl-pill-with-tip {
  flex: 1 1 0;
  min-width: 0;
}
.pl-pill-with-tip {
  display: flex;
  align-items: stretch;
  gap: 4px;
  min-width: 0;
}
.pl-pill-with-tip .pl-pill {
  flex: 1;
  min-width: 0;
}
.pl-pill-tip-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  min-width: 28px;
  padding: 0;
  border: 0.5px solid rgba(30, 58, 138, 0.15);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.9);
  color: #607d8b;
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.pl-pill-tip-btn:hover,
.pl-pill-tip-btn:focus-visible {
  color: var(--pn);
  border-color: rgba(30, 58, 138, 0.28);
  background: #fff;
}
.pl-pill-tip-btn i { font-size: 15px; pointer-events: none; }

.pl-pill {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 8px 10px;
  border: 2px solid transparent;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.85);
  color: #607d8b;
  font-family: 'Outfit', sans-serif;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.pl-pill > * { pointer-events: none; }
.pl-pill:hover {
  background: #fff;
  border-color: rgba(30, 58, 138, 0.15);
}
.pl-pill.on {
  background: linear-gradient(145deg, var(--pn) 0%, #2a4fad 100%);
  border-color: var(--pn);
  color: #fff;
  box-shadow: 0 6px 20px rgba(30, 58, 138, 0.28);
}
.pl-pill-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: rgba(30, 58, 138, 0.08);
  font-size: 16px;
  flex-shrink: 0;
}
.pl-pill.on .pl-pill-icon {
  background: rgba(255, 255, 255, 0.2);
  color: var(--py);
}
.pl-pill-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.pl-pill-label {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}
.pl-pill-count {
  font-size: 10px;
  opacity: 0.85;
  line-height: 1.2;
}
.pl-pill.on .pl-pill-count { opacity: 0.9; }

.pl-pill-unread-badge {
  position: absolute;
  top: 5px;
  right: 5px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 9px;
  background: #e53935;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  line-height: 17px;
  text-align: center;
  box-shadow: 0 0 0 2px #fff, 0 2px 6px rgba(229, 57, 53, 0.45);
  pointer-events: none;
}
.pl-pill-unread-badge[hidden] { display: none !important; }
.pl-pill.has-unread:not(.on) {
  border-color: rgba(229, 57, 53, 0.35);
}

.pl-browse-tools {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
  align-self: stretch;
  width: 26px;
  min-width: 26px;
}
.pl-refine-trigger {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: 24px;
  width: 100%;
  padding: 0;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-family: 'Outfit', sans-serif;
  color: #fff;
  transition: transform 0.15s, box-shadow 0.2s;
}
.pl-refine-trigger:hover {
  transform: translateY(-1px);
}
.pl-refine-trigger--search {
  background: linear-gradient(145deg, #9575cd 0%, #7e57c2 45%, #5e35b1 100%);
  box-shadow: 0 3px 10px rgba(94, 53, 177, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.3) inset;
}
.pl-refine-trigger--search.is-open,
.pl-refine-trigger--search.has-active.is-open {
  background: linear-gradient(145deg, #5e35b1 0%, #4527a0 100%);
  box-shadow: 0 4px 14px rgba(69, 39, 160, 0.45), inset 0 0 0 2px rgba(255, 255, 255, 0.35);
}
.pl-refine-trigger--search.has-active:not(.is-open) {
  box-shadow: 0 3px 10px rgba(94, 53, 177, 0.45), inset 0 0 0 2px rgba(255, 255, 255, 0.5);
}
.pl-refine-trigger--profile {
  background: linear-gradient(145deg, #f9a825 0%, #ff6d00 55%, #e65100 100%);
  box-shadow: 0 3px 10px rgba(230, 81, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.35) inset;
}
.pl-refine-trigger--profile.is-open {
  background: linear-gradient(145deg, #ff8f00 0%, #e65100 100%);
  box-shadow: 0 4px 14px rgba(230, 81, 0, 0.45), inset 0 0 0 2px rgba(255, 255, 255, 0.4);
}
.pl-refine-trigger-icon {
  font-size: 15px;
  line-height: 1;
  pointer-events: none;
}
.pl-refine-active-dot {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 1.5px #5e35b1;
  pointer-events: none;
}
.pl-refine-active-dot[hidden] { display: none !important; }

.pl-browse-extra {
  display: none;
  flex-direction: column;
  gap: 12px;
}
.pl-browse-extra.is-open {
  display: flex;
  padding: 12px;
  margin-bottom: 4px;
  border-radius: 14px;
  background: linear-gradient(145deg, #ffffff 0%, #f4f7ff 100%);
  border: 1px solid rgba(30, 58, 138, 0.1);
  box-shadow: 0 4px 18px rgba(30, 58, 138, 0.08);
  animation: pl-browse-extra-in 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.pl-browse-extra[hidden] { display: none !important; }
.pl-browse-extra.is-open[hidden] { display: none !important; }
@keyframes pl-browse-extra-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.pl-browse-search-extra .sw,
.pl-browse-extra .sw {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 0.5px solid var(--pb);
  border-radius: var(--prs);
  background: #fff;
}
.pl-browse-search-extra .sw i,
.pl-browse-extra .sw i { color: #90a4ae; font-size: 14px; }
.pl-browse-search-extra .sw input,
.pl-browse-extra .sw input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  padding: 10px 0;
  font-size: 13px;
  font-family: 'Outfit', sans-serif;
  outline: none;
}

#view-players .pl-filters-panel {
  display: block !important;
  position: static;
  max-height: none;
  overflow: visible;
  padding: 12px;
  border-radius: 12px;
  border: 0.5px solid var(--pb);
  background: #fff;
  box-shadow: none;
}
.pl-me-details {
  padding: 12px;
  border-radius: 12px;
  border: 0.5px solid rgba(30, 58, 138, 0.12);
  background: #f8fafc;
}
.pl-me-details-hd {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #607d8b;
  margin-bottom: 10px;
}

/* My profile & tools — performance stat grid */
.prof-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.prof-stat-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 58px;
  padding: 10px 6px 8px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid rgba(30, 58, 138, 0.1);
  box-shadow: 0 2px 10px rgba(30, 58, 138, 0.07);
  overflow: hidden;
}
.prof-stat-tile::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--prof-stat-bar, linear-gradient(90deg, #1e3a8a, #3b82f6));
  opacity: 0.95;
}
.prof-stat-tile--events { --prof-stat-bar: linear-gradient(90deg, #1e40af, #3b82f6); }
.prof-stat-tile--wins { --prof-stat-bar: linear-gradient(90deg, #15803d, #22c55e); }
.prof-stat-tile--wr { --prof-stat-bar: linear-gradient(90deg, #0d9488, #14b8a6); }
.prof-stat-tile--pts { --prof-stat-bar: linear-gradient(90deg, #c2410c, #f97316); }
.prof-stat-tile--allowed { --prof-stat-bar: linear-gradient(90deg, #b45309, #fbbf24); }
.prof-stat-tile--org { --prof-stat-bar: linear-gradient(90deg, #6d28d9, #a78bfa); }
.prof-stat-val {
  font-size: 21px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 55%, #1d4ed8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.prof-stat-lbl {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.45px;
  color: #78909c;
  text-align: center;
  line-height: 1.2;
}
.prof-stat-tile--hero {
  grid-column: 1 / -1;
}
.prof-stat-tile--hero::after { display: none; }
/* Dinkplus Score ring — same component as profile Overview hero */
.prof-stat-hero-ring {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 0;
  padding: 14px 12px 10px;
  background: linear-gradient(180deg, #e8f0fe 0%, #fff 55%, #f8fafc 100%);
  border: 1px solid rgba(30, 58, 138, 0.14);
  box-shadow: 0 4px 16px rgba(30, 58, 138, 0.1);
  overflow: visible;
}
.prof-stat-hero-ring .ps-perf-block {
  min-width: 0;
  max-width: none;
  width: 100%;
  align-items: center;
}
.prof-stat-hero-ring .ps-perf-ring {
  width: 72px;
  height: 72px;
}
.prof-stat-hero-ring .ps-perf-ring-inner {
  width: 66%;
  height: 66%;
}
.prof-stat-hero-ring .ps-perf-num {
  font-size: 24px;
}
.prof-stat-hero-ring .ps-perf-caption {
  color: var(--pn, #1e3a8a);
  text-shadow: none;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.prof-stat-hero-ring .ps-perf-ring-wrap .ps-perf-help-btn {
  top: -4px;
  right: -6px;
}
.prof-stat-empty {
  margin: 0 0 12px;
  font-size: 11px;
  color: #90a4ae;
  text-align: center;
}

.prof-body-lower {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.pl-main {
  min-width: 0;
  flex: 1;
  min-height: 0;
}

#view-players .pl-rail {
  display: none !important;
}

#view-players .pl-layout {
  display: block;
  grid-template-columns: none;
}

#view-players .pl-subnav,
#view-players .sb-bar {
  display: none !important;
}

#view-players .dir-hd-main {
  justify-content: flex-end;
  margin-bottom: 6px;
}

#view-players .pl-me-details .prof-body {
  padding: 0;
}

@media (max-width: 720px) {
  .pl-browse-head {
    display: grid;
    grid-template-columns: 1fr 1fr 52px;
    grid-template-rows: auto auto;
    gap: 6px;
  }
  .pl-browse-primary {
    display: contents;
  }
  #pl-seg-directory { grid-column: 1; grid-row: 1; }
  #pl-seg-friends { grid-column: 2; grid-row: 1; }
  #pl-seg-messages { grid-column: 1; grid-row: 2; }
  .pl-pill-with-tip {
    grid-column: 2;
    grid-row: 2;
    display: flex;
  }
  .pl-browse-tools {
    grid-column: 3;
    grid-row: 1 / span 2;
    width: 26px;
    min-width: 26px;
    min-height: 0;
    height: auto;
  }
  .pl-browse-primary .pl-pill,
  .pl-pill-with-tip .pl-pill {
    width: 100%;
    min-width: 0;
  }
  .pl-pill-label { font-size: 11px; }
  .pl-pill-count { font-size: 9px; }
  .pl-pill-icon {
    width: 28px;
    height: 28px;
    font-size: 14px;
  }
  .pl-pill {
    min-height: 48px;
    padding: 6px 8px;
    gap: 6px;
  }
}

/* Desktop toolbar — blue bar with browse pills */
@media (min-width: 768px) {
  .pl-module-chrome {
    flex-direction: row;
    align-items: stretch;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 12px;
    background: linear-gradient(145deg, var(--pn) 0%, #2a4fad 100%);
    box-shadow: 0 2px 10px rgba(30, 58, 138, 0.22);
    transition: box-shadow 0.2s, border-color 0.2s;
  }

  .pl-module-chrome:hover {
    border-color: rgba(255, 255, 255, 0.32);
    box-shadow: 0 6px 20px rgba(30, 58, 138, 0.28);
  }

  .pl-chrome-nav {
    flex: 1 1 auto;
    min-width: 0;
    align-self: stretch;
    display: flex;
    gap: 8px;
    align-items: stretch;
    padding: 0 0 0 4px;
    margin: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .pl-pill {
    min-height: 56px;
    padding: 8px 12px;
    gap: 9px;
    color: #455a64;
    background: rgba(255, 255, 255, 0.92);
    border-color: rgba(255, 255, 255, 0.55);
  }

  .pl-pill:hover {
    background: #fff;
    border-color: rgba(255, 255, 255, 0.85);
  }

  .pl-pill.on {
    background: linear-gradient(145deg, #ffffff 0%, #e8eeff 100%);
    border-color: rgba(255, 255, 255, 0.95);
    color: var(--pn);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12), inset 0 0 0 1px rgba(30, 58, 138, 0.08);
  }

  .pl-pill.on .pl-pill-icon {
    background: rgba(30, 58, 138, 0.12);
    color: var(--pn);
  }

  .pl-pill-label {
    font-size: 14px;
  }

  .pl-pill-count {
    font-size: 12px;
    font-weight: 600;
    opacity: 1;
  }

  .pl-pill:not(.on) .pl-pill-count {
    color: #607d8b;
  }

  .pl-pill.on .pl-pill-count {
    color: #546e7a;
  }

  .pl-pill-icon {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }

  .pl-browse-tools {
    width: 32px;
    min-width: 32px;
  }

  .pl-refine-trigger {
    min-height: 28px;
    border-radius: 11px;
  }

  .pl-refine-trigger-icon {
    font-size: 17px;
  }

  .pl-pill-tip-btn {
    width: 32px;
    min-width: 32px;
    background: rgba(255, 255, 255, 0.88);
    border-color: rgba(255, 255, 255, 0.55);
  }

  .pl-pill-tip-btn:hover,
  .pl-pill-tip-btn:focus-visible {
    background: #fff;
    color: var(--pn);
  }

  .pl-pill-tip-btn i {
    font-size: 16px;
  }
}

/* Desktop — compact dashboard layout (mobile stack unchanged above) */
@media (min-width: 721px) {
  .pl-me-details {
    padding: 14px 16px 12px;
    background: #fff;
    border-color: rgba(30, 58, 138, 0.1);
    box-shadow: 0 2px 14px rgba(30, 58, 138, 0.06);
  }
  .pl-me-details-hd {
    margin-bottom: 12px;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.6px;
    color: #37474f;
  }

  /* Score ring left, six stats in 3×2 grid right — one cohesive panel */
  .prof-stats-grid {
    grid-template-columns: minmax(108px, 124px) repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 14px;
    padding: 10px 12px;
    border-radius: 14px;
    background: linear-gradient(145deg, #eef3ff 0%, #fff 42%, #f8fafc 100%);
    border: 1px solid rgba(30, 58, 138, 0.11);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
    align-items: stretch;
  }
  .prof-stat-tile--hero {
    grid-column: 1;
    grid-row: 1 / span 2;
    align-self: center;
  }
  .prof-stat-hero-ring {
    height: 100%;
    min-height: 0;
    padding: 6px 4px 4px;
    background: transparent;
    border: none;
    box-shadow: none;
    border-right: 1px solid rgba(30, 58, 138, 0.08);
    border-radius: 0;
    margin-right: 4px;
  }
  .prof-stat-hero-ring .ps-perf-ring {
    width: 68px;
    height: 68px;
  }
  .prof-stat-hero-ring .ps-perf-ring-inner {
    width: 66%;
    height: 66%;
  }
  .prof-stat-hero-ring .ps-perf-num {
    font-size: 26px;
  }
  .prof-stat-hero-ring .ps-perf-range-lbl {
    font-size: 10px;
    font-weight: 700;
    color: #607d8b;
  }
  .prof-stat-hero-ring .ps-perf-caption {
    font-size: 12px;
    font-weight: 800;
    margin-top: 3px;
  }
  .prof-stat-tile:not(.prof-stat-tile--hero) {
    min-height: 0;
    padding: 9px 10px 8px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.72);
    border-color: rgba(30, 58, 138, 0.08);
    box-shadow: none;
  }
  .prof-stat-tile:not(.prof-stat-tile--hero)::after {
    height: 2px;
    opacity: 0.85;
  }
  .prof-stat-val {
    font-size: 22px;
  }
  .prof-stat-lbl {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.55px;
    color: #546e7a;
  }

  /* Meta left, upcoming events right */
  .prof-body-lower {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0 20px;
    align-items: start;
  }
  .prof-body-divider {
    display: none;
  }
  .prof-body-meta .pm-row {
    margin-bottom: 7px;
    font-size: 14px;
    font-weight: 600;
    color: #455a64;
  }
  .prof-body-meta .pm-row i {
    font-size: 15px;
    color: #607d8b;
  }
  .prof-body-meta .pm-row:last-of-type {
    margin-bottom: 0;
  }
  .prof-body-meta .prof-dupr-connect,
  .prof-body-meta .prof-dupr-connected {
    margin-top: 6px;
    font-size: 14px;
    font-weight: 600;
  }
  .prof-body-meta .prof-dupr-connect-msg {
    font-size: 13px;
    font-weight: 600;
  }
  .prof-body-events {
    padding-left: 20px;
    border-left: 1px solid rgba(30, 58, 138, 0.1);
  }
  .prof-body-events .ue {
    padding: 5px 0;
  }
  .prof-body-events .ue-lbl {
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.55px;
    color: #546e7a;
  }
  .prof-body-events .ue-n {
    font-size: 14px;
    font-weight: 600;
    color: #37474f;
  }
  .prof-body-events .ue-d {
    font-size: 12px;
    font-weight: 600;
    color: #78909c;
  }
}

@media (min-width: 960px) {
  .prof-stats-grid {
    grid-template-columns: minmax(120px, 136px) repeat(6, minmax(0, 1fr));
    grid-template-rows: auto;
    gap: 0 6px;
    padding: 10px 14px;
  }
  .prof-stat-tile--hero {
    grid-row: 1;
    margin-right: 8px;
    padding-right: 10px;
  }
  .prof-stat-tile:not(.prof-stat-tile--hero) {
    border-left: 1px solid rgba(30, 58, 138, 0.07);
    border-radius: 0;
    background: transparent;
    padding: 8px 12px;
  }
  .prof-stat-tile:not(.prof-stat-tile--hero):nth-child(2) {
    border-left: none;
  }
  .prof-stat-tile:not(.prof-stat-tile--hero)::after {
    display: none;
  }
  .prof-stat-val {
    font-size: 24px;
  }
  .prof-stat-lbl {
    font-size: 11px;
  }
  .prof-stat-hero-ring .ps-perf-ring {
    width: 76px;
    height: 76px;
  }
  .prof-stat-hero-ring .ps-perf-ring-inner {
    width: 66%;
    height: 66%;
  }
  .prof-stat-hero-ring .ps-perf-num {
    font-size: 28px;
  }
  .prof-stat-hero-ring .ps-perf-caption {
    font-size: 13px;
  }
}
