/* ==========================================================================
   JUST MARKET — Dashboard CSS (rgba package backgrounds, light mode fixes)
   ========================================================================== */

body.app-body { overflow-x: hidden; position: relative; }
body.app-body::after {
  content: ''; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background-image: radial-gradient(circle at 10% 20%, rgba(0,230,168,0.06) 1px, transparent 1px),
                    radial-gradient(circle at 90% 80%, rgba(124,58,237,0.05) 1px, transparent 1px);
  background-size: 80px 80px; z-index: -1; pointer-events: none;
}

/* Light mode background fix */
body.app-body.light-mode::after { opacity: 0.3; }

.dash-content { padding: 16px; max-width: 1200px; margin: 0 auto; width: 100%; padding-bottom: 80px; }

/* Page header */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.page-header .left h1 { font-size: 20px; font-weight: 700; color: var(--text-color); }
.page-header .left p { font-size: 13px; color: var(--text-dim); margin-top: 2px; }
.page-header .right { display: flex; gap: 8px; }
.page-header .right button { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 8px; padding: 8px 12px; color: var(--text-dim); cursor: pointer; }
.page-header .right button:hover { border-color: var(--highlight-color); color: var(--highlight-color); }

/* Wallet bar */
.wallet-bar { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 22px; }
.wallet-card {
  flex: 1 1 200px; background: var(--bg-card); border: 1px solid var(--border-color);
  padding: 16px; border-radius: 12px; position: relative; overflow: hidden;
}
.wallet-card .label { font-size: 12px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .5px; }
.wallet-card .value { font-family: var(--font-mono); font-size: 22px; color: var(--highlight-color); margin-top: 6px; font-weight: bold; }
.wallet-card .sub-value { font-size: 12px; color: var(--text-dim); margin-top: 3px; }
.wallet-card i.bg-icon { position: absolute; right: 10px; top: 10px; font-size: 34px; opacity: .12; color: var(--highlight-color); }

/* Gradient balance card (Pink) */
.balance-card {
  background: linear-gradient(135deg, #FF3E6C 0%, #DB2777 100%);
  border-radius: 16px; padding: 24px; color: #fff; position: relative; overflow: hidden; margin-bottom: 16px;
}
.balance-card .label { font-size: 14px; opacity: 0.9; }
.balance-card .amount { font-size: 32px; font-weight: 700; font-family: var(--font-mono); margin: 8px 0; display: flex; align-items: center; gap: 10px; }
.balance-card .amount .eye-toggle { cursor: pointer; font-size: 18px; opacity: 0.7; }
.balance-card .wallet-icon { position: absolute; top: 20px; right: 20px; font-size: 24px; opacity: 0.3; }
.balance-card .bottom-strip {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 16px; padding-top: 16px; border-top: 1px solid rgba(255,255,255,0.15);
  font-size: 13px;
}
.balance-card .bottom-strip .account-id { display: flex; align-items: center; gap: 8px; }
.balance-card .bottom-strip .verified { display: flex; align-items: center; gap: 4px; }
.balance-card .bottom-strip .copy-btn { cursor: pointer; opacity: 0.7; transition: opacity 0.2s; }
.balance-card .bottom-strip .copy-btn:hover { opacity: 1; }

/* Referral card (Dodger Blue) */
.referral-card {
  background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
  border-radius: 16px; padding: 24px; color: #fff; margin-bottom: 16px;
}
.referral-card .header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; }
.referral-card .header h3 { font-size: 18px; font-weight: 700; }
.referral-card .header p { font-size: 13px; opacity: 0.8; margin-top: 4px; }
.referral-card .share-icon { cursor: pointer; opacity: 0.7; }
.referral-card .stats { display: flex; gap: 16px; margin-bottom: 16px; }
.referral-card .stat-box { flex: 1; }
.referral-card .stat-box .stat-label { font-size: 12px; opacity: 0.8; }
.referral-card .stat-box .stat-value { font-size: 20px; font-weight: 700; font-family: var(--font-mono); }
.referral-card .ref-code-row { display: flex; align-items: center; justify-content: space-between; background: rgba(255,255,255,0.1); border-radius: 10px; padding: 12px 16px; }
.referral-card .ref-code-row .code { font-family: var(--font-mono); font-size: 16px; font-weight: 700; }

