/* =========================================================
   FRIEND GROUP INFO
========================================================= */

.friend-group-info-card {
  background: linear-gradient(135deg, #ffffff, #faf7ff);
  border: 1px solid #e9d5ff;
  border-left: 5px solid #7c3aed;
  border-radius: 18px;
  padding: 18px;
  margin: 18px 0 22px;
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.08);
}

.info-title {
  font-size: 16px;
  font-weight: 700;
  color: #6d28d9;
  margin-bottom: 12px;
}

.friend-group-info-card p {
  margin: 0;
  color: #4b5563;
  line-height: 1.6;
  font-size: 14px;
}

.friend-group-info-card ul {
  margin: 0;
  padding-left: 18px;
}

.friend-group-info-card li {
  margin-bottom: 10px;
  color: #4b5563;
  line-height: 1.6;
  font-size: 14px;
}

.friend-group-info-card strong {
  color: #111827;
}

/* =========================================================
   GLOBAL CHALLENGE
   Single leaderboard now (no more separate all-time board) — a
   compact merged banner (leader | you | prize) plus a plain
   top-list section below it, so there's only one gradient "hero"
   card on the page instead of two.
========================================================= */

.challenge-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  margin: 18px 0;
  border-radius: 18px;
  background: linear-gradient(135deg, #7c3aed, #5b21b6);
  color: white;
  box-shadow: 0 15px 35px rgba(124, 58, 237, 0.25);
}

.challenge-banner-half {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.challenge-banner-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.75);
}

.challenge-banner-half strong {
  font-size: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.challenge-banner-meta {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.75);
}

.challenge-banner-divider {
  width: 1px;
  align-self: stretch;
  background: rgba(255, 255, 255, 0.25);
}

.challenge-banner-prize {
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.35);
  font-weight: 800;
  font-size: 14px;
  white-space: nowrap;
}

.global-challenge-section {
  margin: 20px 0 28px;
}

.global-challenge-section h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 6px;
  font-size: 1.05rem;
  color: #111827;
}

.challenge-badge {
  background: #ede9fe;
  color: #6d28d9;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.challenge-subtitle {
  margin: 0 0 14px;
  color: #6b7280;
  font-size: 13px;
}

/* Rank badge shown next to a member's name inside a group's
   internal leaderboard — their standing on the Global Challenge,
   the only global ranking there is now. */
.challenge-rank-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #ede9fe;
  color: #6d28d9;
  font-size: 11px;
  font-weight: 700;
}

/* =========================================================
   FRIEND GROUPS
========================================================= */

.friend-group-forms {
  display: grid;
  gap: 16px;
  margin: 24px 0;
}

.friend-group-form-card {
  background: white;
  border-radius: 18px;
  padding: 20px;
  border: 1px solid #ececec;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.05);
}

.friend-group-form-card h3 {
  margin: 0 0 12px 0;
  font-size: 1rem;
  color: #111827;
}

.friend-group-form-card input {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  font-size: 15px;
  margin-bottom: 12px;
}

.friend-group-form-card input:focus {
  outline: none;
  border-color: #7c3aed;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.friend-group-form-card button {
  width: 100%;
  border: none;
  padding: 13px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: 0.2s;
}

.friend-group-form-card .btn-primary {
  background: #7c3aed;
  color: white;
}

.friend-group-form-card .btn-primary:hover {
  background: #6d28d9;
}

.friend-group-form-card .btn-secondary {
  background: #f3f4f6;
  color: #374151;
}

.friend-group-form-card .btn-secondary:hover {
  background: #e5e7eb;
}

.friend-group-form-card button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.group-limits-note {
  margin: -4px 0 20px;
  color: #9ca3af;
  font-size: 12px;
  text-align: center;
}

/* =========================
   GROUP CARD
========================= */

.my-groups-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.friend-group-card {
  background: white;
  border-radius: 20px;
  padding: 22px;
  border: 1px solid #ececec;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.05);
}

.friend-group-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid #f1f1f1;
}
.group-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.group-status {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
}

.group-status.qualified {
  background: #dcfce7;
  color: #15803d;
}

.group-status.not-qualified {
  background: #fef3c7;
  color: #b45309;
}

