/* BareProp User Dashboard — Dark Theme */
/* Shares base variables with admin.css but tailored for trader experience */

:root {
  /* Colors */
  --bg-primary: #0c0f14;
  --bg-secondary: #131720;
  --bg-card: #171c28;
  --bg-input: #1a2030;
  --bg-hover: #1f2740;
  --bg-sidebar: #0e1118;

  --text-primary: #e8eaed;
  --text-secondary: #9aa0b0;
  --text-muted: #5f6678;

  --accent-gold: #d4a843;
  --accent-gold-light: #f0d078;
  --accent-green: #22c55e;
  --accent-red: #ef4444;
  --accent-blue: #3b82f6;
  --accent-cyan: #06b6d4;
  --accent-purple: #8b5cf6;
  --accent-orange: #f59e0b;

  --border-color: #1e2538;
  --border-light: #2a3350;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  /* Transitions */
  --transition: all 0.2s ease;

  /* Sidebar */
  --sidebar-width: 250px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--accent-gold); text-decoration: none; }
a:hover { color: var(--accent-gold-light); }

/* ===== SIDEBAR ===== */
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex; flex-direction: column;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-brand {
  padding: 20px 16px;
  display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-brand img { height: 32px; width: auto; }

.sidebar-brand-text {
  font-size: 18px; font-weight: 700;
  color: var(--accent-gold);
}

.sidebar-brand-sub {
  font-size: 10px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 1.5px;
}

.sidebar-nav { flex: 1; padding: 8px 0; overflow-y: auto; }

.nav-section-title {
  padding: 16px 16px 6px;
  font-size: 10px; font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 1.2px;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  color: var(--text-secondary);
  cursor: pointer; transition: var(--transition);
  text-decoration: none; font-size: 13px;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--bg-hover);
  color: var(--accent-gold);
  border-left-color: var(--accent-gold);
}

.nav-item .icon { font-size: 16px; width: 22px; text-align: center; }

.sidebar-footer {
  border-top: 1px solid var(--border-color);
  padding: 8px 0;
}

/* ===== MAIN CONTENT ===== */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  background: var(--bg-primary);
}

.topbar {
  height: 60px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 50;
}

.topbar-title {
  font-size: 18px; font-weight: 600;
}

.topbar-actions {
  display: flex; align-items: center; gap: 12px;
}

.topbar-user {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-secondary);
}

.page-content {
  padding: 24px;
  max-width: 1200px;
}

/* ===== CARDS ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex; align-items: center; justify-content: space-between;
}

.card-title {
  font-size: 15px; font-weight: 600;
}

.card-body {
  padding: 20px;
}

.card-body.no-padding { padding: 0; }

/* ===== STATS GRID ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  border-top: 3px solid var(--accent-gold);
}

.stat-card.gold { border-top-color: var(--accent-gold); }
.stat-card.blue { border-top-color: var(--accent-blue); }
.stat-card.green { border-top-color: var(--accent-green); }
.stat-card.purple { border-top-color: var(--accent-purple); }
.stat-card.cyan { border-top-color: var(--accent-cyan); }
.stat-card.red { border-top-color: var(--accent-red); }
.stat-card.orange { border-top-color: var(--accent-orange); }

.stat-label {
  font-size: 11px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 28px; font-weight: 700;
  color: var(--text-primary);
}

/* ===== DATA TABLE ===== */
.data-table {
  width: 100%; border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  padding: 10px 14px;
  text-align: left; font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
  vertical-align: top;
}

.data-table tr:hover td {
  background: var(--bg-hover);
}

.data-table tr:last-child td { border-bottom: none; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border: none; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
  cursor: pointer; transition: var(--transition);
  text-decoration: none; white-space: nowrap;
}

.btn-sm { padding: 5px 10px; font-size: 12px; }

.btn-primary {
  background: var(--accent-gold); color: #0c0f14;
}
.btn-primary:hover { background: var(--accent-gold-light); }

.btn-secondary {
  background: var(--bg-input); color: var(--text-secondary);
  border: 1px solid var(--border-color);
}
.btn-secondary:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-success {
  background: rgba(34,197,94,0.15); color: var(--accent-green);
  border: 1px solid rgba(34,197,94,0.3);
}
.btn-success:hover { background: rgba(34,197,94,0.25); }

.btn-danger {
  background: rgba(239,68,68,0.15); color: var(--accent-red);
  border: 1px solid rgba(239,68,68,0.3);
}
.btn-danger:hover { background: rgba(239,68,68,0.25); }

