/*
 * CricketWindies member discovery surfaces
 *
 * This file is deliberately scoped by explicit template hooks. Add:
 *   class="tborder cw-member-list"
 *   class="tborder cw-team-table"
 *   class="tborder cw-member-search"
 *   class="cw-member-search-form"
 * to the corresponding active MyBB templates.
 *
 * No body, wrapper, generic table, generic button, masthead, navigation, or
 * footer selector appears here.
 */

/* .cw-member-search-form and .cw-member-discovery-pagination are included
   here too, not just the three table selectors: in the live template, the
   search submit button and the optional pagination marker both sit as
   SIBLINGS of .cw-member-search's <table> (children of the <form>, not of
   the table) — custom properties only inherit down the DOM from where
   they're declared, so without this they'd never reach those elements and
   every var(--members-*) on them silently falls back to nothing (found
   live: the search button rendered with a transparent background instead
   of maroon). */
.cw-member-list,
.cw-member-search,
.cw-member-search-form,
.cw-team-table,
.cw-member-discovery-pagination {
  --members-maroon: var(--maroon, #54102b);
  --members-maroon-dark: var(--maroon-dark, #390a1d);
  --members-gold: var(--gold, #edc268);
  --members-ivory: var(--ivory, #fff9f0);
  --members-surface: var(--surface, #ffffff);
  --members-surface-alt: var(--surface-alt, #f7f5f2);
  --members-surface-hover: var(--surface-hover, #f4f1ed);
  --members-ink: var(--ink, #152033);
  --members-muted: var(--muted, #5f6877);
  --members-border: var(--border, #e4ddd7);
  --members-border-strong: var(--border-strong, #d5cdc7);
  --members-link: var(--blue-link, #07588c);
}

/* Shared table surface. */
.cw-member-list,
.cw-member-search,
.cw-team-table {
  width: 100%;
  border: 1px solid var(--members-border);
  border-radius: 5px;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--members-surface);
  color: var(--members-ink);
  box-shadow: 0 1px 2px rgba(21, 32, 51, 0.05);
}

.cw-member-list td,
.cw-member-search td,
.cw-team-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--members-border);
  vertical-align: middle;
}

.cw-member-list tr:last-child > td,
.cw-member-search tr:last-child > td,
.cw-team-table tr:last-child > td {
  border-bottom: 0;
}

.cw-member-list .thead,
.cw-member-search .thead,
.cw-team-table .thead {
  background: var(--members-maroon);
  color: var(--members-ivory);
  font-weight: 700;
}

.cw-member-list .thead a:link,
.cw-member-list .thead a:visited,
.cw-member-search .thead a:link,
.cw-member-search .thead a:visited,
.cw-team-table .thead a:link,
.cw-team-table .thead a:visited {
  color: var(--members-ivory);
}

.cw-member-list .tcat,
.cw-member-search .tcat,
.cw-team-table .tcat {
  background: var(--members-surface-alt);
  color: var(--members-ink);
  font-weight: 700;
}

/* theme.css carries a site-wide `.thead a:link, .tcat a:link { color:
   ivory/white }` rule for the maroon/dark bars .thead and .tcat are
   elsewhere — .tcat here is a light "warm paper" bar instead, but nothing
   in this file overrode that link color, so the sortable column-header
   links (Username, Joined, Last Visit, etc.) rendered white-on-light and
   were nearly unreadable (found live). Plain header cells with no link
   (Avatar) were unaffected since they have no <a> to carry that rule. */
.cw-member-list .tcat a:link,
.cw-member-list .tcat a:visited,
.cw-member-search .tcat a:link,
.cw-member-search .tcat a:visited,
.cw-team-table .tcat a:link,
.cw-team-table .tcat a:visited {
  color: var(--members-ink);
}

.cw-member-list .trow1,
.cw-member-list .trow2,
.cw-member-search .trow1,
.cw-member-search .trow2,
.cw-team-table .trow1,
.cw-team-table .trow2 {
  background: var(--members-surface);
  color: var(--members-ink);
}

.cw-member-list .trow2,
.cw-member-search .trow2,
.cw-team-table .trow2 {
  background: var(--members-surface-alt);
}

.cw-member-list .trow1:hover,
.cw-member-list .trow2:hover,
.cw-member-search .trow1:hover,
.cw-member-search .trow2:hover,
.cw-team-table .trow1:hover,
.cw-team-table .trow2:hover {
  background: var(--members-surface-hover);
}

.cw-member-list .smalltext,
.cw-member-search .smalltext,
.cw-team-table .smalltext {
  color: var(--members-muted);
  font-size: 12px;
  line-height: 1.4;
}

/* Member List alphabet and identity rows. */
.cw-member-list .thead .float_right {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  float: none;
  justify-content: flex-end;
  margin: -2px 0 8px;
}

.cw-member-list .thead .float_right a {
  display: inline-flex;
  min-width: 23px;
  min-height: 25px;
  box-sizing: border-box;
  align-items: center;
  justify-content: center;
  padding: 3px 5px !important;
  border: 1px solid rgba(255, 249, 240, 0.22);
  border-radius: 3px;
  background: transparent;
  color: var(--members-ivory);
  font-size: 12px;
  line-height: 1;
  text-decoration: none;
}

.cw-member-list .thead .float_right a:hover,
.cw-member-list .thead .float_right a:focus-visible {
  border-color: var(--members-gold);
  background: var(--members-gold);
  color: var(--members-maroon-dark);
  text-decoration: none;
}

.cw-member-list td:first-child {
  width: 1%;
  white-space: nowrap;
}

.cw-member-list td:first-child img {
  display: inline-block;
  width: 54px;
  height: 54px;
  box-sizing: border-box;
  object-fit: cover;
  border: 1px solid var(--members-border);
  border-radius: 50%;
  vertical-align: middle;
}

.cw-member-list td:nth-child(2) > a:first-child {
  color: var(--members-link);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
  text-decoration: none;
}

.cw-member-list td:nth-child(2) > a:first-child:hover {
  color: var(--members-maroon);
  text-decoration: underline;
}

.cw-member-list td:nth-child(n + 3) {
  color: var(--members-muted);
  font-size: 12px;
  white-space: nowrap;
}

.cw-member-list td:nth-child(2) img[src*="star"] {
  width: auto;
  height: 11px;
  margin-right: 2px;
  border: 0;
  border-radius: 0;
}

/* Member List search form. */
.cw-member-search {
  margin-top: 18px;
}

.cw-member-search td[style*="vertical-align"] {
  vertical-align: top;
}

.cw-member-search input.textbox,
.cw-member-search input[type="text"],
.cw-member-search select {
  max-width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--members-border-strong);
  border-radius: 4px;
  background: var(--members-surface);
  color: var(--members-ink);
  font: inherit;
}

.cw-member-search input.textbox,
.cw-member-search input[type="text"],
.cw-member-search select {
  min-height: 37px;
  padding: 8px 10px;
}

.cw-member-search-form {
  margin: 0;
}

.cw-member-search-form > div[align="center"] {
  margin-top: 12px;
  text-align: right;
}

.cw-member-search-form input.button,
.cw-member-search-form button.button,
.cw-member-search-form a.button,
.cw-member-search-form .button {
  display: inline-flex;
  min-height: 37px;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: 8px 15px;
  border: 1px solid var(--members-maroon);
  border-radius: 4px;
  background: var(--members-maroon);
  color: var(--members-ivory) !important;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none !important;
}

.cw-member-search-form input.button:hover,
.cw-member-search-form button.button:hover,
.cw-member-search-form a.button:hover,
.cw-member-search-form .button:hover {
  border-color: var(--members-maroon-dark);
  background: var(--members-maroon-dark);
}

/* Forum Team group tables. */
.cw-team-table {
  margin: 0 0 14px;
}

.cw-team-table td:first-child {
  width: 75%;
}

.cw-team-table td:first-child > img {
  width: auto;
  height: auto;
  margin-right: 6px;
  vertical-align: middle !important;
}

.cw-team-table td:first-child a {
  color: var(--members-link);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.cw-team-table td:first-child a:hover {
  color: var(--members-maroon);
  text-decoration: underline;
}

.cw-team-table td:nth-child(2) {
  color: var(--members-muted);
  font-size: 12px;
  white-space: nowrap;
}

.cw-team-table .postbit_buttons {
  display: flex;
  justify-content: center;
  margin: 0;
}

.cw-team-table .postbit_buttons > a:link,
.cw-team-table .postbit_buttons > a:visited,
.cw-team-table .postbit_buttons > a:hover,
.cw-team-table .postbit_buttons > a:active {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  margin: 0;
  padding: 5px 8px;
  border: 1px solid var(--members-border-strong);
  border-radius: 4px;
  background: var(--members-surface);
  color: var(--members-link);
  font-size: 11px;
  line-height: 1.1;
  text-decoration: none;
}

.cw-team-table .postbit_buttons > a:hover {
  border-color: var(--members-maroon);
  background: var(--members-surface-hover);
  color: var(--members-maroon);
}

.cw-team-table .postbit_buttons a span {
  min-height: 16px;
  padding-left: 20px;
}

/* Optional scoped pagination marker if the active template exposes one. */
.cw-member-discovery-pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin: 14px 0;
}

.cw-member-discovery-pagination a,
.cw-member-discovery-pagination span {
  display: inline-flex;
  min-width: 32px;
  min-height: 32px;
  box-sizing: border-box;
  align-items: center;
  justify-content: center;
  padding: 6px 9px;
  border: 1px solid var(--members-border);
  border-radius: 4px;
  background: var(--members-surface);
  color: var(--members-link);
  text-decoration: none;
}

.cw-member-discovery-pagination .pagination_current,
.cw-member-discovery-pagination a:hover {
  border-color: var(--members-maroon);
  background: var(--members-maroon);
  color: var(--members-ivory);
}

.cw-member-list a:focus-visible,
.cw-member-search a:focus-visible,
.cw-member-search-form a:focus-visible,
.cw-member-search-form button:focus-visible,
.cw-member-search-form input:focus-visible,
.cw-member-search-form select:focus-visible,
.cw-team-table a:focus-visible {
  outline: 3px solid var(--members-gold);
  outline-offset: 2px;
}

@media (max-width: 700px) {
  .cw-member-list,
  .cw-member-search,
  .cw-team-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .cw-member-list > tbody,
  .cw-team-table > tbody {
    min-width: 680px;
  }

  .cw-member-search > tbody {
    min-width: 520px;
  }

  .cw-member-list .thead .float_right {
    justify-content: flex-start;
  }
}

@media (max-width: 450px) {
  .cw-member-list td,
  .cw-member-search td,
  .cw-team-table td {
    padding: 9px 10px;
  }

  .cw-member-search-form > div[align="center"] {
    text-align: stretch;
  }

  .cw-member-search-form input.button,
  .cw-member-search-form button.button,
  .cw-member-search-form a.button,
  .cw-member-search-form .button {
    width: 100%;
  }
}