.group-meta {
  margin-top: 10px;
  color: #6b7280;
  font-size: 13px;
}

.friend-group-card-header h3 {
  margin: 0 0 4px 0;
  color: #111827;
}

.friend-group-code {
  font-size: 13px;
  color: #6b7280;
}

.friend-group-code strong {
  color: #7c3aed;
  letter-spacing: 0.05em;
}

.btn-share-code {
  border: none;
  background: #dcfce7;
  color: #15803d;
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.btn-share-code:hover {
  background: #bbf7d0;
}

/* =========================
   PENDING REQUESTS
========================= */

.pending-requests-box {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 16px;
}

.pending-requests-box h4 {
  margin: 0 0 10px 0;
  font-size: 0.85rem;
  color: #92400e;
}

.pending-request-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 0;
}

.pending-request-item + .pending-request-item {
  border-top: 1px solid #fde68a;
}

.pending-request-email {
  display: block;
  font-size: 12px;
  color: #92400e;
  opacity: 0.8;
}

.pending-request-actions {
  display: flex;
  gap: 8px;
}

.btn-accept {
  border: none;
  background: #22c55e;
  color: white;
  padding: 7px 14px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
}

.btn-accept:hover {
  background: #16a34a;
}

.btn-reject {
  border: none;
  background: #fee2e2;
  color: #b91c1c;
  padding: 7px 14px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
}

.btn-reject:hover {
  background: #fecaca;
}

.btn-accept:disabled,
.btn-reject:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* =========================================================
   COLLAPSIBLE GROUP LEADERBOARD
   Native <details>/<summary> — keeps each group's member list
   tucked away until asked for, instead of always shown open.
========================================================= */

.group-leaderboard-details {
  margin-top: 6px;
}

.group-leaderboard-details summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: #7c3aed;
  padding: 6px 0;
  list-style: none;
}

.group-leaderboard-details summary::-webkit-details-marker {
  display: none;
}

.group-leaderboard-details summary::before {
  content: "▸ ";
  display: inline-block;
  transition: transform 0.15s ease;
}

.group-leaderboard-details[open] summary::before {
  transform: rotate(90deg);
}

.group-leaderboard-details summary:hover {
  color: #6d28d9;
}

.group-leaderboard-details .group-leaderboard {
  margin-top: 10px;
}

/* =========================
   LEADERBOARD
   Shared by the Global Challenge top-list and each group's
   internal leaderboard.
========================= */

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.leaderboard-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fafafa;
  border: 1px solid #ececec;
}
.leaderboard-row {
  transition: 0.25s ease;
}

.leaderboard-row:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.08);
}
.first-place {
  background: linear-gradient(90deg, #fff7cc, #fffdf4);
  border-color: #facc15;
}

.second-place {
  background: linear-gradient(90deg, #f3f4f6, #ffffff);
  border-color: #d1d5db;
}

.third-place {
  background: linear-gradient(90deg, #fce7d6, #ffffff);
  border-color: #fdba74;
}

.leaderboard-row-me {
  background: #f5f3ff;
  border: 2px solid #8b5cf6;
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.1);
}

.leaderboard-rank {
  width: 40px;
  font-size: 22px;
  font-weight: 700;
}
.leaderboard-name {
  flex: 1;
  font-weight: 600;
  color: #111827;
  font-size: 14px;
}

.leaderboard-score {
  font-size: 16px;
  font-weight: 800;
  color: #7c3aed;
}

/* Generic empty-state used by the challenge list, group
   leaderboards, and "no groups yet" message. */
.empty-state {
  text-align: center;
  padding: 24px 16px;
  border: 1px dashed #ddd;
  border-radius: 14px;
  background: #fafafa;
  color: #888;
  font-size: 14px;
}

@media (min-width: 700px) {
  .friend-group-forms {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .friend-group-card-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .btn-share-code {
    width: 100%;
  }

  .pending-request-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .pending-request-actions {
    width: 100%;
  }

  .pending-request-actions button {
    flex: 1;
  }
}

@media (max-width: 500px) {
  .challenge-banner {
    flex-wrap: wrap;
  }
}
