/* ============================================= */
/* Referral Profit Tracker - Main Stylesheet */
/* Version: 1.3 | Secure | Optimized */
/* ============================================= */

/* 1. Base Styles */
:root {
  --bg-dark: #0f172a;
  --bg-darker: #1e293b;
  --border-color: #334155;
  --text-light: #e2e8f0;
  --text-muted: #94a3b8;
  --accent-blue: #38bdf8;
  --accent-purple: #8b5cf6;
  --accent-red: #ef4444;
  --accent-orange: #f59e0b;
  --white: #ffffff;
}

/* 2. Program Stats Grid */
.rpt-stats-wrapper {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

/* 3. Program Boxes (X, E1, X2, XX, X-MAX) */
.rpt-program-box {
  background: linear-gradient(145deg, var(--bg-dark), var(--bg-darker));
  border-radius: 16px;
  border: 1px solid var(--border-color);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
  min-height: 280px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.rpt-program-header {
  background: rgba(15, 23, 42, 0.7);
  padding: 15px 20px;
  border-bottom: 1px solid var(--border-color);
}

.rpt-program-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-light);
  letter-spacing: 1px;
  text-transform: uppercase;
  position: relative;
  display: inline-block;
}

.rpt-program-title span {
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-blue), transparent);
}

.rpt-program-content {
  padding: 20px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  position: relative;
}

.rpt-profit-display {
  background: rgba(30, 41, 59, 0.5);
  border-radius: 10px;
  padding: 20px;
  text-align: center;
  margin-bottom: 20px;
  border: 1px solid var(--border-color);
}

.rpt-profit-amount {
  margin: 0;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--accent-blue);
}

.rpt-profit-label {
  margin: 5px 0 0;
  font-size: 13px;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.rpt-stats-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
}

.rpt-stat-box {
  background: rgba(30, 41, 59, 0.5);
  border-radius: 8px;
  padding: 15px;
  flex: 1;
  border: 1px solid var(--border-color);
  position: relative;
  min-height: 80px;
}

.rpt-stat-icon {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 24px;
  height: 24px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
}

.rpt-stat-icon img {
  width: 16px;
  height: 16px;
  filter: brightness(0) invert(1);
}

.rpt-stat-value {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: var(--white);
}

.rpt-stat-label {
  margin: 5px 0 0;
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

/* 4. Summary Stats (Members, Partners, Profit) */
.rpt-summary-wrapper {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 30px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  padding: 30px;
  max-width: 1200px;
  margin: 0 auto;
}

.rpt-summary-box {
  background: #121a2b;
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 15px 45px rgba(0, 0, 0, 0.3);
  position: relative;
  overflow: hidden;
  height: 300px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.4s cubic-bezier(0.33, 1, 0.68, 1);
}

.rpt-summary-box:hover {
  transform: translateY(-10px);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4);
}

.box-content {
  position: relative;
  z-index: 10;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.stat-icon {
  width: 70px;
  height: 70px;
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

.stat-icon svg {
  color: #ffffff;
  width: 32px;
  height: 32px;
}

.custom-icon {
  width: 32px;
  height: 32px;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

.stat-title {
  margin: 0 0 10px 0;
  font-size: 20px;
  font-weight: 600;
  color: rgba(255,255,255,0.9);
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 42px;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 8px;
  text-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

/* Box-Specific Colors */
.members-box .stat-icon svg { color: #6496ff; }
.profit-box .stat-icon svg { color: #64ff96; }
.partners-box .stat-icon svg { color: #ff9664; }

/* 5. Responsive Adjustments */
@media (max-width: 1024px) {
  .rpt-summary-wrapper {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .rpt-stats-wrapper,
  .rpt-summary-wrapper {
    grid-template-columns: 1fr;
  }
  
  .rpt-program-box {
    min-height: 260px;
  }
  
  .rpt-summary-box {
    height: 280px;
    padding: 30px;
  }
  
  .stat-value {
    font-size: 38px;
  }
  
  .rpt-profit-amount,
  .rpt-stat-value {
    font-size: 28px;
  }
}

/* 6. Print Styles (Accessibility) */
@media print {
  .rpt-program-box,
  .rpt-summary-box {
    box-shadow: none;
    break-inside: avoid;
    page-break-inside: avoid;
  }
}