/* ==========================================================================
   BITCHAIN PRO X — TEAM STRUCTURE & MY TEAM PAGE STYLING
   Dark luxury theme matching the reference layout and UI design tokens.
   ========================================================================== */

/* ── Container Layout ── */
.team-page-container {
  max-width: 1200px;
  margin: 20px auto 60px;
  padding: 0 20px;
  position: relative;
  z-index: 2;
  box-sizing: border-box;
}

/* ── Top Header Section ── */
.team-header-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.team-header-titles {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.btn-back-dashboard {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 6px 14px;
  background: rgba(157, 78, 221, 0.15);
  border: 1px solid rgba(199, 125, 255, 0.35);
  border-radius: 50px;
  color: #00f5d4;
  font-family: var(--font-heading, 'Outfit', sans-serif);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-decoration: none;
  margin-bottom: 4px;
  transition: all 0.25s ease;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.btn-back-dashboard:hover {
  background: rgba(157, 78, 221, 0.35);
  border-color: #00f5d4;
  color: #ffffff;
  transform: translateX(-4px);
  box-shadow: 0 0 15px rgba(0, 245, 212, 0.35);
}

.btn-back-dashboard svg {
  transition: transform 0.2s ease;
}

.btn-back-dashboard:hover svg {
  transform: translateX(-2px);
}

.team-main-title {
  font-family: var(--font-heading, 'Outfit', sans-serif);
  font-size: 1.65rem;
  font-weight: 900;
  letter-spacing: 1px;
  color: #ffffff;
  margin: 0;
  text-transform: uppercase;
}

.team-sub-title {
  font-size: 0.88rem;
  color: rgba(224, 170, 255, 0.7);
  margin: 0;
  font-weight: 500;
}

/* ── View Toggle Buttons (Tree View vs List View) ── */
.team-view-toggle-group {
  display: inline-flex;
  background: rgba(26, 5, 51, 0.85);
  border: 1px solid rgba(199, 125, 255, 0.3);
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
}

.btn-view-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: rgba(224, 170, 255, 0.75);
  font-family: var(--font-heading, 'Outfit', sans-serif);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s ease;
  outline: none;
}

.btn-view-toggle:hover {
  color: #ffffff;
  background: rgba(157, 78, 221, 0.2);
}

.btn-view-toggle.active {
  background: linear-gradient(135deg, #7b2cbf 0%, #9d4edd 100%);
  color: #ffffff;
  box-shadow: 0 0 15px rgba(157, 78, 221, 0.4);
}

/* ── Top Metric Stat Cards (Direct Team & Total Team) ── */
.team-metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
  margin-bottom: 28px;
}

.metric-stat-card {
  background: linear-gradient(135deg, rgba(26, 5, 51, 0.85) 0%, rgba(13, 0, 26, 0.95) 100%);
  border: 1px solid rgba(199, 125, 255, 0.22);
  border-radius: 16px;
  padding: 22px 26px;
  display: flex;
  align-items: center;
  gap: 20px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  transition: transform 0.25s ease, border-color 0.25s ease;
}

.metric-stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(199, 125, 255, 0.45);
}

.metric-icon-box {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  background: rgba(157, 78, 221, 0.15);
  border: 1px solid rgba(199, 125, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: #c77dff;
  flex-shrink: 0;
}

.metric-icon-box.cyan-tint {
  background: rgba(0, 245, 212, 0.12);
  border-color: rgba(0, 245, 212, 0.35);
  color: #00f5d4;
}

.metric-data-wrap {
  display: flex;
  flex-direction: column;
}

.metric-label {
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: rgba(224, 170, 255, 0.75);
  margin-bottom: 4px;
}

.metric-value-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.metric-number {
  font-family: var(--font-heading, 'Outfit', sans-serif);
  font-size: 2rem;
  font-weight: 900;
  color: #ffffff;
  line-height: 1;
}

.metric-sub {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.6);
  font-weight: 500;
}