.btn-icon { padding: 4px 8px; font-size: 14px; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 14px; }

.form-label {
  display: block; font-size: 12px; font-weight: 500;
  color: var(--text-secondary); margin-bottom: 4px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  transition: var(--transition);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 2px rgba(212,168,67,0.15);
}

.form-textarea { min-height: 80px; resize: vertical; }
.form-select { cursor: pointer; }

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

/* ===== STATUS BADGES ===== */
.badge-status {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px; font-weight: 600;
  text-transform: capitalize;
}

.badge-status.active { background: rgba(34,197,94,0.15); color: var(--accent-green); }
.badge-status.completed { background: rgba(59,130,246,0.15); color: var(--accent-blue); }
.badge-status.failed { background: rgba(239,68,68,0.15); color: var(--accent-red); }
.badge-status.funded { background: rgba(212,168,67,0.15); color: var(--accent-gold); }
.badge-status.revoked { background: rgba(239,68,68,0.2); color: var(--accent-red); }
.badge-status.paused { background: rgba(245,158,11,0.15); color: var(--accent-orange); }
.badge-status.pending { background: rgba(245,158,11,0.15); color: var(--accent-orange); }
.badge-status.paid { background: rgba(34,197,94,0.15); color: var(--accent-green); }
.badge-status.error { background: rgba(239,68,68,0.15); color: var(--accent-red); }
.badge-status.trader { background: rgba(6,182,212,0.15); color: var(--accent-cyan); }
.badge-status.admin { background: rgba(139,92,246,0.15); color: var(--accent-purple); }
.badge-status.completion { background: rgba(59,130,246,0.15); color: var(--accent-blue); }
.badge-status.achievement { background: rgba(212,168,67,0.15); color: var(--accent-gold); }
.badge-status.excellence { background: rgba(139,92,246,0.15); color: var(--accent-purple); }

/* ===== PROGRESS BAR ===== */
.progress-bar {
  width: 100%; height: 8px;
  background: var(--bg-input);
  border-radius: 4px;
  overflow: hidden;
  margin: 4px 0;
}

.progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

.progress-fill.green { background: var(--accent-green); }
.progress-fill.gold { background: var(--accent-gold); }
.progress-fill.blue { background: var(--accent-blue); }
.progress-fill.red { background: var(--accent-red); }

/* ===== MT5 CREDENTIALS BOX ===== */
.mt5-box {
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 16px;
}

.mt5-title {
  font-size: 12px; font-weight: 600;
  color: var(--accent-gold);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.mt5-field {
  display: flex; justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-color);
}

.mt5-field:last-child { border-bottom: none; }

.mt5-field-label { font-size: 12px; color: var(--text-muted); }

.mt5-field-value {
  font-size: 13px; font-family: monospace;
  color: var(--text-primary); font-weight: 600;
}

/* ===== DETAIL GRID ===== */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.detail-field { }

.detail-label {
  font-size: 10px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.detail-value {
  font-size: 14px; font-weight: 600;
  color: var(--text-primary);
}

/* ===== ALERTS ===== */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
}

.alert-success {
  background: rgba(34,197,94,0.1);
  border: 1px solid rgba(34,197,94,0.3);
  color: var(--accent-green);
}

.alert-error {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  color: var(--accent-red);
}

.alert-info {
  background: rgba(59,130,246,0.1);
  border: 1px solid rgba(59,130,246,0.3);
  color: var(--accent-blue);
}

.alert-warning {
  background: rgba(245,158,11,0.1);
  border: 1px solid rgba(245,158,11,0.3);
  color: var(--accent-orange);
}

/* ===== MODALS ===== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.show {
  opacity: 1; pointer-events: auto;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  width: 90%; max-width: 560px;
  max-height: 85vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex; align-items: center; justify-content: space-between;
}

.modal-title { font-size: 16px; font-weight: 600; }

.modal-close {
  width: 28px; height: 28px;
  background: none; border: none;
  color: var(--text-muted); font-size: 20px;
  cursor: pointer; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }

.modal-body { padding: 20px; }

.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-color);
  display: flex; justify-content: flex-end; gap: 8px;
}

/* ===== FILTERS BAR ===== */
.filters-bar {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-bottom: 16px;
}

.filters-bar .form-select,
.filters-bar .form-input {
  max-width: 200px;
}

/* ===== LOADING ===== */
.loading-overlay {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; padding: 40px;
  color: var(--text-muted); font-size: 14px;
}

