/* ============================================================
   SolGamble — Dark Casino Theme
   ============================================================ */

:root {
  --bg-0: #0a0b0d;
  --bg-1: #111318;
  --bg-2: #191c23;
  --bg-3: #1f2330;
  --border: #2a2f3e;
  --border-glow: #9945ff44;

  --text-0: #f0f2ff;
  --text-1: #a8b0cc;
  --text-2: #6b7491;

  --purple: #9945ff;
  --purple-l: #b06aff;
  --green: #14f195;
  --green-d: #0db978;
  --red: #ff4444;
  --red-d: #cc2222;
  --gold: #ffd700;
  --blue: #00c2ff;

  --chat-w: 280px;
  --nav-h: 60px;
  --radius: 12px;
  --radius-sm: 8px;
}

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

html, body {
  height: 100%;
  background: var(--bg-0);
  color: var(--text-0);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  overflow-x: hidden;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-1); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--purple); }

/* ── NAV ── */
#navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  z-index: 100;
  gap: 1rem;
}

.nav-left { display: flex; align-items: center; gap: 1.5rem; flex: 1; }
.nav-center { display: flex; align-items: center; justify-content: center; flex: 1; }
.nav-right { display: flex; align-items: center; gap: 0.75rem; flex: 1; justify-content: flex-end; }

.logo { display: flex; align-items: center; gap: 0.5rem; }
.logo-icon { font-size: 1.4rem; }
.logo-text {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 800;
  font-size: 1.2rem;
  background: linear-gradient(135deg, var(--purple), var(--blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-tabs { display: flex; gap: 0.25rem; }
.nav-tab {
  background: none;
  border: none;
  color: var(--text-1);
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.15s;
}
.nav-tab:hover { background: var(--bg-2); color: var(--text-0); }
.nav-tab.active { background: var(--bg-3); color: var(--text-0); }
.admin-tab { color: var(--gold) !important; }

/* ── WALLET BTN ── */
.wallet-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-0);
  padding: 0.45rem 1rem;
  border-radius: 20px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.15s;
}
.wallet-btn:hover { border-color: var(--purple); box-shadow: 0 0 12px var(--border-glow); }
.wallet-icon { color: var(--purple); font-size: 1.1rem; }

/* ── AUTH BUTTONS ── */
.auth-buttons { display: flex; gap: 0.5rem; }

.btn-primary, .btn-outline, .btn-ghost {
  padding: 0.45rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
}
.btn-primary {
  background: linear-gradient(135deg, var(--purple), #6622cc);
  color: white;
}
.btn-primary:hover { opacity: 0.85; transform: translateY(-1px); }
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-0);
}
.btn-outline:hover { border-color: var(--purple); }
.btn-ghost {
  background: none;
  color: var(--text-1);
  border: 1px solid transparent;
}
.btn-ghost:hover { color: var(--text-0); border-color: var(--border); }
button.full { width: 100%; }

/* ── USER MENU ── */
.user-menu { position: relative; }
.user-avatar-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-0);
  padding: 0.4rem 0.9rem;
  border-radius: 20px;
  cursor: pointer;
  font-weight: 600;
}
.user-avatar-btn:hover { border-color: var(--purple); }

.avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--purple), var(--blue));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.8rem;
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-width: 160px;
  overflow: hidden;
  z-index: 200;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.user-dropdown button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.65rem 1rem;
  background: none;
  border: none;
  color: var(--text-0);
  cursor: pointer;
  font-size: 0.9rem;
}
.user-dropdown button:hover { background: var(--bg-3); }
.user-dropdown button.danger { color: var(--red); }
.user-dropdown hr { border-color: var(--border); }