/* ── Main Downline Container ── */
.team-downline-section {
  background: linear-gradient(135deg, rgba(20, 4, 40, 0.95) 0%, rgba(10, 1, 20, 0.98) 100%);
  border: 1px solid rgba(199, 125, 255, 0.2);
  border-radius: 20px;
  padding: 26px 28px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
}

.downline-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.downline-title {
  font-family: var(--font-heading, 'Outfit', sans-serif);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 1px;
  color: #ffffff;
  margin: 0;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-view-all-levels {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  background: rgba(157, 78, 221, 0.15);
  border: 1px solid rgba(199, 125, 255, 0.35);
  border-radius: 8px;
  color: #e0aaff;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
}

.btn-view-all-levels:hover {
  background: rgba(157, 78, 221, 0.3);
  color: #ffffff;
  border-color: rgba(199, 125, 255, 0.6);
}

/* ── Level Navigation Tabs (Level 1..5 + View All) ── */
.level-tabs-scroll-wrap {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 22px;
  scrollbar-width: thin;
  scrollbar-color: rgba(199, 125, 255, 0.3) transparent;
}

.level-tabs-scroll-wrap::-webkit-scrollbar {
  height: 4px;
}
.level-tabs-scroll-wrap::-webkit-scrollbar-thumb {
  background: rgba(199, 125, 255, 0.3);
  border-radius: 4px;
}

.level-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  background: rgba(26, 5, 51, 0.7);
  border: 1px solid rgba(199, 125, 255, 0.2);
  border-radius: 10px;
  color: rgba(224, 170, 255, 0.8);
  font-family: var(--font-heading, 'Outfit', sans-serif);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.25s ease;
  flex-shrink: 0;
  outline: none;
}

.level-tab-btn:hover {
  background: rgba(157, 78, 221, 0.2);
  color: #ffffff;
  border-color: rgba(199, 125, 255, 0.4);
}

.level-tab-btn.active {
  background: linear-gradient(135deg, #5e15e6 0%, #9d4edd 100%);
  color: #ffffff;
  border-color: rgba(199, 125, 255, 0.6);
  box-shadow: 0 0 16px rgba(94, 21, 230, 0.5);
}

.level-count-pill {
  font-size: 0.78rem;
  opacity: 0.85;
}

/* ── Member Cards List View ── */
.members-list-wrapper {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.member-row-card {
  display: grid;
  grid-template-columns: 44px 50px minmax(180px, 1.8fr) minmax(160px, 1.5fr) 130px 40px;
  align-items: center;
  padding: 14px 20px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(199, 125, 255, 0.12);
  border-radius: 14px;
  transition: all 0.22s ease;
  cursor: pointer;
  position: relative;
}

.member-row-card:hover {
  background: rgba(157, 78, 221, 0.08);
  border-color: rgba(199, 125, 255, 0.35);
  transform: translateX(4px);
}

/* Sequence Index Badge */
.member-seq-badge {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(94, 21, 230, 0.6) 0%, rgba(157, 78, 221, 0.4) 100%);
  border: 1px solid rgba(199, 125, 255, 0.4);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading, 'Outfit', sans-serif);
  font-weight: 800;
  font-size: 0.88rem;
}

/* Avatar Circle */
.member-avatar-box {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7b2cbf, #c77dff);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 800;
  font-size: 1.05rem;
  border: 2px solid rgba(199, 125, 255, 0.4);
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}

/* Member Name & Phone */
.member-ident-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-right: 12px;
}

.member-name-text {
  font-family: var(--font-heading, 'Outfit', sans-serif);
  font-weight: 800;
  font-size: 0.96rem;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.member-phone-text {
  font-size: 0.8rem;
  color: rgba(224, 170, 255, 0.7);
  font-family: monospace;
}

/* Rank & Date Column */
.member-rank-date-col {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.member-rank-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #e0aaff;
}

.member-rank-icon {
  font-size: 0.95rem;
}

.member-date-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.5);
}

