/* ═══════════════════════════════════════════════════════════════════════════
   friends.css — Friend Request System Styles
   Uses the same CSS custom properties as style.css (--accent, --bg2, etc.)
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Page Header ──────────────────────────────────────────────────────────── */
.friends-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin-bottom: 2.25rem;
}

.friends-page-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.friends-page-title h1 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 800;
  background: var(--grad-h);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.friends-page-title svg {
  color: var(--accent);
  flex-shrink: 0;
}

/* Numeric badge next to the heading (e.g. "3 pending") */
.friends-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.6rem;
  height: 1.6rem;
  padding: 0 0.4rem;
  border-radius: 999px;
  background: var(--accent);
  color: #000;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
}

/* ── Tab Navigation ───────────────────────────────────────────────────────── */
.friends-nav-tabs {
  display: flex;
  gap: 0.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.3rem;
}

.friends-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 1rem;
  border-radius: calc(var(--radius-sm) - 2px);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  transition: all var(--trans);
  white-space: nowrap;
}

.friends-tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.friends-tab.active {
  background: var(--accent);
  color: #000;
  font-weight: 700;
}

.friends-tab.active:hover {
  color: #000;
}

/* Small count inside tab */
.friends-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.3rem;
  height: 1.3rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.25);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
}

.friends-tab.active .friends-tab-count {
  background: rgba(0, 0, 0, 0.2);
  color: #000;
}

/* ── Friends Grid ─────────────────────────────────────────────────────────── */
.friends-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.1rem;
}

/* ── Friend Card ──────────────────────────────────────────────────────────── */
.friend-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.15rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--trans), transform var(--trans), opacity 0.35s ease;
}

.friend-card:hover {
  border-color: rgba(6, 182, 212, 0.35);
  transform: translateY(-2px);
}

/* Fade-out animation before DOM removal */
.friend-card.card-fade-out {
  opacity: 0;
  transform: scale(0.96);
  pointer-events: none;
}

/* ── Avatar ───────────────────────────────────────────────────────────────── */
.friend-card-avatar {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.25rem;
  color: #fff;
  overflow: hidden;
}

.friend-card-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ── Card Info ────────────────────────────────────────────────────────────── */
.friend-card-info {
  flex: 1;
  min-width: 0;
}

.friend-card-info h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.friend-card-email {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0 0 0.3rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.friend-card-meta {
  font-size: 0.74rem;
  color: var(--muted);
  margin: 0 0 0.4rem;
}

/* Status pill badges */
.friend-status-badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
}

.friend-status-badge.pending {
  background: rgba(245, 158, 11, 0.15);
  color: var(--gold);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.friend-status-badge.accepted {
  background: rgba(16, 185, 129, 0.12);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

/* ── Card Actions ─────────────────────────────────────────────────────────── */
.friend-card-actions {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  flex-shrink: 0;
}

.friend-card-actions .btn,
.friend-card-actions .btn-ghost {
  width: 100%;
  justify-content: center;
  text-align: center;
  white-space: nowrap;
}

/* Accept button — uses the --success colour */
.btn-accept {
  background: var(--success) !important;
  border-color: var(--success) !important;
  color: #fff !important;
}

.btn-accept:hover {
  opacity: 0.88;
}

/* ── Empty State ──────────────────────────────────────────────────────────── */
.friends-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 4rem 1rem;
  color: var(--muted);
  gap: 0.6rem;
}

.friends-empty svg {
  opacity: 0.35;
  margin-bottom: 0.5rem;
}

.friends-empty h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
}

.friends-empty p {
  font-size: 0.9rem;
  max-width: 380px;
}

/* ── Toast Notifications ──────────────────────────────────────────────────── */
#toastContainer {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.friends-toast {
  padding: 0.7rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  color: #fff;
  box-shadow: var(--shadow);
  animation: toastIn 0.3s ease, toastOut 0.3s ease 3.2s forwards;
  pointer-events: auto;
  max-width: 280px;
}

