@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Montserrat:wght@400;600;700&display=swap');

/* ── Friends nav button ─────────────────────────────────────────── */
.friends-nav-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0.8;
  transition: opacity 200ms ease;
}
.friends-nav-btn:hover { opacity: 1; }
.friends-nav-btn img {
  height: 63px;
  width: auto;
  object-fit: contain;
}
.nav-auth .friends-nav-btn {
  margin-right: 0;
}
.pf-nav .friends-nav-btn {
  display: inline-flex;
}
.pf-nav .friends-nav-btn img {
  height: 38px;
}

/* ── Modal overlay ──────────────────────────────────────────────── */
.fm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(3px);
  z-index: 9000;
  display: none;
}
.fm-overlay.open { display: block; }

.fm-modal {
  position: fixed;
  inset: 0;
  z-index: 9001;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.fm-modal.open { display: flex; }

/* ── Modal container ────────────────────────────────────────────── */
.fm-container {
  position: relative;
  width: 100%;
  max-width: 860px;
  background: #141414;
  border: 1px solid rgba(255, 255, 255, 0.09);
  display: flex;
  height: 570px;
  max-height: 90vh;
  overflow: hidden;
}

/* ── Left sidebar ───────────────────────────────────────────────── */
.fm-sidebar {
  width: 260px;
  flex-shrink: 0;
  background: #0e0e0e;
  border-right: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  flex-direction: column;
}

.fm-sidebar-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.fm-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.55rem;
  letter-spacing: 0.09em;
  color: #fff;
  margin: 0;
}

/* Close X (panel header only) */
.fm-close-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.35);
  cursor: pointer;
  font-size: 1rem;
  font-family: 'Montserrat', sans-serif;
  line-height: 1;
  padding: 4px 6px;
  transition: color 150ms;
}
.fm-close-btn:hover { color: #fff; }

/* Panel search input (shown in right panel when search view is active) */
.fm-panel-search {
  padding: 14px 22px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  flex-shrink: 0;
}
.fm-search {
  width: 100%;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  padding: 10px 13px;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
  outline: none;
  transition: border-color 150ms;
}
.fm-search::placeholder { color: rgba(255, 255, 255, 0.28); }
.fm-search:focus { border-color: rgb(62, 134, 183); }

/* Sidebar action buttons — shared base */
.fm-sidebar-actions {
  padding: 10px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.fm-friends-list-btn,
.fm-search-btn,
.fm-requests-btn,
.fm-invite-btn {
  width: 100%;
  background: transparent;
  border: 2px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.5);
  padding: 12px 16px;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: border-color 150ms, color 150ms;
}
.fm-friends-list-btn:hover,
.fm-search-btn:hover,
.fm-requests-btn:hover,
.fm-invite-btn:hover {
  border-color: rgba(255, 255, 255, 0.25);
  color: rgba(255, 255, 255, 0.8);
}
.fm-friends-list-btn.active,
.fm-search-btn.active,
.fm-requests-btn.active,
.fm-invite-btn.active {
  border-color: rgb(62, 134, 183);
  color: #fff;
}

/* ── Right panel ────────────────────────────────────────────────── */
.fm-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #101010;
  overflow: hidden;
}

.fm-panel-header {
  padding: 16px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.fm-panel-label {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.35);
}

/* Friend list */
.fm-list {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Empty state */
.fm-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 40px;
  text-align: center;
  color: rgba(255, 255, 255, 0.18);
}
.fm-empty svg { opacity: 0.3; }
.fm-empty p {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.72rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin: 0;
}

/* Friend row */
.fm-friend-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 15px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: border-color 150ms;
}
.fm-friend-row:hover { border-color: rgba(62, 134, 183, 0.28); }

/* 3-dot menu */
.fm-more-wrap {
  position: relative;
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 2px;
}
.fm-more-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.25);
  cursor: pointer;
  font-size: 0.85rem;
  letter-spacing: 2px;
  padding: 4px 8px;
  line-height: 1;
  transition: color 150ms;
}
.fm-more-btn:hover { color: rgba(255, 255, 255, 0.6); }
.fm-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: #1c1c1c;
  border: 1px solid rgba(255, 255, 255, 0.1);
  min-width: 148px;
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}
.fm-dropdown.hidden { display: none; }
.fm-dropdown-item {
  display: block;
  width: 100%;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.65);
  padding: 11px 14px;
  text-align: left;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: background 150ms, color 150ms;
  box-sizing: border-box;
}
.fm-dropdown-item:hover { background: rgba(255, 255, 255, 0.05); color: #fff; }
.fm-dropdown-item--danger:hover { background: rgba(220, 38, 38, 0.12); color: #f87171; }

.fm-friend-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.fm-avatar {
  width: 46px;
  height: 46px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.09);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
  color: rgba(255, 255, 255, 0.28);
}
.fm-status-dot {
  position: absolute;
  bottom: -3px;
  right: -3px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #4ade80;
  border: 2px solid #101010;
}

.fm-friend-name {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.1rem;
  letter-spacing: 0.06em;
  color: #fff;
}
.fm-friend-sub {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.38);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 2px;
}

