/* ===================================================
   KEAGENAN PAGE — Premium Redesign
   =================================================== */

/* ---- Level Grid ---- */
.levels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}

.level-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1.2rem 1rem;
  text-align: center;
  transition: all 0.25s ease;
  cursor: default;
  position: relative;
  overflow: hidden;
}

.level-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: 14px 14px 0 0;
}

.level-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.25);
  border-color: var(--primary);
}

/* Level badge per warna */
.level-badge {
  display: inline-block;
  padding: 0.3rem 0.9rem;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

.lv-user    { background: rgba(107,114,128,0.2); color: #9ca3af; border: 1px solid #4b5563; }
.lv-user::before, .level-card.lv-user::before { background: #6b7280; }

.lv-silver  { background: rgba(148,163,184,0.2); color: #cbd5e1; border: 1px solid #94a3b8; }
.lv-silver::before, .level-card.lv-silver::before { background: linear-gradient(90deg, #94a3b8, #e2e8f0); }

.lv-gold    { background: rgba(234,179,8,0.15); color: #fbbf24; border: 1px solid #d97706; }
.lv-gold::before, .level-card.lv-gold::before { background: linear-gradient(90deg, #f59e0b, #fcd34d); }

.lv-platinum { background: rgba(99,102,241,0.15); color: #a5b4fc; border: 1px solid #6366f1; }
.lv-platinum::before, .level-card.lv-platinum::before { background: linear-gradient(90deg, #6366f1, #a5b4fc); }

.lv-master  { background: rgba(168,85,247,0.15); color: #d8b4fe; border: 1px solid #a855f7; }
.lv-master::before, .level-card.lv-master::before { background: linear-gradient(90deg, #a855f7, #e879f9); }

.level-card-icon {
  font-size: 1.8rem;
  margin-bottom: 0.4rem;
  display: block;
}

.level-card-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.level-card-count {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

.level-card-sub {
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-top: 0.2rem;
}

.level-card-bar {
  margin-top: 0.75rem;
  height: 5px;
  background: rgba(255,255,255,0.07);
  border-radius: 3px;
  overflow: hidden;
}

.level-card-progress {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s ease;
}

/* ---- Page Tabs (in-page) ---- */
.page-tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 2px solid var(--border-color);
  margin-bottom: 1.25rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.page-tabs::-webkit-scrollbar { display: none; }

.page-tab {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.65rem 1.1rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  border-radius: 6px 6px 0 0;
  transition: all 0.2s;
  white-space: nowrap;
  font-family: inherit;
}

.page-tab:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.04);
}

.page-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: rgba(108,99,255,0.08);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---- Action Toolbar ---- */
.keagenan-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  margin-bottom: 1rem;
}

.keagenan-toolbar .input-search {
  flex: 1;
  min-width: 180px;
}

/* ---- Level badge in table ---- */
.lvbadge {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ---- Downline sub-row ---- */
.downline-row td {
  background: rgba(108,99,255,0.06) !important;
  font-size: 0.85rem;
}

.downline-row td:first-child {
  padding-left: 2rem;
}

/* ---- Empty State ---- */
.empty-state {
  text-align: center;
  padding: 2rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ---- Komissi card mini ---- */
.commission-meta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.commission-tag {
  background: rgba(34,197,94,0.1);
  color: #22c55e;
  border-radius: 8px;
  padding: 0.2rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 600;
}

/* ---- Responsive ---- */
@media (max-width: 640px) {
  .levels-grid { grid-template-columns: repeat(2, 1fr); }
  .keagenan-toolbar { flex-direction: column; align-items: stretch; }
}