/* Action buttons row (no logout) */
.action-row { display: flex; gap: 12px; margin-bottom: 20px; }
.action-row .action-btn {
  flex: 1; padding: 12px; border-radius: 10px; border: 1px solid var(--border-color);
  background: var(--bg-card); color: var(--text-color); font-size: 14px; font-weight: 500;
  cursor: pointer; text-align: center; text-decoration: none; transition: all 0.2s;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.action-row .action-btn:hover { background: var(--bg-card-hover); text-decoration: none; }
.action-row .action-btn.primary { background: var(--highlight-color); color: #000; border: none; }

/* Section heading */
.section-heading { font-size: 18px; color: var(--text-color); margin: 24px 0 14px; font-weight: 600; }

/* Package cards — NO TradingView, rgba backgrounds */
.package-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.package-card {
  border-radius: 12px; padding: 18px;
  position: relative; overflow: hidden; transition: transform .2s, box-shadow .2s; cursor: pointer;
  min-height: 280px;
}
.package-card:hover { transform: translateY(-4px); }
.package-card .pkg-icon-bg { position: absolute; right: -10px; top: -10px; font-size: 90px; opacity: .06; color: var(--highlight-color); }
.package-card .pkg-top { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.package-card .pkg-icon { font-size: 26px; color: var(--highlight-color); width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; background: var(--highlight-rgba); border-radius: 50%; }
.package-card .pkg-name { font-weight: 600; color: var(--text-color); font-size: 15px; }
.package-card .pkg-symbol { font-family: var(--font-mono); color: var(--text-dim); font-size: 12px; }
.package-card .pkg-fav { position: absolute; top: 16px; right: 16px; cursor: pointer; color: var(--text-faint); transition: color 0.2s; z-index: 3; }
.package-card .pkg-fav.active { color: var(--warn-color); }
.package-card .pkg-fav:hover { color: var(--warn-color); }
.package-card .pkg-change.up { color: var(--up-color); }
.package-card .pkg-change.down { color: var(--down-color); }
.package-card .pkg-price-row { margin-bottom: 10px; }
.package-card .pkg-price { font-family: var(--font-mono); font-size: 18px; font-weight: 700; color: var(--text-color); }
.package-card .pkg-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; font-size: 12px; }
.package-card .pkg-stat-label { color: var(--text-dim); }
.package-card .pkg-stat-value { font-family: var(--font-mono); color: var(--text-color); }
.package-card .pkg-stat-value.green { color: var(--up-color); }
.package-card .pkg-stat-value.red { color: var(--down-color); }
.package-card .pkg-volume { color: var(--text-dim); }
.package-card .btn-trade-buy { transition: all 0.2s; }
.package-card .btn-trade-buy:hover { opacity: 0.9; transform: translateY(-1px); }

/* Buttons and Forms */
button, a.btn, input[type="submit"] { transition: all 0.2s ease; font-weight: 600; cursor: pointer; }
button:hover, a.btn:hover, input[type="submit"]:hover { opacity: 0.9; transform: translateY(-1px); }
button:active, a.btn:active, input[type="submit"]:active { transform: translateY(0); }

input[type="text"], input[type="email"], input[type="password"], input[type="number"],
textarea, select {
  background: var(--bg-light); border: 1px solid var(--border-color); color: var(--text-color);
  padding: 10px 14px; border-radius: 8px; font-size: 14px; transition: border-color 0.2s;
}
input[type="text"]:focus, input[type="email"]:focus, input[type="password"]:focus,
input[type="number"]:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--highlight-color); box-shadow: 0 0 0 3px rgba(0, 230, 168, 0.1);
}