.fm-action-btn {
  background: rgb(62, 134, 183);
  border: none;
  color: #fff;
  padding: 8px 16px;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 0.9rem;
  letter-spacing: 1px;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity 150ms;
}
.fm-action-btn:hover { opacity: 0.8; }

/* ── Friend Requests button (badge layout only) ─────────────────── */

/* Badge on requests button */
.fm-req-badge {
  background: rgb(62, 134, 183);
  color: #fff;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.6rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  line-height: 1;
}

/* Status labels (Friends / Request Sent) */
.fm-status-label {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 6px 10px;
  flex-shrink: 0;
}
.fm-status-label--friends { color: #4ade80; }
.fm-status-label--sent    { color: rgba(255, 255, 255, 0.3); }

/* Accept / Decline button pair on request rows */
.fm-req-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.fm-accept-btn {
  background: rgba(74, 222, 128, 0.1);
  border: 1px solid rgba(74, 222, 128, 0.35);
  color: #4ade80;
  padding: 7px 14px;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 0.9rem;
  letter-spacing: 1px;
  cursor: pointer;
  transition: background 150ms;
}
.fm-accept-btn:hover:not(:disabled) { background: rgba(74, 222, 128, 0.2); }
.fm-accept-btn:disabled { opacity: 0.5; cursor: default; }
.fm-decline-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.35);
  padding: 7px 14px;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 0.9rem;
  letter-spacing: 1px;
  cursor: pointer;
  transition: border-color 150ms, color 150ms;
}
.fm-decline-btn:hover { border-color: rgba(255, 255, 255, 0.25); color: rgba(255, 255, 255, 0.6); }

/* ── Mobile ─────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .fm-container {
    flex-direction: column;
    height: 92vh;
    max-height: 92vh;
  }

  /* Sidebar collapses to compact strip at top */
  .fm-sidebar {
    width: 100%;
    flex-shrink: 0;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  }
  .fm-sidebar-header {
    padding: 12px 14px 10px;
  }
  .fm-title {
    font-size: 1.3rem;
  }
  .fm-panel-search {
    padding: 12px 16px 10px;
  }
  .fm-sidebar-actions {
    padding: 6px 12px 10px;
  }

  /* Larger touch targets on sidebar buttons */
  .fm-friends-list-btn,
  .fm-search-btn,
  .fm-requests-btn,
  .fm-invite-btn {
    padding: 14px 16px;
    font-size: 0.9rem;
    min-height: 44px;
  }

  /* Panel takes remaining space */
  .fm-panel {
    flex: 1;
    min-height: 0;
  }
  .fm-list {
    padding: 8px;
    gap: 6px;
  }

  /* Friend rows: prevent overflow, truncate long names */
  .fm-friend-row {
    padding: 10px 12px;
    gap: 8px;
  }
  .fm-friend-left {
    min-width: 0;
    flex: 1;
  }
  .fm-friend-left > div:last-child {
    min-width: 0;
  }
  .fm-friend-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
  }

  /* Action buttons — 44px min touch target */
  .fm-action-btn,
  .fm-accept-btn,
  .fm-decline-btn {
    min-height: 44px;
    padding: 10px 12px;
    font-size: 0.82rem;
  }
  .fm-status-label {
    font-size: 0.58rem;
    padding: 5px 8px;
  }

  /* Request rows: stack buttons vertically on very narrow screens */
  .fm-req-actions {
    flex-direction: column;
    gap: 4px;
    align-items: stretch;
  }
  .fm-req-actions .fm-accept-btn,
  .fm-req-actions .fm-decline-btn {
    width: 100%;
    text-align: center;
    min-height: 40px;
    padding: 9px 10px;
  }

  /* 3-dot menu on mobile: bigger tap area */
  .fm-more-btn {
    padding: 8px 12px;
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .fm-dropdown {
    min-width: 140px;
  }
  .fm-dropdown-item {
    padding: 13px 14px;
    font-size: 0.75rem;
  }

  /* Nav button slightly smaller on mobile */
  .friends-nav-btn img { height: 44px; }

  /* ── Referral invite view — mobile ───────────────────────────── */

  /* Step dots: shrink so they don't crowd the name column */
  .fm-steps {
    gap: 3px;
    flex-shrink: 0;
  }
  .fm-step-dot {
    width: 7px;
    height: 7px;
  }
  .fm-step-connector {
    width: 8px;
  }

  /* Hide the Qualified text label inside the steps row on mobile —
     the sub-text already says Qualified / In progress */
  .fm-steps .fm-status-label {
    display: none;
  }

  /* Link row: stack on very narrow screens */
  .fm-referral-link-row {
    flex-wrap: wrap;
  }
  .fm-referral-link-input {
    min-width: 0;
  }
  .fm-copy-btn {
    flex-shrink: 0;
  }

  /* Tier rows: slightly tighter */
  .fm-tier-row {
    padding: 10px 12px;
  }
  .fm-tier-amount {
    font-size: 1.25rem;
  }
}

