/* =========================================
   PROFIL : SECTION AMIS
   ========================================= */
.pf-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* --- Recherche / ajout --- */
.pf-toolbar {
  display: flex;
  gap: 10px;
}

.pf-search {
  position: relative;
  flex: 1;
  min-width: 0;
}

.pf-search > i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  pointer-events: none;
}

.pf-search input {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px 12px 40px;
  background: var(--bg-main);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s ease;
}

.pf-search input:focus {
  border-color: var(--accent);
}

.pf-suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 50;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

.pf-suggestions[hidden] {
  display: none;
}

.pf-suggestion {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
}

.pf-suggestion:last-child {
  border-bottom: none;
}

.pf-suggestion:hover:not(:disabled),
.pf-suggestion:focus-visible {
  background: var(--bg-secondary);
  outline: none;
}

.pf-suggestion img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-main);
}

.pf-suggestion span {
  flex: 1;
}

.pf-suggestion small {
  color: var(--accent);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 1px;
}

.pf-suggestion:disabled small,
.pf-suggestion.muted {
  color: var(--text-secondary);
  cursor: default;
}

.pf-add-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 18px;
  min-height: 44px;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 4px;
  color: var(--on-accent);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s ease;
}

.pf-add-btn:hover {
  background: var(--accent-strong);
}

.pf-add-btn:disabled {
  opacity: 0.5;
  cursor: wait;
}

.pf-message {
  margin: 0;
  padding: 10px 14px;
  border-radius: 4px;
  background: var(--bg-main);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 0.9rem;
}

.pf-message[hidden] {
  display: none;
}

.pf-message.good {
  border-color: var(--win);
}

.pf-message.bad {
  border-color: var(--loss);
}

/* --- Onglets --- */
.pf-tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--border-subtle);
}

.pf-tab {
  padding: 10px 14px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.pf-tab span {
  display: inline-block;
  min-width: 20px;
  padding: 1px 6px;
  margin-left: 4px;
  border-radius: 10px;
  background: var(--bg-main);
  font-size: 0.75rem;
  text-align: center;
}

.pf-tab.active {
  color: var(--text-primary);
  border-bottom-color: var(--accent);
}

.pf-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* --- Cartes amis --- */
.pf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.pf-empty {
  grid-column: 1 / -1;
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-secondary);
  border: 1px dashed var(--border-strong);
  border-radius: 6px;
}

.pf-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-main);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.pf-card:hover,
.pf-card:focus-visible {
  border-color: var(--border-strong);
  outline: none;
}

.pf-card.online {
  border-left: 3px solid var(--win);
}

.pf-avatar {
  position: relative;
  flex-shrink: 0;
}

.pf-avatar img {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  display: block;
}

.pf-dot {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--border-strong);
  border: 2px solid var(--bg-main);
}

.pf-card.online .pf-dot {
  background: var(--win);
}

.pf-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.pf-info strong {
  color: var(--text-primary);
  font-family: var(--font-heading);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pf-elo {
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
}

.pf-seen {
  color: var(--text-secondary);
  font-size: 0.75rem;
}

.pf-card.online .pf-seen {
  color: var(--win);
}

.pf-actions {
  display: flex;
  gap: 6px;
}

.pf-btn {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  color: var(--text-primary);
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.pf-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.pf-btn.danger:hover {
  border-color: var(--loss);
  color: var(--loss);
}

/* --- Modale profil d'un ami --- */
.pf-modal {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(5, 5, 5, 0.75);
  backdrop-filter: blur(4px);
}

.pf-modal[hidden] {
  display: none;
}

.pf-modal-card {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-top: 3px solid var(--accent);
  border-radius: 6px;
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.pfm-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  color: var(--text-secondary);
  cursor: pointer;
}

.pfm-close:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.pfm-head {
  display: flex;
  align-items: center;
  gap: 16px;
}

.pfm-head img {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--bg-tertiary);
}

.pfm-head h2 {
  margin: 0 0 4px;
  font-family: var(--font-heading);
  color: var(--text-primary);
}

.pfm-status {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.pfm-status.online {
  color: var(--win);
}

.pfm-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.pfm-grid div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  background: var(--bg-main);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
}

.pfm-grid span {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

.pfm-grid strong {
  font-size: 1.1rem;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.pfm-grid strong.win {
  color: var(--win);
}

.pfm-grid strong.loss {
  color: var(--loss);
}

.pfm-challenge {
  width: 100%;
  box-sizing: border-box;
}

@media (max-width: 600px) {
  .pf-panel {
    padding: 1rem;
  }

  .pf-toolbar {
    flex-direction: column;
  }

  .pf-grid {
    grid-template-columns: 1fr;
  }
}