/* ── AD BANNER ── */
.ad-banner {
  margin-top: var(--nav-h);
  background: linear-gradient(135deg, #1a0a2e, #0d1a2e);
  border-bottom: 1px solid var(--border);
  padding: 0.6rem 2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  animation: adpulse 3s ease-in-out infinite;
}
@keyframes adpulse { 0%,100% { border-color: var(--border); } 50% { border-color: var(--purple); } }
.ad-banner-inner { display: flex; align-items: center; gap: 1rem; width: 100%; }
.ad-img { width: 40px; height: 40px; border-radius: var(--radius-sm); object-fit: cover; }
.ad-text { flex: 1; }
.ad-title { font-weight: 700; color: var(--text-0); }
.ad-desc { font-size: 0.85rem; color: var(--text-1); }
.ad-cta {
  background: var(--purple);
  color: white;
  padding: 0.4rem 1rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.85rem;
}
.ad-close { margin-left: auto; background: none; border: none; color: var(--text-2); cursor: pointer; font-size: 1.2rem; }

/* ── MAIN LAYOUT ── */
#main-layout {
  display: flex;
  margin-top: var(--nav-h);
  height: calc(100vh - var(--nav-h));
  overflow: hidden;
}

/* ── CHAT PANEL ── */
#chat-panel {
  width: var(--chat-w);
  min-width: var(--chat-w);
  background: var(--bg-1);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.chat-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
}

.chat-status-badge {
  font-size: 0.75rem;
  background: var(--bg-3);
  border: 1px solid var(--border);
  padding: 0.2rem 0.5rem;
  border-radius: 20px;
  color: var(--text-2);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.chat-msg {
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  background: var(--bg-2);
  word-break: break-word;
  font-size: 0.85rem;
  line-height: 1.5;
}
.chat-msg .msg-user {
  font-weight: 700;
  color: var(--purple-l);
  margin-right: 0.3rem;
}
.chat-msg.admin-msg .msg-user { color: var(--gold); }
.chat-msg.system-msg { background: transparent; color: var(--text-2); font-style: italic; font-size: 0.8rem; }
.chat-msg .msg-time { font-size: 0.7rem; color: var(--text-2); float: right; margin-left: 0.5rem; }

.chat-gate {
  padding: 1rem;
  text-align: center;
  color: var(--text-2);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
}

.chat-input-area {
  display: flex;
  gap: 0.4rem;
  padding: 0.6rem;
  border-top: 1px solid var(--border);
}
.chat-input-area input {
  flex: 1;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-0);
  padding: 0.45rem 0.7rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}
.chat-input-area input:focus { outline: none; border-color: var(--purple); }
.chat-input-area button {
  background: var(--purple);
  border: none;
  color: white;
  padding: 0.45rem 0.8rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
}

/* ── CONTENT AREA ── */
#content-area {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

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

/* ── MARKET ── */
.market-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}
.market-header h2 { font-size: 1.4rem; font-weight: 700; }
.market-filters { display: flex; gap: 0.75rem; align-items: center; }
.market-filters input, .market-filters select {
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-0);
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}
.market-filters input:focus, .market-filters select:focus { outline: none; border-color: var(--purple); }

.coin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.coin-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}
.coin-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--purple), var(--blue));
  opacity: 0;
  transition: opacity 0.2s;
}
.coin-card:hover { border-color: var(--purple); transform: translateY(-2px); box-shadow: 0 8px 32px rgba(153,69,255,0.15); }
.coin-card:hover::before { opacity: 1; }

.coin-card-top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.coin-logo {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--purple), var(--blue));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  font-weight: 700;
  overflow: hidden;
  flex-shrink: 0;
}
.coin-logo img { width: 100%; height: 100%; object-fit: cover; }

.coin-card-info { flex: 1; }
.coin-name { font-weight: 700; font-size: 1rem; }
.coin-symbol-badge {
  font-size: 0.75rem;
  background: var(--bg-3);
  color: var(--text-1);
  padding: 0.15rem 0.5rem;
  border-radius: 20px;
}

.coin-price-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 0.5rem;
}
.coin-price { font-size: 1.1rem; font-weight: 700; }
.change-badge {
  padding: 0.2rem 0.5rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}
.change-badge.up { background: rgba(20, 241, 149, 0.15); color: var(--green); }
.change-badge.down { background: rgba(255, 68, 68, 0.15); color: var(--red); }

.coin-meta-row {
  display: flex;
  justify-content: space-between;
  color: var(--text-2);
  font-size: 0.8rem;
}

.admin-only-badge {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: var(--gold);
  color: #000;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}
.rugged-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--red);
  border-radius: var(--radius);
}

