/* MLM Network Distribution Platform - Premium Dark Theme Stylesheet */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
  --bg-main: #0c0a1a;
  --bg-card: rgba(21, 18, 41, 0.65);
  --bg-card-hover: rgba(29, 25, 56, 0.85);
  --bg-input: rgba(14, 11, 29, 0.8);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-glass-focus: rgba(124, 58, 237, 0.5);
  
  --text-main: #f1f0f7;
  --text-muted: #9f9cb5;
  --text-dark: #121021;
  
  --primary: #7c3aed;
  --primary-glow: rgba(124, 58, 237, 0.35);
  --secondary: #4f46e5;
  --secondary-glow: rgba(79, 70, 229, 0.3);
  --accent: #d946ef;
  
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.2);
  --warning: #f59e0b;
  --danger: #ef4444;
  
  --gradient-primary: linear-gradient(135deg, #7c3aed, #4f46e5);
  --gradient-accent: linear-gradient(135deg, #d946ef, #8b5cf6);
  --gradient-dark: linear-gradient(180deg, #16122d, #0c0a1a);
  --gradient-success: linear-gradient(135deg, #059669, #10b981);
  
  --shadow-main: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px var(--primary-glow);
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  
  --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(124, 58, 237, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(79, 70, 229, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 50% 50%, rgba(217, 70, 239, 0.05) 0%, transparent 50%);
  background-attachment: fixed;
  color: var(--text-main);
  font-family: var(--font-main);
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
  background: rgba(124, 58, 237, 0.3);
  border-radius: var(--radius-sm);
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(124, 58, 237, 0.6);
}

/* Layout Utilities */
.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.view-section {
  display: none; /* Controlled by JS Router */
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
  animation: fadeIn 0.4s ease-out;
}

.view-section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Glassmorphism Card base */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-main);
  padding: 24px;
  margin-bottom: 24px;
  transition: var(--transition-smooth);
}

.glass-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(124, 58, 237, 0.2);
  box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.6), 0 0 15px rgba(124, 58, 237, 0.05);
}

/* Navigation Header */
.app-header {
  background: rgba(12, 10, 26, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-glass);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 12px 24px;
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.4rem;
  background: linear-gradient(135deg, #a78bfa, #f472b6);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo i {
  color: var(--primary);
  background: none;
  -webkit-text-fill-color: initial;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-badge {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.user-badge.admin {
  border-color: var(--accent);
  background: rgba(217, 70, 239, 0.1);
  color: #f472b6;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-main);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: var(--transition-smooth);
  text-decoration: none;
}

.btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(124, 58, 237, 0.5), 0 0 10px rgba(124, 58, 237, 0.2);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  border: 1px solid var(--border-glass);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-danger {
  background: var(--danger);
  color: white;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
}

/* Input Fields & Forms */
.form-group {
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
}

input, select, textarea {
  background-color: var(--bg-input);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.95rem;
  padding: 12px 16px;
  transition: var(--transition-smooth);
  width: 100%;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--border-glass-focus);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
  outline: none;
}

input[readonly] {
  background-color: rgba(255, 255, 255, 0.02);
  color: var(--text-muted);
  cursor: not-allowed;
}

.radio-group {
  display: flex;
  gap: 16px;
  margin-top: 6px;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.95rem;
  color: var(--text-main);
}

.radio-label input {
  width: auto;
  accent-color: var(--primary);
}

/* Auth Screens styling */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 480px;
  padding: 40px;
}

.auth-header {
  text-align: center;
  margin-bottom: 30px;
}

.auth-header h1 {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.auth-header p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.auth-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.auth-footer a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.auth-footer a:hover {
  text-decoration: underline;
}

/* Stepper (Signup Wizard) */
.steps-indicator {
  display: flex;
  justify-content: space-between;
  margin-bottom: 24px;
  position: relative;
}

.steps-indicator::before {
  content: '';
  position: absolute;
  top: 15px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--border-glass);
  z-index: 1;
}

.step-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-main);
  border: 2px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  z-index: 2;
  transition: var(--transition-smooth);
}

