/* =============================================================================
   teams.css — Public Teams index page styles
   ============================================================================= */

/* ── Page layout ──────────────────────────────────────────────────────────── */
.teamsIndexPage {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

.teamsIndexHeader {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 28px;
}

.teamsIndexTitle {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin: 0 0 4px;
}

.teamsIndexMeta {
  font-size: 13px;
  color: var(--muted);
}

/* ── Format tabs ──────────────────────────────────────────────────────────── */
.teamsFormatTabs {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.formatTab {
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.12s, border-color 0.12s;
}
.formatTab:hover { color: var(--text); text-decoration: none; }
.formatTab.is-active { color: var(--link); border-bottom-color: var(--accent); font-weight: 600; }

/* ── Filter / sort bar ────────────────────────────────────────────────────── */
.teamsFilterBar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 28px;
}

.teamsFilterBar .filterFieldGroup {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ── Rich dropdown ────────────────────────────────────────────────────────── */
.richDropdown {
  position: relative;
  min-width: 200px;
}

.richDropdownTrigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px 6px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  font-family: inherit;
  list-style: none;
  user-select: none;
  transition: border-color 0.12s;
}
.richDropdownTrigger::-webkit-details-marker { display: none; }
.richDropdownTrigger::marker { display: none; }
.richDropdown[open] .richDropdownTrigger { border-color: var(--accent); }
.richDropdownTrigger:hover { border-color: rgba(107, 63, 160, 0.5); }

.richDropdownTriggerInner {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.richDropdownTriggerText {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.richDropdownChevron {
  flex-shrink: 0;
  opacity: 0.55;
  transition: transform 0.15s;
}
.richDropdown[open] .richDropdownChevron { transform: rotate(180deg); }

.richDropdownMenu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 200px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px;
  z-index: 200;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

.richDropdownItem {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
  transition: background 0.1s, color 0.1s;
  white-space: nowrap;
}
.richDropdownItem:hover { background: var(--surface-2); text-decoration: none; }
.richDropdownItem.is-active {
  background: rgba(107, 63, 160, 0.15);
  color: var(--link);
  font-weight: 600;
}

.richDropdownItem--all {
  justify-content: center;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.richDropdownDivider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 4px 0;
}

/* ── Pokémon search bar ───────────────────────────────────────────────────── */
.teamsSearchForm { flex: 1; min-width: 180px; max-width: 280px; }

.teamsSearchWrap {
  position: relative;
  display: flex;
  align-items: center;
}

.teamsSearchIcon {
  position: absolute;
  left: 10px;
  color: var(--muted);
  pointer-events: none;
  flex-shrink: 0;
}

.teamsSearchInput {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  padding: 6px 32px 6px 30px;
  transition: border-color 0.12s;
  appearance: none;
}
.teamsSearchInput:focus { outline: none; border-color: var(--accent); }
.teamsSearchInput::placeholder { color: var(--muted); }
.teamsSearchInput::-webkit-search-cancel-button { display: none; }

.teamsSearchClear {
  position: absolute;
  right: 8px;
  display: flex;
  align-items: center;
  color: var(--muted);
  text-decoration: none;
  padding: 2px;
  border-radius: 3px;
  transition: color 0.12s;
}
.teamsSearchClear:hover { color: var(--text); }

/* ── Team grid ────────────────────────────────────────────────────────────── */
.teamsGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

/* ── Team index card ──────────────────────────────────────────────────────── */
.teamIndexCard {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s, box-shadow 0.15s;
  /* box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.3); */
}
.teamIndexCard:hover {
  border-color: rgba(107, 63, 160, 0.55);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

/* Type gradient overlay */
.teamCardGradientLayer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: linear-gradient(
    135deg,
    rgba(var(--feat-type1, 130 130 130), 0.18) 0%,
    rgba(var(--feat-type2, 130 130 130), 0.10) 55%,
    transparent 100%
  );
}

/* Feature pokemon sprite positioned top-right */
.teamCardFeatureWrap {
  position: absolute;
  top: -25px;
  right: -15px;
  width: 120px;
  height: 120px;
  z-index: 1;
  pointer-events: none;
}

.teamCardFeatureSprite {
  width: 120px;
  height: 120px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.5));
  opacity: 0.85;
  transition: all 0.15s ease-in-out;
}

/* Top-half link wrapper */
.teamCardTopLink {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  color: inherit;
  text-decoration: none;
}
.teamCardTopLink:hover { text-decoration: none; }
.teamCardTopLink:hover .teamCardName { color: var(--link); }
.teamCardTopLink:hover .teamCardFeatureSprite { transform: translateY(-4px); filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.6)); }

/* Card body content (above gradient) */
.teamCardBody {
  position: relative;
  z-index: 2;
  padding: 16px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.teamCardName {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  padding-right: 56px; /* clear the feature sprite */
  line-height: 1.3;
  display: block;
  transition: color 0.12s;
}

/* Meta row: tags left, engagement right */
.teamCardMeta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
}

/* Tags — left side of meta row */
.teamCardTags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  min-width: 0;
}

.teamCompTag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
  background: rgba(107, 63, 160, 0.18);
  color: var(--link);
  border: 1px solid rgba(107, 63, 160, 0.35);
  white-space: nowrap;
}

.rulesetTag {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.copyBadge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(201, 160, 48, 0.15);
  color: var(--warn);
  border: 1px solid rgba(201, 160, 48, 0.3);
}

/* 6-sprite strip */
.teamCardSlots {
  display: flex;
  gap: 4px;
  align-items: center;
}

.teamCardSlotItem {
  width: 48px;
  height: 48px;
  position: relative;
  flex-shrink: 0;
}


.teamCardSlotEmpty {
  width: 48px;
  height: 36px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px dashed var(--border);
  flex-shrink: 0;
}

/* Engagement — right side of meta row */
.engagementRow {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-shrink: 0;
}

.engagementStat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}

.engagementStat svg { opacity: 0.7; }

.engagementStat--copy {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

/* Favourite button */
.favouriteBtn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
  transition: color 0.12s;
  line-height: 1;
}
.favouriteBtn:hover { color: #f87171; }
.favouriteBtn.active { color: #ef4444; }
.favouriteBtn.active svg { fill: #ef4444; stroke: #ef4444; }

/* Date in card body */
.teamCardDate {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Author row */
.teamCardFooter {
  position: relative;
  z-index: 2;
  padding: 10px 16px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.authorAvatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  overflow: hidden;
}
.authorAvatar img { width: 100%; height: 100%; object-fit: cover; }
.authorAvatarPreset {
  background: rgba(107, 63, 160, 0.25);
  color: var(--link);
  border-color: rgba(107, 63, 160, 0.4);
}

.authorName {
  font-size: 12px;
  color: var(--muted);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.authorName strong { color: var(--text); font-weight: 600; }

.authorDate {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

/* ── Pagination ───────────────────────────────────────────────────────────── */
.teamsPagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pageBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  text-decoration: none;
  transition: border-color 0.12s, color 0.12s;
}
.pageBtn:hover { border-color: var(--accent); color: var(--text); text-decoration: none; }
.pageBtn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.pageBtn:disabled, .pageBtn[disabled] { opacity: 0.35; pointer-events: none; }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .teamsGrid {
    grid-template-columns: 1fr;
  }
  .teamsIndexHeader {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .teamsIndexPage { padding: 24px 16px 60px; }
  .teamsFilterBar { gap: 8px; }
}