/* ── COIN DETAIL ── */
.coin-detail-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.coin-detail-title { display: flex; align-items: center; gap: 1rem; flex: 1; }
.coin-logo-lg {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--purple), var(--blue));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem;
  overflow: hidden;
}
.coin-logo-lg img { width: 100%; height: 100%; object-fit: cover; }
.coin-detail-title h2 { font-size: 1.5rem; font-weight: 800; }
.pumpfun-link {
  font-size: 0.8rem;
  color: var(--green);
  text-decoration: none;
  border: 1px solid var(--green);
  padding: 0.15rem 0.5rem;
  border-radius: 20px;
  margin-left: 0.5rem;
}
.pumpfun-link:hover { background: rgba(20,241,149,0.1); }

.coin-price-header { margin-left: auto; text-align: right; }
.price-big { font-size: 1.8rem; font-weight: 800; }
.price-change { font-size: 1rem; font-weight: 600; }
.price-change.up { color: var(--green); }
.price-change.down { color: var(--red); }

.coin-detail-body { display: grid; grid-template-columns: 1fr 340px; gap: 1.5rem; align-items: start; }

.chart-section { background: var(--bg-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; }
.chart-controls { display: flex; gap: 0.4rem; margin-bottom: 0.75rem; }
.chart-interval {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-2);
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.15s;
}
.chart-interval:hover, .chart-interval.active { background: var(--purple); border-color: var(--purple); color: white; }

.price-chart { height: 360px; }

.trade-panel {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.trade-tabs { display: flex; background: var(--bg-2); border-radius: var(--radius-sm); padding: 3px; }
.trade-tab {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-1);
  padding: 0.45rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.15s;
}
.trade-tab.active[data-trade="buy"] { background: rgba(20,241,149,0.2); color: var(--green); }
.trade-tab.active[data-trade="sell"] { background: rgba(255,68,68,0.2); color: var(--red); }

.trade-form { display: flex; flex-direction: column; gap: 0.75rem; }
.trade-form label { color: var(--text-1); font-size: 0.85rem; }

.input-with-max { display: flex; gap: 0.4rem; }
.input-with-max input {
  flex: 1;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-0);
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 1rem;
}
.input-with-max input:focus { outline: none; border-color: var(--purple); }
.max-btn {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text-1);
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.8rem;
}
.max-btn:hover { border-color: var(--purple); color: var(--text-0); }

.trade-quick-btns { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.trade-quick-btns button {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text-1);
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.8rem;
  flex: 1;
}
.trade-quick-btns button:hover { border-color: var(--green); color: var(--green); }

.trade-info { display: flex; flex-direction: column; gap: 0.4rem; }
.trade-row { display: flex; justify-content: space-between; font-size: 0.875rem; }
.trade-row span:first-child { color: var(--text-2); }
.trade-row.fee span:last-child { color: var(--text-2); }
.trade-row.pnl span:last-child { font-weight: 700; }

.btn-buy, .btn-sell {
  padding: 0.7rem;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  transition: all 0.15s;
}
.btn-buy { background: linear-gradient(135deg, var(--green-d), var(--green)); color: #000; }
.btn-buy:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-sell { background: linear-gradient(135deg, var(--red-d), var(--red)); color: white; }
.btn-sell:hover { opacity: 0.9; transform: translateY(-1px); }

.coin-holding-info {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
}
.coin-holding-info h4 { margin-bottom: 0.5rem; font-size: 0.875rem; color: var(--text-1); }
#coin-holding-details { font-size: 0.85rem; color: var(--text-2); }
.holding-row { display: flex; justify-content: space-between; margin-bottom: 0.25rem; }
.holding-row span:last-child { font-weight: 600; color: var(--text-0); }

.coin-stats { display: flex; flex-direction: column; gap: 0.4rem; }
.stat-row { display: flex; justify-content: space-between; font-size: 0.875rem; }
.stat-row span:first-child { color: var(--text-2); }
.stat-row span:last-child { font-weight: 600; }

/* ── ADMIN COIN CONTROLS ── */
.admin-coin-controls {
  background: rgba(255, 215, 0, 0.05);
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
}
.admin-coin-controls h4 { color: var(--gold); margin-bottom: 0.75rem; font-size: 0.875rem; }
.price-control-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem; margin-bottom: 0.75rem; }
.price-control-btns button {
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  transition: all 0.15s;
}
.btn-moon { background: rgba(153,69,255,0.2); color: var(--purple-l); border-color: var(--purple) !important; }
.btn-up { background: rgba(20,241,149,0.1); color: var(--green); border-color: var(--green) !important; }
.btn-down { background: rgba(255,100,0,0.1); color: orange; border-color: orange !important; }
.btn-crash { background: rgba(255,68,68,0.1); color: var(--red); border-color: var(--red) !important; }
.price-control-btns button:hover { opacity: 0.8; transform: scale(1.03); }