.step-dot.active {
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 0 10px rgba(124, 58, 237, 0.3);
}

.step-dot.completed {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* Achievement Ticker Banner */
.ticker-banner {
  background: linear-gradient(90deg, rgba(124, 58, 237, 0.15) 0%, rgba(79, 70, 229, 0.15) 50%, rgba(217, 70, 239, 0.15) 100%);
  border-bottom: 1px solid var(--border-glass);
  overflow: hidden;
  white-space: nowrap;
  padding: 8px 0;
  display: flex;
}

.ticker-content {
  display: inline-block;
  animation: scrollTicker 30s linear infinite;
  padding-left: 100%;
}

.ticker-item {
  display: inline-block;
  margin-right: 50px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #c084fc;
}

.ticker-item i {
  color: var(--accent);
  margin-right: 6px;
}

@keyframes scrollTicker {
  0% { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(-100%, 0, 0); }
}

/* Dashboard Tabs */
.tabs-navigation {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 8px;
  overflow-x: auto;
}

.tab-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font-main);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  transition: var(--transition-smooth);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.03);
}

.tab-btn.active {
  color: white;
  background: rgba(124, 58, 237, 0.15);
  box-shadow: inset 0 0 10px rgba(124, 58, 237, 0.1);
  border: 1px solid rgba(124, 58, 237, 0.2);
}

/* Dashboard Panel view containers */
.tab-content-panel {
  display: none;
}

.tab-content-panel.active {
  display: block;
  animation: tabFadeIn 0.3s ease-out;
}

@keyframes tabFadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Financial KPI Summary Cards */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.kpi-card {
  position: relative;
  overflow: hidden;
}

.kpi-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--gradient-primary);
}

.kpi-card.received::after {
  background: var(--gradient-success);
}

.kpi-card.balance::after {
  background: var(--gradient-accent);
}

.kpi-header {
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.95rem;
  margin-bottom: 8px;
}

.kpi-header i {
  font-size: 1.2rem;
  color: var(--primary);
}

.kpi-card.received i { color: var(--success); }
.kpi-card.balance i { color: var(--accent); }

.kpi-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: white;
}

/* Target & Progress Bars */
.progress-container {
  margin-bottom: 16px;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.progress-bar-bg {
  height: 10px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 5px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: 5px;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
  width: 0%; /* Dynamic */
}

.progress-bar-fill.side-b {
  background: var(--gradient-accent);
}

/* Tables Styling */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-glass);
}

td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  font-size: 0.95rem;
}

tr:hover td {
  background: rgba(255, 255, 255, 0.01);
}

/* Status Badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-approved, .status-active, .status-verified, .status-paid {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.status-review, .status-pending {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.status-rejected {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

/* Binary Tree Visualizer Grid */
.tree-container-outer {
  width: 100%;
  overflow: auto;
  padding: 20px;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  background: rgba(10, 8, 22, 0.5);
  display: flex;
  justify-content: center;
}

/* Styled HTML Tree structure */
.binary-tree {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
  padding: 20px;
  min-width: 900px;
}

.tree-row {
  display: flex;
  justify-content: space-around;
  width: 100%;
}

.tree-node-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  flex: 1;
}

.tree-node {
  background: rgba(21, 18, 41, 0.9);
  border: 2px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 12px;
  width: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  transition: var(--transition-smooth);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
  z-index: 5;
}

.tree-node:hover {
  border-color: var(--primary);
  transform: translateY(-4px);
  box-shadow: 0 8px 25px var(--primary-glow);
}

.tree-node.node-empty {
  border-style: dashed;
  background: rgba(255, 255, 255, 0.01);
  opacity: 0.5;
}

.tree-node.node-empty:hover {
  border-color: var(--accent);
  background: rgba(217, 70, 239, 0.05);
  opacity: 0.9;
}

