/* ========== FIND TEAMMATES PAGE ========== */

:root {
  --tm-sidebar-right: 360px;
}

#viewTeammates.view-grid {
  grid-template-columns: minmax(0, 1fr) var(--tm-sidebar-right);
}

.tm-main {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.tm-sidebar-right {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: calc(var(--navbar-height) + 20px);
  max-height: calc(100vh - var(--navbar-height) - 40px);
  overflow-y: auto;
  scrollbar-width: thin;
}

.tm-mobile-sidebar {
  display: none;
  flex-direction: column;
  gap: 16px;
}

/* Header */
.tm-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.tm-header h1 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}

.tm-header p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.tm-post-btn {
  border-radius: var(--radius-full);
  padding: 10px 18px;
  flex-shrink: 0;
  gap: 6px;
}

.tm-post-btn svg, .tm-post-btn .icon {
  width: 16px;
  height: 16px;
}

/* Tabs — underline style */
.tm-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
}

.tm-tab {
  padding: 10px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  position: relative;
  transition: color 180ms ease;
}

.tm-tab:hover {
  color: var(--text-primary);
}

.tm-tab--active {
  color: var(--primary);
}

.tm-tab--active::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: -1px;
  height: 2px;
  background: var(--primary);
  border-radius: 2px 2px 0 0;
}

/* Filters */
.tm-filters__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.tm-filter select {
  appearance: none;
  background: var(--card-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2398a2b3' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 32px 8px 12px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  min-width: 120px;
  cursor: pointer;
  transition: border-color 180ms ease;
}

.tm-filter select:focus {
  border-color: var(--primary);
  outline: none;
}

.tm-more-filters-wrap {
  position: relative;
  margin-left: auto;
}

.tm-more-filters-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--card-bg);
  transition: border-color 180ms ease, color 180ms ease;
}

.tm-more-filters-btn:hover,
.tm-more-filters-btn.is-open {
  border-color: var(--primary);
  color: var(--primary);
}

.tm-more-filters-btn svg, .tm-more-filters-btn .icon {
  width: 16px;
  height: 16px;
}

.tm-more-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(420px, 90vw);
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 16px;
  z-index: 40;
}

.tm-more-popover__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.tm-more-popover__footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
}

.form-select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.85rem;
  background: var(--card-bg);
  color: var(--text-primary);
}

/* Section head */
.tm-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
}

.tm-section-head h2 {
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tm-info-icon {
  width: 14px;
  height: 14px;
  font-size: 14px;
  color: var(--text-muted);
}

.tm-refresh {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
}

.tm-refresh:hover {
  text-decoration: underline;
}

.tm-refresh svg, .tm-refresh .icon {
  width: 14px;
  height: 14px;
}

/* Player list */
.tm-player-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tm-player-row {
  display: grid;
  grid-template-columns: minmax(200px, 1.4fr) 90px minmax(110px, 0.9fr) minmax(90px, 0.8fr) 70px minmax(90px, 0.7fr) auto;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.tm-player-row:hover {
  border-color: #d0d5dd;
  box-shadow: var(--shadow-sm);
}

.tm-player__profile {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}

.tm-player__avatar-btn {
  position: relative;
  flex-shrink: 0;
  padding: 0;
}

.tm-player__avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
}

.tm-status-dot {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--card-bg);
}

.tm-status--online {
  color: var(--online);
}
.tm-status-dot.tm-status--online {
  background: var(--online);
}
.tm-status--busy {
  color: var(--primary);
}
.tm-status-dot.tm-status--busy {
  background: var(--primary);
}
.tm-status--offline {
  color: var(--text-muted);
}
.tm-status-dot.tm-status--offline {
  background: #98a2b3;
}

.tm-player__meta {
  min-width: 0;
}

.tm-player__name-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.tm-player__name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
  text-align: left;
}

.tm-player__name:hover {
  color: var(--primary);
}

.tm-player__verified {
  width: 15px;
  height: 15px;
  font-size: 15px;
  color: #3b82f6;
}

.tm-player__sub {
  font-size: 0.75rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}

.tm-dot {
  color: var(--text-muted);
}

.tm-rep {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: #ca8a04;
  font-weight: 600;
}

.tm-rep svg, .tm-rep .icon {
  width: 11px;
  height: 11px;
  fill: #ca8a04;
}

.tm-player__skills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.tm-skill {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: var(--page-bg);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.tm-skill--more {
  color: var(--primary);
  border-color: var(--primary-light);
  background: var(--primary-soft);
}

.tm-player__role {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.tm-role-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.tm-role-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 500;
}

.tm-player__game {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.tm-player__game-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  flex-shrink: 0;
}

.tm-player__game-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tm-player__game-mode {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.tm-player__langs {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  min-width: 0;
}

.tm-player__langs svg, .tm-player__langs .icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  margin-top: 1px;
  color: var(--text-muted);
}

.tm-player__langs span {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.tm-player__stats {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tm-stat__label {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 500;
}

.tm-stat__value {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
}

.tm-player__activity {
  font-size: 0.72rem;
  font-weight: 500;
}

.tm-player__actions {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
}

.tm-invite-btn.is-invited {
  background: var(--page-bg);
  color: var(--text-secondary);
  cursor: default;
}

.tm-icon-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  color: var(--primary);
  transition: background 180ms ease;
}

.tm-icon-btn:hover {
  background: var(--primary-soft);
}

.tm-icon-btn svg, .tm-icon-btn .icon {
  width: 16px;
  height: 16px;
}

.tm-more-wrap {
  position: relative;
}

.tm-player-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  min-width: 160px;
  z-index: 30;
  padding: 4px;
}

.tm-player-menu.is-open {
  display: block;
}

.tm-player-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  border-radius: 6px;
}