.rugpull-section { display: flex; gap: 0.5rem; }
.rugpull-section input {
  flex: 1;
  background: var(--bg-2);
  border: 1px solid var(--red);
  color: var(--text-0);
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  text-align: center;
  letter-spacing: 0.3rem;
}
.btn-rug {
  background: var(--red);
  color: white;
  border: none;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 800;
  font-size: 0.85rem;
  transition: all 0.15s;
}
.btn-rug:hover { background: var(--red-d); transform: scale(1.05); }

/* ── PORTFOLIO ── */
.portfolio-header { margin-bottom: 1.5rem; }
.portfolio-summary {
  display: flex;
  gap: 1.5rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}
.portfolio-stat { text-align: center; }
.portfolio-stat .stat-val { font-size: 1.4rem; font-weight: 700; }
.portfolio-stat .stat-lbl { font-size: 0.8rem; color: var(--text-2); }

.holdings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }

.holding-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}
.holding-card:hover { border-color: var(--purple); }
.holding-top { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; }
.holding-logo { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, var(--purple), var(--blue)); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.holding-logo img { width: 100%; height: 100%; object-fit: cover; }
.holding-info h4 { font-weight: 700; }
.holding-info span { font-size: 0.8rem; color: var(--text-2); }
.holding-amounts { display: flex; justify-content: space-between; }
.holding-value { font-size: 1.1rem; font-weight: 700; }
.holding-pnl { font-size: 0.9rem; font-weight: 600; }
.holding-pnl.up { color: var(--green); }
.holding-pnl.down { color: var(--red); }

/* ── TRADES TABLE ── */
.trades-table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
th, td { padding: 0.7rem 0.8rem; text-align: left; border-bottom: 1px solid var(--border); }
th { color: var(--text-2); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; }
tr:hover td { background: var(--bg-2); }
.trade-type-badge {
  padding: 0.2rem 0.5rem;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.75rem;
}
.trade-type-badge.buy { background: rgba(20,241,149,0.15); color: var(--green); }
.trade-type-badge.sell { background: rgba(255,68,68,0.15); color: var(--red); }

/* ── LEADERBOARD ── */
.leaderboard-header { margin-bottom: 1.5rem; }
.leaderboard-header p { color: var(--text-2); margin-top: 0.5rem; }
.leaderboard-list { display: flex; flex-direction: column; gap: 0.5rem; }
.lb-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
}
.lb-rank { font-size: 1.2rem; font-weight: 800; min-width: 2.5rem; }
.lb-rank-1 { color: var(--gold); }
.lb-rank-2 { color: #c0c0c0; }
.lb-rank-3 { color: #cd7f32; }
.lb-user { flex: 1; font-weight: 600; }
.lb-pnl { font-weight: 700; }
.lb-pnl.pos { color: var(--green); }
.lb-pnl.neg { color: var(--red); }
.lb-vol { color: var(--text-2); font-size: 0.85rem; }

/* ── ADMIN PANEL ── */
.admin-header { margin-bottom: 1.5rem; }
.admin-header h2 { font-size: 1.4rem; font-weight: 700; margin-bottom: 0.75rem; }
.admin-sub-tabs { display: flex; gap: 0.25rem; flex-wrap: wrap; }
.admin-sub-tab {
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-1);
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
}
.admin-sub-tab.active { background: var(--purple); border-color: var(--purple); color: white; }

.admin-section { display: none; }
.admin-section.active { display: block; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem;
}
.stat-card-label { font-size: 0.8rem; color: var(--text-2); margin-bottom: 0.4rem; text-transform: uppercase; }
.stat-card-value { font-size: 1.4rem; font-weight: 800; }
.stat-card-value.positive { color: var(--green); }
.stat-card-value.gold { color: var(--gold); }

.coin-performance-table table { width: 100%; }

.admin-toolbar { display: flex; gap: 0.75rem; margin-bottom: 1rem; }
.admin-toolbar input {
  flex: 1;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-0);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
}