.node-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  margin-bottom: 8px;
  box-shadow: inset 0 2px 4px rgba(255,255,255,0.2);
}

.node-id {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 700;
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 6px;
  border-radius: 4px;
  margin-bottom: 4px;
}

.node-name {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.node-branch-label {
  position: absolute;
  top: -24px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 3px;
}

.node-branch-a {
  color: #a78bfa;
  background: rgba(167, 139, 250, 0.1);
}

.node-branch-b {
  color: #f472b6;
  background: rgba(244, 114, 182, 0.1);
}

/* SVG Line Connections style */
.tree-lines-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  stroke: rgba(124, 58, 237, 0.25);
  stroke-width: 2;
  fill: none;
}

/* Details Popup Overlay Card */
.node-popup-card {
  position: fixed;
  background: rgba(15, 12, 33, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass-focus);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), 0 0 15px var(--primary-glow);
  width: 260px;
  z-index: 1000;
  animation: scaleUp 0.2s ease-out;
}

@keyframes scaleUp {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.popup-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.popup-row:last-child {
  border: none;
}

.popup-label {
  color: var(--text-muted);
}

.popup-value {
  font-weight: 600;
}

/* Modals Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(5, 4, 10, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: fadeIn 0.25s ease-out;
}

.modal-content {
  background: var(--gradient-dark);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-main);
  padding: 32px;
  width: 100%;
  max-width: 550px;
  animation: modalSlideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.modal-close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.modal-close-btn:hover {
  color: white;
}

@keyframes modalSlideUp {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Admin Dashboard Analytics Panels */
.admin-charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

@media (max-width: 992px) {
  .admin-charts-grid {
    grid-template-columns: 1fr;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
}

/* Custom CSS SVG Chart representation */
.svg-chart-container {
  width: 100%;
  height: 220px;
  margin-top: 16px;
  position: relative;
}

.chart-bar {
  fill: url(#primaryGrad);
  rx: 4;
  transition: height 1s ease;
}

.chart-bar:hover {
  fill: url(#accentGrad);
  cursor: pointer;
}

/* Holding Screens */
.holding-view {
  text-align: center;
  max-width: 600px;
  margin: 80px auto;
  padding: 40px;
}

.holding-icon {
  font-size: 4rem;
  color: var(--warning);
  margin-bottom: 24px;
  animation: pulseGlow 2s infinite;
}

.holding-icon.success-icon {
  color: var(--success);
}

.holding-icon.error-icon {
  color: var(--danger);
}

@keyframes pulseGlow {
  0% { transform: scale(1); filter: drop-shadow(0 0 2px rgba(245, 158, 11, 0.4)); }
  50% { transform: scale(1.05); filter: drop-shadow(0 0 15px rgba(245, 158, 11, 0.8)); }
  100% { transform: scale(1); filter: drop-shadow(0 0 2px rgba(245, 158, 11, 0.4)); }
}

.holding-view h2 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.holding-view p {
  color: var(--text-muted);
  margin-bottom: 30px;
}

/* File Upload input custom styled */
.file-upload-wrapper {
  border: 2px dashed var(--border-glass);
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
  position: relative;
  cursor: pointer;
  transition: var(--transition-smooth);
  background: rgba(255, 255, 255, 0.01);
}

.file-upload-wrapper:hover {
  border-color: var(--primary);
  background: rgba(124, 58, 237, 0.03);
}

.file-upload-wrapper input[type="file"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.file-upload-icon {
  font-size: 2rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.file-upload-text {
  font-size: 0.9rem;
  font-weight: 500;
}

.file-upload-subtext {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Receipt preview mock */
.receipt-preview-thumbnail {
  margin-top: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
}

.receipt-preview-thumbnail button {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
}

/* Receipt Preview Modal Image */
.receipt-modal-img {
  width: 100%;
  max-height: 400px;
  object-fit: contain;
  border-radius: var(--radius-md);
  margin-top: 16px;
  background: #fff;
  border: 2px solid #ddd;
}