.tm-player-menu button:hover {
  background: var(--page-bg);
  color: var(--text-primary);
}

.tm-player-menu button.is-danger {
  color: var(--danger);
}

/* Skeleton */
.tm-player-row--skeleton {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 88px;
}

.tm-skel {
  background: linear-gradient(90deg, #f2f4f7 25%, #e8ebf0 50%, #f2f4f7 75%);
  background-size: 200% 100%;
  animation: tmShimmer 1.2s ease infinite;
  border-radius: 8px;
}

.tm-skel--avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  flex-shrink: 0;
}

.tm-skel-lines {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tm-skel--line {
  height: 12px;
  width: 60%;
}

.tm-skel--line.short {
  width: 40%;
}

.tm-skel--badge {
  width: 70px;
  height: 24px;
  border-radius: 999px;
}

.tm-skel--block {
  width: 80px;
  height: 32px;
}

.tm-skel--btn {
  width: 72px;
  height: 32px;
  border-radius: 999px;
}

@keyframes tmShimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Bottom CTA */
.tm-bottom-cta {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--primary-soft);
  border: 1px solid var(--primary-light);
  border-radius: 12px;
  margin-top: 4px;
}

.tm-bottom-cta__icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tm-bottom-cta__icon svg, .tm-bottom-cta__icon .icon {
  width: 20px;
  height: 20px;
}

.tm-bottom-cta__text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.tm-bottom-cta__text strong {
  font-size: 0.9rem;
  color: var(--text-primary);
}

.tm-bottom-cta__text span {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Chips */
.tm-chip {
  display: inline-flex;
  align-items: center;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--page-bg);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

/* Active request cards */
.tm-active-requests {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tm-request-card {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card-bg);
  transition: border-color 180ms ease;
  cursor: pointer;
}

.tm-request-wrap {
  display: flex;
  flex-direction: column;
}

.tm-request-card:hover {
  border-color: var(--primary);
}

.tm-request-card__top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.tm-request-card__icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
}

.tm-request-card__game {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.tm-request-card__title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  line-height: 1.35;
}

.tm-request-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 10px;
}

.tm-request-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tm-request-card__joined {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Popular roles */
.tm-roles-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.tm-role-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card-bg);
  text-align: left;
  transition: border-color 180ms ease, background 180ms ease;
}

.tm-role-tile:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.tm-role-tile__icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tm-role-tile__icon svg, .tm-role-tile__icon .icon {
  width: 14px;
  height: 14px;
}

.tm-role-tile__name {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-primary);
}

.tm-role-tile__count {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Squad Finder card */
.tm-squad-finder {
  background: linear-gradient(145deg, #5a3de6 0%, #6c4dff 45%, #8b5cf6 100%);
  border-radius: 14px;
  padding: 20px;
  color: #fff;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.tm-squad-finder__art {
  width: 90px;
  height: 60px;
  margin: 0 auto 10px;
  opacity: 0.95;
}

.tm-squad-finder h4 {
  font-size: 1.05rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.tm-squad-finder p {
  font-size: 0.8rem;
  opacity: 0.92;
  margin-bottom: 14px;
  line-height: 1.4;
}

.tm-squad-finder .btn {
  width: 100%;
  border-radius: var(--radius-full);
}

/* My requests */
.tm-my-requests-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tm-my-request {
  padding: 16px;
}

.tm-my-request__top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.tm-my-request__info {
  flex: 1;
  min-width: 0;
}

.tm-my-request__title {
  font-weight: 700;
  font-size: 0.95rem;
}

.tm-my-request__sub {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.tm-req-status {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: capitalize;
  padding: 3px 8px;
  border-radius: var(--radius-full);
}

.tm-req-status--active {
  background: #dcfce7;
  color: #16a34a;
}

.tm-req-status--filled {
  background: var(--primary-light);
  color: var(--primary);
}

.tm-req-status--expired {
  background: #f2f4f7;
  color: var(--text-muted);
}

.tm-my-request__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.tm-my-request__roles {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 12px;
}

.tm-my-request__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.is-danger-text {
  color: var(--danger) !important;
  border-color: #fecaca !important;
}

.tm-empty {
  padding: 40px 20px;
}

/* Quick profile panel extras */
.tm-profile-cover {
  height: 80px;
  background: linear-gradient(135deg, #6c4dff, #db2777);
  border-radius: 10px;
  margin-bottom: -28px;
}

.tm-profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 3px solid var(--card-bg);
  margin-left: 12px;
  position: relative;
  z-index: 1;
}

.tm-profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 12px 0;
}

.tm-profile-stat {
  text-align: center;
  padding: 10px;
  background: var(--page-bg);
  border-radius: 10px;
  border: 1px solid var(--border);
}

.tm-profile-stat strong {
  display: block;
  font-size: 1rem;
}

.tm-profile-stat span {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.tm-match-score {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--primary);
}

.tm-squad-step {
  margin-bottom: 12px;
}

.tm-squad-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tm-squad-opt {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all 180ms ease;
}

.tm-squad-opt.is-selected,
.tm-squad-opt:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.tm-squad-progress {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
}

.tm-squad-progress span {
  flex: 1;
  height: 4px;
  border-radius: 4px;
  background: var(--border);
}

.tm-squad-progress span.is-done {
  background: var(--primary);
}

.tm-finding {
  text-align: center;
  padding: 32px 16px;
}

.tm-finding__spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--primary-light);
  border-top-color: var(--primary);
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: tmSpin 0.8s linear infinite;
}

@keyframes tmSpin {
  to {
    transform: rotate(360deg);
  }
}

.tm-match-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}

.tm-match-item:last-child {
  border-bottom: none;
}

.tm-match-item img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
}