/* Downline Members Count */
.member-team-col {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #70d6ff;
  font-weight: 700;
  font-size: 0.88rem;
}

.team-count-icon {
  font-size: 1.1rem;
}

.team-count-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.team-count-val {
  color: #ffffff;
  font-weight: 800;
}

.team-count-lbl {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.5);
  font-weight: 500;
}

/* Chevron Navigation Arrow */
.member-chevron-col {
  display: flex;
  justify-content: flex-end;
  color: rgba(199, 125, 255, 0.6);
  font-size: 1.2rem;
  transition: transform 0.2s ease, color 0.2s ease;
}

.member-row-card:hover .member-chevron-col {
  transform: translateX(3px);
  color: #c77dff;
}

/* Bottom "View All Level Members" Button */
.view-all-level-bar {
  margin-top: 18px;
  text-align: center;
}

.btn-expand-level {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 20px;
  background: rgba(94, 21, 230, 0.12);
  border: 1px dashed rgba(199, 125, 255, 0.3);
  border-radius: 12px;
  color: #c77dff;
  font-family: var(--font-heading, 'Outfit', sans-serif);
  font-weight: 800;
  font-size: 0.88rem;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.22s ease;
}

.btn-expand-level:hover {
  background: rgba(94, 21, 230, 0.25);
  border-color: rgba(199, 125, 255, 0.6);
  color: #ffffff;
}

/* ── Tree View Container ── */
.team-tree-wrapper {
  overflow-x: auto;
  padding: 20px 10px;
  min-height: 380px;
}

.tree-root-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 600px;
}

.tree-node-card {
  background: linear-gradient(135deg, rgba(35, 8, 65, 0.95) 0%, rgba(18, 2, 38, 0.98) 100%);
  border: 1.5px solid rgba(199, 125, 255, 0.35);
  border-radius: 14px;
  padding: 12px 18px;
  min-width: 180px;
  text-align: center;
  position: relative;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  transition: all 0.22s ease;
}

.tree-node-card:hover {
  border-color: #00f5d4;
  transform: translateY(-2px);
  box-shadow: 0 0 20px rgba(0, 245, 212, 0.25);
}

.tree-node-card.root-node {
  border-color: #ffd166;
  background: linear-gradient(135deg, rgba(65, 35, 8, 0.9) 0%, rgba(26, 12, 0, 0.95) 100%);
}

.tree-node-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #7b2cbf;
  margin: 0 auto 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.95rem;
  color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background-size: cover;
  background-position: center;
}

.tree-node-name {
  font-weight: 800;
  font-size: 0.88rem;
  color: #fff;
  white-space: nowrap;
}

.tree-node-rank {
  font-size: 0.72rem;
  color: #c77dff;
  font-weight: 700;
}

.tree-node-meta {
  font-size: 0.72rem;
  color: #00f5d4;
  margin-top: 4px;
}

.tree-children-row {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 28px;
  position: relative;
}

.tree-connector-line {
  width: 2px;
  height: 24px;
  background: linear-gradient(to bottom, rgba(199, 125, 255, 0.6), rgba(0, 245, 212, 0.6));
  margin: 0 auto;
}

/* ── Empty State ── */
.team-empty-box {
  text-align: center;
  padding: 40px 20px;
  background: rgba(255, 255, 255, 0.015);
  border: 1px dashed rgba(199, 125, 255, 0.2);
  border-radius: 14px;
}

.empty-icon-glyph {
  font-size: 2.8rem;
  margin-bottom: 12px;
  opacity: 0.6;
}

.empty-title-text {
  font-family: var(--font-heading, 'Outfit', sans-serif);
  font-size: 1.05rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 6px;
}

.empty-desc-text {
  font-size: 0.85rem;
  color: rgba(224, 170, 255, 0.65);
  max-width: 400px;
  margin: 0 auto;
  line-height: 1.5;
}