/* Staking modal */
.staking-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 8000; display: none; align-items: center; justify-content: center; backdrop-filter: blur(4px); }
.staking-modal-overlay.open { display: flex; }
.staking-modal { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 16px; padding: 24px; max-width: 500px; width: 90%; max-height: 90vh; overflow-y: auto; }
.staking-modal .modal-title { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 700; color: var(--text-color); }
.staking-modal .modal-sub { font-size: 13px; color: var(--text-dim); margin: 4px 0 16px; }
.staking-modal .summary-boxes { display: flex; gap: 12px; margin-bottom: 16px; }
.staking-modal .summary-box { flex: 1; background: var(--bg-light); border-radius: 10px; padding: 12px; text-align: center; }
.staking-modal .summary-box .sb-label { font-size: 11px; color: var(--text-dim); margin-bottom: 4px; }
.staking-modal .summary-box .sb-value { font-size: 16px; font-weight: 700; }
.staking-modal .summary-box.green { border: 1px solid var(--highlight-color); }
.staking-modal .summary-box.green .sb-value { color: var(--highlight-color); }
.staking-modal .summary-box.purple { border: 1px solid var(--grad-purple-start); }
.staking-modal .summary-box.purple .sb-value { color: var(--grad-purple-start); }

/* Trade history item */
.inv-item { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 12px; padding: 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; transition: border-color 0.2s; }
.inv-item:hover { border-color: var(--highlight-color); }
.inv-item .left { display: flex; align-items: center; gap: 12px; }
.inv-item .icon { width: 42px; height: 48px; border-radius: 10px; background: var(--highlight-rgba); display: flex; align-items: center; justify-content: center; color: var(--highlight-color); font-size: 18px; }
.inv-item .name { font-weight: 600; color: var(--text-color); font-size: 15px; }
.inv-item .meta { font-size: 12px; color: var(--text-dim); font-family: var(--font-mono); margin-top: 2px; }
.inv-item .amt { font-family: var(--font-mono); text-align: right; color: var(--text-color); }
.status-badge { font-size: 11px; padding: 4px 10px; border-radius: 12px; text-transform: uppercase; font-weight: bold; display: inline-block; margin-top: 4px; }
.status-running { background: rgba(51,170,255,0.15); color: var(--info-color); }
.status-matured { background: rgba(0,204,68,0.15); color: var(--up-color); }
.status-cancelled { background: rgba(255,51,51,0.15); color: var(--down-color); }

