/* --------------------------------------------------
   AnchorPay – Friends
   Visual language matches Home (index.1386.css)
-----------------------------------------------------*/

:root {
  --ap-bg: #f3f4f6;
  --ap-surface: #ffffff;
  --ap-ink: #0b1021;
  --ap-muted: #6b7280;
  --ap-primary: #1f3a8a;
  --ap-primary-soft: #e0ebff;
  --ap-teal: #14b8a6;
  --ap-danger: #ef4444;
  --ap-border: #e5e7eb;
  --ap-radius-lg: 18px;
  --ap-radius-pill: 999px;
  --ap-shadow-soft: 0 18px 40px rgba(15, 23, 42, 0.18);
  --ap-shadow-subtle: 0 10px 28px rgba(15, 23, 42, 0.1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Inter", sans-serif;
  background: var(--ap-bg);
  color: var(--ap-ink);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
}

/* Visually hidden for accessible labels */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Top bar (matches Home/Dashboard) ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  background: rgba(243, 244, 246, 0.98);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(229, 231, 235, 0.8);
}

.logo {
  font-weight: 700;
  letter-spacing: 0.02em;
  font-size: 1.02rem;
}

.logo span {
  color: var(--ap-primary);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Add Friend pill – same height as status-pill */

.add-friend-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px; /* match .status-pill */
  border-radius: var(--ap-radius-pill);
  border: 1px solid #1d4ed8;
  background: linear-gradient(135deg, #2563eb, #1f3a8a);
  color: #f9fafb;
  font-size: 0.78rem; /* match .status-pill */
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.32);
  transition:
    background-color 0.08s ease-out,
    box-shadow 0.08s ease-out,
    transform 0.08s ease-out,
    opacity 0.08s ease-out;
}

.add-friend-btn .plus {
  font-size: 0.9rem;
}

.add-friend-btn:hover {
  box-shadow: 0 14px 32px rgba(37, 99, 235, 0.4);
  transform: translateY(-1px);
}

.add-friend-btn:active {
  transform: translateY(0);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.24);
}

/* Status pill (account verification) – from Home */

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: var(--ap-radius-pill);
  border: 1px solid #d4d4d8;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: #f9fafb;
  color: #4b5563;
}

.status-pill span:last-child {
  font-size: 0.85rem;
}

.status-pill--verified {
  border-color: var(--ap-primary);
  background: #eff6ff;
  color: var(--ap-primary);
}

/* ---------- Layout ---------- */

.ap-main {
  min-height: calc(100vh - 56px);
  padding: 12px 16px 72px;
}

.ap-main-wrap {
  max-width: 600px;
  margin: 0 auto;
}

.friends-page {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ---------- Page header & search ---------- */

.page-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 4px;
}

.page-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.page-subtitle {
  margin: 4px 0 0;
  font-size: 0.88rem;
  color: var(--ap-muted);
}

.search-card {
  background: #ffffff;
  border-radius: var(--ap-radius-lg);
  padding: 8px 10px;
  box-shadow: var(--ap-shadow-soft);
  border: 1px solid rgba(226, 232, 240, 0.9);
}

.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--ap-radius-pill);
  background: #f3f4f6;
}

.search-icon {
  font-size: 0.9rem;
  color: #9ca3af;
}

.search-input {
  border: none;
  outline: none;
  background: transparent;
  flex: 1;
  font-size: 0.9rem;
  padding: 4px 0;
}

/* ---------- Sections & cards ---------- */

.friends-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.section-label {
  margin: 0 2px;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #9ca3af;
}

.friends-card {
  background: radial-gradient(circle at top left, #ffffff, #f9fafb);
  border-radius: var(--ap-radius-lg);
  box-shadow: var(--ap-shadow-subtle);
  padding: 12px 14px 14px;
  border: 1px solid rgba(226, 232, 240, 0.9);
}

.friends-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.friends-card-title {
  font-size: 0.92rem;
  font-weight: 600;
}

.friends-count {
  font-size: 0.8rem;
  color: var(--ap-muted);
}

/* ---------- Lists & rows ---------- */

.friends-list {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Friend row */

.friend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
}

.friend-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
}