.users-table table, .withdrawals-table table, .tickets-table table { width: 100%; }

.action-btn {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text-0);
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.8rem;
  margin-right: 0.3rem;
}
.action-btn:hover { border-color: var(--purple); }
.action-btn.danger { color: var(--red); border-color: rgba(255,68,68,0.3); }
.action-btn.danger:hover { background: rgba(255,68,68,0.1); border-color: var(--red); }
.action-btn.success { color: var(--green); border-color: rgba(20,241,149,0.3); }
.action-btn.success:hover { background: rgba(20,241,149,0.1); border-color: var(--green); }

.admin-coin-list, .admin-ad-list { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 1rem; }
.admin-coin-item, .admin-ad-item {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.admin-coin-item .coin-info { flex: 1; }
.admin-coin-item h4 { font-weight: 700; }
.admin-coin-item p { font-size: 0.8rem; color: var(--text-2); }

/* ── PRICE CONTROL INLINE (admin coin list) ── */
.inline-price-ctrl { display: flex; gap: 0.3rem; align-items: center; }
.inline-price-ctrl input[type=range] { width: 80px; accent-color: var(--purple); }

/* ── MODALS ── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(4px);
}

.modal-box {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  width: 100%;
  max-width: 520px;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-box-lg { max-width: 800px; }
.modal-box-sm { max-width: 360px; }

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-1);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-close:hover { color: var(--text-0); border-color: var(--purple); }

.modal-tabs { display: flex; gap: 0; margin-bottom: 1.5rem; border-bottom: 1px solid var(--border); }
.modal-tab {
  background: none;
  border: none;
  color: var(--text-2);
  padding: 0.6rem 1.2rem;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}
.modal-tab.active { color: var(--text-0); border-bottom-color: var(--purple); }
.modal-tab:hover { color: var(--text-0); }

.auth-form h3 { font-size: 1.3rem; font-weight: 700; margin-bottom: 1.25rem; }

/* ── FORM FIELDS ── */
.field-group { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 1rem; }
.field-group label { font-size: 0.875rem; color: var(--text-1); font-weight: 500; }
.field-group .hint { color: var(--text-2); font-weight: 400; }
.field-group input, .field-group textarea, .field-group select {
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-0);
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  width: 100%;
}
.field-group input:focus, .field-group textarea:focus, .field-group select:focus {
  outline: none;
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(153,69,255,0.15);
}
.field-group textarea { resize: vertical; min-height: 80px; }
.field-group.checkbox { flex-direction: row; align-items: center; gap: 0.5rem; }
.field-group.checkbox input { width: auto; }

.form-error { color: var(--red); font-size: 0.875rem; padding: 0.5rem; background: rgba(255,68,68,0.1); border-radius: var(--radius-sm); border-left: 2px solid var(--red); }
.form-status { font-size: 0.875rem; padding: 0.5rem; border-radius: var(--radius-sm); }
.form-status.success { color: var(--green); background: rgba(20,241,149,0.1); border-left: 2px solid var(--green); }
.form-status.error { color: var(--red); background: rgba(255,68,68,0.1); border-left: 2px solid var(--red); }

/* ── WALLET MODAL ── */
.wallet-balance-big {
  font-size: 2rem;
  font-weight: 800;
  text-align: center;
  margin: 1rem 0 1.5rem;
  color: var(--text-0);
}
.wallet-balance-big span:last-child { font-size: 1rem; color: var(--text-2); margin-left: 0.5rem; }

.wallet-sections { display: flex; flex-direction: column; gap: 1.5rem; }
.wallet-section { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1rem; }
.wallet-section h4 { font-weight: 700; margin-bottom: 0.5rem; }
.wallet-info { font-size: 0.85rem; color: var(--text-2); margin-bottom: 0.75rem; line-height: 1.5; }

.deposit-address-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
}
.deposit-address-box code { font-size: 0.8rem; color: var(--text-1); word-break: break-all; flex: 1; }
.copy-btn {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text-0);
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.8rem;
  white-space: nowrap;
}
.copy-btn:hover { border-color: var(--purple); }