/* ── Invite & Earn view ─────────────────────────────────────────── */

.fm-invite-pitch {
  padding: 4px 2px 0;
}

.fm-invite-headline {
  font-size: 1.25rem;
  margin-bottom: 4px;
}

.fm-invite-sub {
  margin: 0 0 14px;
  line-height: 1.5;
}

.fm-invite-tiers {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 10px;
}

.fm-tier-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 15px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.fm-tier-row--earned {
  border-color: rgba(62, 134, 183, 0.35);
  background: rgba(62, 134, 183, 0.06);
}

.fm-tier-amount {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.45rem;
  letter-spacing: 0.04em;
  color: #fff;
  line-height: 1;
}

.fm-tier-label {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.62rem;
  color: rgba(255, 255, 255, 0.42);
  letter-spacing: 0.5px;
  margin-top: 2px;
}

.fm-tier-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.fm-tier-threshold {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.35);
}

.fm-tier-earned-badge {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: #4ade80;
}

.fm-sponsor-line {
  display: inline-block;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.4);
  letter-spacing: 0.5px;
  margin: 8px 0 0;
  text-decoration: none;
  transition: color 150ms;
}
.fm-sponsor-line:hover { color: rgba(255, 255, 255, 0.7); }

.fm-sponsor-name {
  color: rgb(62, 134, 183);
}
.fm-sponsor-line:hover .fm-sponsor-name { color: rgb(90, 160, 210); }

.fm-invite-sub-link {
  color: rgb(62, 134, 183);
  text-decoration: none;
}
.fm-invite-sub-link:hover { text-decoration: underline; }

/* Referral link row */
.fm-referral-link-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.fm-referral-link-input {
  cursor: default;
  flex: 1;
  min-width: 0;
  background: rgba(255, 255, 255, 0.05) !important;
  color: rgba(255, 255, 255, 0.75) !important;
}
.fm-referral-link-input:focus { border-color: rgba(255, 255, 255, 0.1); }

.fm-referral-code-hint {
  margin: 2px 0 4px;
  font-size: 0.6rem;
  letter-spacing: 1px;
}

.fm-referral-section-label {
  margin: 8px 0 4px;
  font-size: 0.6rem;
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* Progress bar */
.fm-progress-wrap {
  padding: 4px 0 2px;
}

.fm-progress-label {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.62rem;
  color: rgba(255, 255, 255, 0.42);
  letter-spacing: 0.5px;
  margin: 0 0 6px;
}

.fm-progress-track {
  height: 3px;
  background: rgba(255, 255, 255, 0.08);
  position: relative;
  overflow: hidden;
}

.fm-progress-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: rgb(62, 134, 183);
  transition: width 500ms ease;
}

/* Three-step progress dots */
.fm-steps {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.fm-step-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  background: transparent;
  flex-shrink: 0;
}

.fm-step-dot.done {
  background: rgb(62, 134, 183);
  border-color: rgb(62, 134, 183);
}

.fm-step-connector {
  width: 14px;
  height: 1.5px;
  background: rgba(255, 255, 255, 0.12);
  flex-shrink: 0;
}

.fm-step-connector.done {
  background: rgb(62, 134, 183);
}

/* Earned banners */
.fm-earned-banner {
  padding: 11px 14px;
  background: rgba(74, 222, 128, 0.05);
  border: 1px solid rgba(74, 222, 128, 0.25);
  border-left-width: 3px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.fm-earned-banner--top {
  background: rgba(62, 134, 183, 0.05);
  border-color: rgba(62, 134, 183, 0.35);
}

.fm-earned-text {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  color: #4ade80;
  letter-spacing: 0.3px;
}

.fm-earned-banner--top .fm-earned-text {
  color: rgb(62, 134, 183);
}

.fm-earned-sub {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.62rem;
  color: rgba(255, 255, 255, 0.4);
  letter-spacing: 0.3px;
}