.friend-name {
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.friend-meta {
  font-size: 0.8rem;
  color: var(--ap-muted);
}

/* ---------- Friend row buttons (Add / Remove / Send deposit) ---------- */

.friend-row button {
  font-family: inherit;
  border: none;
  cursor: pointer;
}

/* Primary action: "Add" + "Send deposit" */

.friend-action-btn {
  padding: 0.4rem 1.1rem;
  border-radius: var(--ap-radius-pill);
  border: none;
  background-image: linear-gradient(90deg, var(--ap-primary), #2563eb);
  color: #ffffff;
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: 0 8px 18px rgba(31, 58, 138, 0.25);
  transition:
    background 150ms ease,
    box-shadow 150ms ease,
    transform 80ms ease,
    opacity 80ms ease;
}

.friend-action-btn:hover:not(:disabled) {
  background-image: linear-gradient(90deg, #1d4ed8, var(--ap-primary));
  box-shadow: 0 10px 22px rgba(31, 58, 138, 0.32);
  transform: translateY(-1px);
}

.friend-action-btn:active:not(:disabled) {
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.3);
  transform: translateY(0);
}

.friend-action-btn:disabled {
  opacity: 0.6;
  box-shadow: none;
  cursor: default;
}

.friend-action-btn:focus-visible {
  outline: 2px solid #f59e0b;
  outline-offset: 2px;
}

/* Secondary action: "Remove" */

.friend-secondary-btn {
  padding: 0.35rem 0.9rem;
  border-radius: var(--ap-radius-pill);
  border: 1px solid var(--ap-border);
  background-color: #ffffff;
  color: #4b5563;
  font-size: 0.8rem;
  font-weight: 500;
  margin-left: 0.35rem;
  white-space: nowrap;
  transition:
    background-color 150ms ease,
    border-color 150ms ease,
    color 150ms ease,
    transform 80ms ease;
}

.friend-secondary-btn:hover:not(:disabled) {
  background-color: #f3f4f6;
  border-color: #9ca3af;
  color: #111827;
  transform: translateY(-1px);
}

.friend-secondary-btn:active:not(:disabled) {
  background-color: #e5e7eb;
  transform: translateY(0);
}

.friend-secondary-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.friend-secondary-btn:focus-visible {
  outline: 2px solid var(--ap-primary);
  outline-offset: 2px;
}

/* ---------- Empty states ---------- */

.empty-state {
  margin-top: 6px;
  padding: 10px 10px 11px;
  border-radius: 14px;
  background: #f9fafb;
  border: 1px dashed #e5e7eb;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.86rem;
  color: var(--ap-muted);
}

.empty-state--subtle {
  background: #f3f4f6;
}

.empty-icon {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e5e7eb;
  font-size: 1rem;
}

.empty-copy strong {
  color: #374151;
}

/* ---------- Bottom navigation (matches Home/Dashboard) ---------- */

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  justify-content: space-around;
  padding: 8px 10px 10px;
  background: rgba(243, 244, 246, 0.98);
  backdrop-filter: blur(16px);
  border-top: 1px solid rgba(229, 231, 235, 0.9);
}

.bottom-nav a {
  flex: 1;
  margin: 0 4px;
  text-align: center;
  padding: 7px 4px;
  border-radius: 999px;
  font-size: 0.84rem;
  color: var(--ap-muted);
  font-weight: 500;
}

.bottom-nav a.active {
  background: #111827;
  color: #f9fafb;
}

/* ---------- Small screens tweaks ---------- */

@media (max-width: 380px) {
  .topbar {
    padding-inline: 12px;
  }

  .ap-main {
    padding-inline: 12px;
  }

  .friends-card {
    padding-inline: 12px;
  }
}