/* Light mode fixes */
body.light-mode .package-card .pkg-name { color: #1a1a1a; }
body.light-mode .package-card .pkg-price { color: #1a1a1a; }
body.light-mode .package-card .pkg-stat-value { color: #1a1a1a; }
body.light-mode .balance-card { background: linear-gradient(135deg, #FF3E6C 0%, #DB2777 100%); }
body.light-mode .referral-card { background: linear-gradient(135deg, #007bff 0%, #0056b3 100%); }
body.light-mode .inv-item { background: #fff; border-color: rgba(0,0,0,0.1); }
body.light-mode .inv-item:hover { border-color: var(--highlight-color); }
body.light-mode .inv-item .name { color: #1a1a1a; }
body.light-mode .inv-item .amt { color: #1a1a1a; }
body.light-mode .wallet-card { background: #fff; }
body.light-mode .action-row .action-btn { background: #fff; }
body.light-mode .staking-modal { background: #fff; }

/* Search bar */
.search-bar { width: 100%; padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; background: var(--bg-light); border: 1px solid var(--border-color); color: var(--text-color); font-size: 14px; }
.search-bar:focus { outline: none; border-color: var(--highlight-color); }

/* Tabs */
.tabs { display: flex; gap: 8px; }
.tabs button { background: var(--bg-light); border: 1px solid var(--border-color); border-radius: 8px; padding: 8px 16px; color: var(--text-dim); font-size: 13px; font-weight: 600; cursor: pointer; }
.tabs button.active { background: var(--highlight-color); color: #000; border: none; }

/* Empty state */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-dim); }
.empty-state .icon { font-size: 48px; opacity: 0.3; margin-bottom: 12px; }
.empty-state h3 { font-size: 16px; color: var(--text-color); margin-bottom: 4px; }
.empty-state p { font-size: 13px; }
.empty-state a { color: var(--highlight-color); }

/* Landing page package card extras (start-here, earn-line, start-btn) */
.package-card .start-here { background: var(--highlight-rgba); border-radius: 8px; padding: 10px; text-align: center; margin-bottom: 12px; }
.package-card .start-here .min-amount { font-size: 20px; font-weight: 700; color: var(--text-color); font-family: var(--font-mono); }
.package-card .start-here .min-label { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.package-card .earn-line { font-size: 13px; color: var(--highlight-color); margin-bottom: 12px; font-weight: 500; }
.package-card .start-btn {
  width: 100%; padding: 10px; border: none; border-radius: 10px;
  background: var(--bg-light); color: var(--highlight-color); font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all 0.2s;
}
.package-card .start-btn:hover { background: var(--highlight-color); color: #000; }
body.light-mode .package-card .start-here .min-amount { color: #1a1a1a; }
body.light-mode .package-card .start-btn { background: #f0f2f5; }

/* White trading card default - dark text for readability in both dark and light mode */
.package-card[style*="#ffffff"] .pkg-name,
.package-card[style*="background: #ffffff"] .pkg-name { color: #1a1a1a !important; }

.package-card[style*="#ffffff"] .pkg-price,
.package-card[style*="background: #ffffff"] .pkg-price { color: #1a1a1a !important; }

.package-card[style*="#ffffff"] .pkg-stat-value,
.package-card[style*="background: #ffffff"] .pkg-stat-value { color: #1a1a1a !important; }

.package-card[style*="#ffffff"] .pkg-stat-label,
.package-card[style*="background: #ffffff"] .pkg-stat-label { color: #666 !important; }

.package-card[style*="#ffffff"] .pkg-symbol,
.package-card[style*="background: #ffffff"] .pkg-symbol { color: #666 !important; }

.package-card[style*="#ffffff"] .pkg-volume,
.package-card[style*="background: #ffffff"] .pkg-volume { color: #888 !important; }

.package-card[style*="#ffffff"] .pkg-change.up,
.package-card[style*="background: #ffffff"] .pkg-change.up { color: #00a854 !important; }

.package-card[style*="#ffffff"] .pkg-change.down,
.package-card[style*="background: #ffffff"] .pkg-change.down { color: #ff3b30 !important; }

/* ===== STYLED MODALS ===== */
.modal-card {
  background: var(--bg-card, #171d2b);
  border: 1px solid var(--border-color, rgba(255,255,255,0.08));
  border-radius: 16px;
  padding: 24px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  position: relative;
  animation: modalSlideIn 0.25s ease;
}
@keyframes modalSlideIn {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-close-x {
  position: absolute;
  top: 12px; right: 16px;
  background: none; border: none;
  color: var(--text-dim, #9CA3AF);
  font-size: 22px; cursor: pointer;
  transition: color 0.2s;
}
.modal-close-x:hover { color: var(--text-color, #fff); }
.modal-header {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 4px;
}
.modal-header-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  background: rgba(0, 230, 168, 0.12);
  color: var(--highlight-color, #00e6a8);
}
.modal-header-success .modal-header-icon {
  background: rgba(0, 204, 68, 0.12);
  color: var(--up-color, #00cc44);
}
.modal-title {
  font-size: 16px; font-weight: 700;
  color: var(--text-color, #fff);
  margin: 0;
}
.modal-subtitle {
  font-size: 12px; color: var(--text-dim, #9CA3AF);
  margin: 2px 0 0;
}
.modal-label {
  font-size: 12px; color: var(--text-dim, #9CA3AF);
  display: block; margin-bottom: 6px;
}

/* Segmented quick-amount buttons */
.quick-amounts-group {
  display: flex; gap: 8px; margin-bottom: 12px;
}
.quick-amt-btn {
  flex: 1; padding: 10px 4px;
  border: 1px solid var(--border-color, rgba(255,255,255,0.08));
  border-radius: 10px;
  background: transparent;
  color: var(--text-dim, #9CA3AF);
  font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all 0.2s;
}
.quick-amt-btn:hover {
  border-color: var(--highlight-color, #00e6a8);
  color: var(--highlight-color, #00e6a8);
}
.quick-amt-btn.active {
  background: var(--highlight-color, #00e6a8);
  color: #0a0b10;
  border-color: var(--highlight-color, #00e6a8);
}

/* Summary rows */
.modal-summary {
  background: rgba(255,255,255,0.03);
  border-radius: 10px;
  padding: 12px 16px;
}
.modal-summary-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.modal-summary-row:last-child { border-bottom: none; }
.modal-summary-row > span:first-child {
  color: var(--text-dim, #9CA3AF);
}
.modal-summary-value {
  color: var(--text-color, #fff);
  font-weight: 500;
}

/* Status badge */
.modal-status-badge {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px; font-weight: 600;
}
.modal-status-running {
  background: rgba(51, 170, 255, 0.15);
  color: var(--info-color, #33aaff);
}

/* Modal buttons */
.modal-btn-cancel {
  padding: 10px 20px; border-radius: 10px;
  font-size: 13px;
}
.modal-btn-confirm {
  padding: 10px 20px; border-radius: 10px;
  font-size: 13px;
}

/* Light mode modal overrides */
body.light-mode .modal-card {
  background: #ffffff;
  border-color: rgba(0,0,0,0.1);
  box-shadow: 0 20px 60px rgba(0,0,0,0.12);
}
body.light-mode .modal-close-x { color: #666; }
body.light-mode .modal-title { color: #1a1a1a; }
body.light-mode .modal-subtitle { color: #666; }
body.light-mode .modal-label { color: #666; }
body.light-mode .quick-amt-btn {
  border-color: rgba(0,0,0,0.1);
  color: #666;
}
body.light-mode .quick-amt-btn:hover {
  border-color: var(--highlight-color, #00a854);
  color: var(--highlight-color, #00a854);
}
body.light-mode .quick-amt-btn.active {
  background: var(--highlight-color, #00a854);
  color: #fff;
}
body.light-mode .modal-summary {
  background: rgba(0,0,0,0.03);
}
body.light-mode .modal-summary-row {
  border-bottom-color: rgba(0,0,0,0.05);
}
body.light-mode .modal-summary-row > span:first-child { color: #666; }
body.light-mode .modal-summary-value { color: #1a1a1a; }



/* ===== Dashboard Market Overview ===== */
.market-overview {
  background: var(--bg-card);
}
.market-overview .mo-item {
  text-align: center;
  transition: background 0.2s;
}
.market-overview .mo-item:hover {
  background: rgba(0, 230, 168, 0.04);
}
@media (max-width: 640px) {
  .market-overview > div:last-child {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .market-overview .mo-item {
    border-right: 1px solid var(--border-color) !important;
    border-bottom: 1px solid var(--border-color);
  }
  .market-overview .mo-item:nth-child(2n) {
    border-right: none !important;
  }
  .market-overview .mo-item:last-child {
    border-bottom: none;
  }
}

/* Light mode fixes for referral page */
body.light-mode .box { background: #fff; border: 1px solid rgba(0,0,0,0.08); color: #1a1a1a; }
body.light-mode .box h3 { color: #1a1a1a; }
body.light-mode .box p { color: #555; }
body.light-mode .referral-card .header h3 { color: #fff; }
body.light-mode .referral-card .header p { color: rgba(255,255,255,0.9); }
body.light-mode .referral-card .stat-box .stat-label { color: rgba(255,255,255,0.8); }
body.light-mode .referral-card .stat-box .stat-value { color: #fff; }
body.light-mode .referral-card .ref-code-row { background: rgba(255,255,255,0.15); }
body.light-mode .referral-card .ref-code-row .code { color: #fff; }
body.light-mode .referral-card .ref-code-row .copy-btn { color: #fff; }
body.light-mode .referral-card .form-group label { color: rgba(255,255,255,0.8); }
body.light-mode .wallet-bar .wallet-card { background: #fff; border: 1px solid rgba(0,0,0,0.08); }
body.light-mode .wallet-bar .wallet-card .value { color: #00a854; }
body.light-mode .wallet-bar .wallet-card .label { color: #555; }
body.light-mode .wallet-bar .wallet-card .bg-icon { color: rgba(0,0,0,0.08); }
body.light-mode .dash-content .page-header h1 { color: #1a1a1a; }
body.light-mode .dash-content .page-header p { color: #555; }
body.light-mode #referralsList div { color: #1a1a1a; }
body.light-mode .footer { color: #555; }
/* v2.1 — live notification bell badge */
.nav-bell {
  position: relative; background: transparent; border: 1px solid var(--border-color);
  border-radius: 8px; width: 34px; height: 34px; display: inline-flex;
  align-items: center; justify-content: center; color: var(--text-color); cursor: pointer;
}
.bell-badge {
  position: absolute; top: -6px; right: -6px; min-width: 17px; height: 17px;
  border-radius: 9px; background: #ff3333; color: #fff; font-size: 10px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; padding: 0 4px;
  border: 2px solid var(--bg-main, #0a0b10);
}