.spinner {
  width: 24px; height: 24px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent-gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center; padding: 40px 20px;
  color: var(--text-muted);
}

.empty-state .icon { font-size: 40px; margin-bottom: 8px; }
.empty-state .title { font-size: 16px; font-weight: 600; color: var(--text-secondary); margin-bottom: 4px; }
.empty-state .description { font-size: 13px; }

/* ===== TOAST ===== */
.toast-container {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 300;
  display: flex; flex-direction: column; gap: 8px;
}

.toast {
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  animation: slideIn 0.3s ease;
  box-shadow: var(--shadow-md);
}

.toast-success { background: rgba(34,197,94,0.9); color: #fff; }
.toast-error { background: rgba(239,68,68,0.9); color: #fff; }

@keyframes slideIn {
  from { transform: translateX(100px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ===== LOGIN PAGE ===== */
.login-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--bg-primary) 0%, #0e1420 50%, #111827 100%);
}

.login-card {
  width: 90%; max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 24px; justify-content: center;
}

.login-logo img { height: 40px; width: auto; }

.login-logo span {
  font-size: 24px; font-weight: 700;
  color: var(--accent-gold);
}

.login-title {
  text-align: center;
  font-size: 18px; font-weight: 600;
  margin-bottom: 24px;
  color: var(--text-secondary);
}

.login-card .form-group { margin-bottom: 16px; }

.login-card .btn-primary {
  width: 100%; justify-content: center;
  padding: 12px; font-size: 14px;
}

.login-links {
  text-align: center; margin-top: 16px;
  font-size: 13px; color: var(--text-muted);
}

/* ===== CHALLENGE PRODUCT CARDS ===== */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.product-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  transition: var(--transition);
}

.product-card:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow-sm);
}

.product-card .product-name {
  font-size: 16px; font-weight: 600;
  margin-bottom: 6px;
}

.product-card .product-desc {
  font-size: 12px; color: var(--text-secondary);
  margin-bottom: 14px; line-height: 1.5;
}

.product-card .product-meta {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 8px; margin-bottom: 14px;
  font-size: 11px;
}

.product-card .product-meta-label { color: var(--text-muted); }
.product-card .product-meta-value { color: var(--text-primary); font-weight: 500; }

.product-card .variant-select {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  margin-bottom: 12px;
}

.product-card .variant-info {
  font-size: 12px; color: var(--text-secondary);
  margin-bottom: 14px;
}

.product-card .product-actions {
  display: flex; gap: 8px;
}

.product-card .product-actions .btn { flex: 1; justify-content: center; }

/* ===== CHALLENGE DETAIL CARD ===== */
.challenge-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 16px;
}

.challenge-card .challenge-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 16px;
}

.challenge-card .challenge-product {
  font-size: 15px; font-weight: 600;
}

.challenge-card .challenge-phase {
  font-size: 12px; color: var(--text-muted);
}

.challenge-card .challenge-progress {
  margin: 12px 0;
}

.challenge-card .challenge-progress-label {
  display: flex; justify-content: space-between;
  font-size: 12px; margin-bottom: 4px;
}

/* ===== CERTIFICATE CARD ===== */
.certificate-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-top: 3px solid var(--accent-gold);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 16px;
}

.certificate-card .cert-number {
  font-family: monospace;
  font-size: 14px; font-weight: 700;
  color: var(--accent-cyan);
  margin-bottom: 8px;
}

.certificate-card .cert-type {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px; font-weight: 600;
  text-transform: capitalize;
  margin-bottom: 8px;
}

/* ===== PROFILE SECTION ===== */
.profile-header {
  display: flex; align-items: center; gap: 20px;
  margin-bottom: 24px;
}

.profile-avatar {
  width: 64px; height: 64px;
  background: var(--bg-input);
  border: 2px solid var(--accent-gold);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
}

.profile-info h2 { font-size: 20px; font-weight: 600; }
.profile-info p { font-size: 13px; color: var(--text-secondary); }

/* ===== HIDDEN ===== */
.hidden { display: none !important; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
  }
  .page-content {
    padding: 16px;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  .detail-grid {
    grid-template-columns: 1fr 1fr;
  }
  .product-grid {
    grid-template-columns: 1fr;
  }
  .data-table { font-size: 11px; }
  .data-table th, .data-table td { padding: 6px 8px; }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .topbar { padding: 0 12px; }
  .page-content { padding: 12px; }
}