.friends-toast.success {
  background: var(--success);
}

.friends-toast.error {
  background: var(--danger);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes toastOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}

/* ── Navbar Friend Request Badge ──────────────────────────────────────────── */
/* Same pattern as the chat unread badge already in style.css */
.nav-friend-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: var(--gold);
  color: #000;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1;
  margin-left: 0.25rem;
  vertical-align: middle;
}

/* ── Responsive Tweaks ────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .friends-page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .friends-nav-tabs {
    width: 100%;
    justify-content: stretch;
  }

  .friends-tab {
    flex: 1;
    justify-content: center;
    padding: 0.45rem 0.5rem;
    font-size: 0.8rem;
  }

  .friend-card {
    flex-wrap: wrap;
  }

  .friend-card-actions {
    flex-direction: row;
    width: 100%;
  }

  .friend-card-actions .btn,
  .friend-card-actions .btn-ghost {
    flex: 1;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   DISCOVER PAGE — Users Discovery & Search
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Search Bar ───────────────────────────────────────────────────────────── */
.discover-search-bar {
  margin-bottom: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.discover-search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  max-width: 480px;
}

.discover-search-icon {
  position: absolute;
  left: 0.9rem;
  color: var(--muted);
  pointer-events: none;
  flex-shrink: 0;
}

.discover-search-input {
  width: 100%;
  padding: 0.6rem 2.5rem 0.6rem 2.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.9rem;
  transition: border-color var(--trans), box-shadow var(--trans);
  outline: none;
}

.discover-search-input:focus {
  border-color: rgba(6, 182, 212, 0.5);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.08);
}

.discover-search-input::placeholder {
  color: var(--muted);
}

/* Clear ✕ button */
.discover-search-clear {
  position: absolute;
  right: 0.75rem;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1;
  transition: color var(--trans);
}
.discover-search-clear:hover {
  color: var(--text);
}

/* "N results for …" meta line */
.discover-search-meta {
  font-size: 0.82rem;
  color: var(--muted);
  padding-left: 0.25rem;
}
.discover-search-meta strong {
  color: var(--text);
}

/* ── Mutual friends badge ─────────────────────────────────────────────────── */
.discover-mutual-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid rgba(6, 182, 212, 0.2);
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 600;
  margin-top: 0.3rem;
}

/* ── Discover card variant ────────────────────────────────────────────────── */
/* Inherits most styles from .friend-card; just a semantic alias */
.discover-card {
  align-items: flex-start;
}

/* "Add Friend" button accent style */
.btn-add-friend {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-color: transparent;
  color: #fff !important;
  font-weight: 600;
  white-space: nowrap;
}
.btn-add-friend:hover {
  opacity: 0.88;
  transform: translateY(-1px);
}
.btn-add-friend svg {
  flex-shrink: 0;
}

/* "Pending" ghost state */
.btn-pending-state {
  white-space: nowrap;
  color: var(--gold) !important;
  border-color: rgba(245, 158, 11, 0.3) !important;
}
.btn-pending-state:hover {
  background: rgba(245, 158, 11, 0.08) !important;
}

/* ── Loading spinner inside button ───────────────────────────────────────── */
.discover-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Pagination ───────────────────────────────────────────────────────────── */
.discover-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 2.5rem;
}

.discover-page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.2rem;
  height: 2.2rem;
  padding: 0 0.65rem;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
  transition: all var(--trans);
}

.discover-page-btn:hover {
  border-color: rgba(6, 182, 212, 0.35);
  color: var(--text);
  background: rgba(6, 182, 212, 0.06);
}

.discover-page-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
  font-weight: 700;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .discover-search-input-wrap {
    max-width: 100%;
  }
  .discover-card {
    flex-wrap: wrap;
  }
  .discover-card .friend-card-actions {
    flex-direction: row;
    width: 100%;
  }
  .btn-add-friend,
  .btn-pending-state {
    flex: 1;
    justify-content: center;
  }
}