/* ── Modals & Popups ── */
.team-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 2, 10, 0.85);
  backdrop-filter: blur(10px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 20px;
}

.team-modal-backdrop.active {
  display: flex;
}

.team-modal-card {
  background: linear-gradient(135deg, #1a0533 0%, #0d001a 100%);
  border: 1px solid rgba(199, 125, 255, 0.35);
  border-radius: 20px;
  max-width: 520px;
  width: 100%;
  padding: 28px;
  position: relative;
  box-shadow: 0 15px 50px rgba(0, 0, 0, 0.6), 0 0 30px rgba(157, 78, 221, 0.2);
  animation: modalPop 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-sizing: border-box;
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.94); }
  to   { opacity: 1; transform: scale(1); }
}

.modal-close-btn {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  transition: all 0.2s ease;
}

.modal-close-btn:hover {
  background: rgba(230, 57, 70, 0.4);
  border-color: #e63946;
}

.modal-header-title {
  font-family: var(--font-heading, 'Outfit', sans-serif);
  font-size: 1.25rem;
  font-weight: 800;
  color: #ffffff;
  margin: 0 0 6px;
  text-transform: uppercase;
}

.modal-header-sub {
  font-size: 0.85rem;
  color: rgba(224, 170, 255, 0.7);
  margin: 0 0 20px;
}

/* 10-Level Picker Grid */
.level-picker-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  max-height: 360px;
  overflow-y: auto;
  padding-right: 4px;
}

.level-picker-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(199, 125, 255, 0.18);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #ffffff;
}

.level-picker-item:hover {
  background: rgba(157, 78, 221, 0.2);
  border-color: rgba(199, 125, 255, 0.5);
  transform: translateY(-1px);
}

.level-picker-item.active {
  background: linear-gradient(135deg, #5e15e6, #9d4edd);
  border-color: #c77dff;
}

.level-picker-name {
  font-family: var(--font-heading, 'Outfit', sans-serif);
  font-weight: 800;
  font-size: 0.9rem;
}

.level-picker-count {
  font-size: 0.8rem;
  background: rgba(0, 0, 0, 0.3);
  padding: 3px 8px;
  border-radius: 20px;
  color: #00f5d4;
  font-weight: 700;
}

/* Member Details Popup */
.member-popup-profile-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(199, 125, 255, 0.15);
}

.member-popup-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7b2cbf, #c77dff);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 1.5rem;
  border: 2px solid rgba(199, 125, 255, 0.5);
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}

.member-popup-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.popup-meta-card {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(199, 125, 255, 0.15);
  border-radius: 10px;
  padding: 10px 14px;
}

.popup-meta-lbl {
  font-size: 0.7rem;
  color: rgba(224, 170, 255, 0.65);
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.popup-meta-val {
  font-size: 0.88rem;
  font-weight: 800;
  color: #ffffff;
  font-family: var(--font-heading, 'Outfit', sans-serif);
}

/* ── Mobile Responsiveness (Screen <= 768px) ── */
@media (max-width: 768px) {
  .team-page-container {
    padding: 0 14px;
    margin: 12px auto 40px;
  }

  .team-main-title {
    font-size: 1.35rem;
  }

  .team-metrics-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .metric-stat-card {
    padding: 16px 18px;
  }

  .team-downline-section {
    padding: 18px 14px;
  }

  .member-row-card {
    grid-template-columns: 36px 42px 1fr 30px;
    gap: 10px;
    padding: 12px 14px;
  }

  .member-rank-date-col {
    grid-column: 3 / 4;
    margin-top: 4px;
  }

  .member-team-col {
    display: none; /* Shown inside details popup on mobile for clean card */
  }

  .level-picker-grid {
    grid-template-columns: 1fr;
  }

  .member-popup-meta-grid {
    grid-template-columns: 1fr;
  }
}