/* ── PROFILE MODAL ── */
.profile-header { display: flex; gap: 1.5rem; align-items: center; margin-bottom: 1.5rem; }
.profile-avatar { width: 64px; height: 64px; border-radius: 50%; background: linear-gradient(135deg, var(--purple), var(--blue)); display: flex; align-items: center; justify-content: center; font-size: 1.8rem; font-weight: 700; }
.profile-info h2 { font-size: 1.3rem; font-weight: 700; }
.profile-info .role-badge { font-size: 0.75rem; padding: 0.2rem 0.6rem; border-radius: 20px; font-weight: 600; }
.role-badge.user { background: rgba(0,194,255,0.15); color: var(--blue); }
.role-badge.admin { background: rgba(255,215,0,0.15); color: var(--gold); }
.role-badge.superadmin { background: rgba(153,69,255,0.2); color: var(--purple-l); }

.profile-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.profile-stat { background: var(--bg-2); border-radius: var(--radius-sm); padding: 0.75rem; text-align: center; }
.profile-stat .val { font-size: 1.1rem; font-weight: 700; }
.profile-stat .lbl { font-size: 0.75rem; color: var(--text-2); }

/* ── SUPPORT MODAL ── */
.support-layout { display: grid; grid-template-columns: 220px 1fr; gap: 1rem; height: 500px; }
.ticket-list-panel { background: var(--bg-2); border-radius: var(--radius-sm); padding: 0.75rem; overflow-y: auto; }
.ticket-list-panel h4 { font-size: 0.875rem; color: var(--text-2); margin-bottom: 0.75rem; }
.ticket-item {
  padding: 0.6rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-bottom: 0.4rem;
  border: 1px solid transparent;
  background: var(--bg-1);
}
.ticket-item:hover, .ticket-item.active { border-color: var(--purple); }
.ticket-item h5 { font-size: 0.85rem; font-weight: 600; }
.ticket-item .ticket-status { font-size: 0.75rem; margin-top: 0.2rem; }
.ticket-status.open { color: var(--green); }
.ticket-status.resolved { color: var(--text-2); }
.ticket-status.rejected { color: var(--red); }
.ticket-status.in_progress { color: var(--gold); }

.support-chat-area { display: flex; flex-direction: column; background: var(--bg-2); border-radius: var(--radius-sm); overflow: hidden; }
.support-chat-area .chat-messages { padding: 0.75rem; }
.support-chat-area .chat-input-area { padding: 0.5rem; border-top: 1px solid var(--border); }

/* ── TOAST ── */
#toast-container { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 9999; display: flex; flex-direction: column; gap: 0.5rem; }
.toast {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  min-width: 250px;
  max-width: 360px;
  font-size: 0.9rem;
  animation: toastIn 0.2s ease;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
.toast.success { border-left: 3px solid var(--green); }
.toast.error { border-left: 3px solid var(--red); }
.toast.info { border-left: 3px solid var(--purple); }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* ── LOADING SPINNER ── */
.loading-spinner {
  color: var(--text-2);
  padding: 2rem;
  text-align: center;
  font-size: 0.9rem;
}

/* ── UTILITY ── */
.hidden { display: none !important; }
.text-green { color: var(--green) !important; }
.text-red { color: var(--red) !important; }
.text-gold { color: var(--gold) !important; }

/* ── SITE SETTINGS ── */
.site-settings-wrap { max-width: 480px; }
.site-settings-wrap h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.3rem; }
.settings-hint { font-size: 0.85rem; color: var(--text-2); margin-bottom: 1.25rem; }

.settings-preview {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}
.preview-logo {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--purple), var(--blue));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  overflow: hidden;
  flex-shrink: 0;
}
.preview-logo img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.preview-name {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 800;
  font-size: 1.3rem;
  background: linear-gradient(135deg, var(--purple), var(--blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  #chat-panel { display: none; }
  .coin-detail-body { grid-template-columns: 1fr; }
  .coin-detail-body .trade-panel { order: -1; }
  .support-layout { grid-template-columns: 1fr; grid-template-rows: 200px 1fr; }
}
@media (max-width: 600px) {
  #navbar { padding: 0 0.75rem; }
  #content-area { padding: 1rem; }
  .coin-grid { grid-template-columns: 1fr; }
  .portfolio-stats { flex-direction: column; }
}
