/* ========================================
   CryptoBot - 全局样式
   ======================================== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── 深色主题（默认） ── */
:root {
  --bg:        #0f1117;
  --bg2:       #161b27;
  --bg3:       #1e2536;
  --border:    #2a3144;
  --primary:   #3b82f6;
  --primary-h: #2563eb;
  --success:   #ef4444;  /* A股：涨/盈利=红 */
  --danger:    #22c55e;  /* A股：跌/亏损=绿 */
  --warning:   #f59e0b;
  --purple:    #a855f7;
  --gold:      #eab308;
  --text:      #e2e8f0;
  --text-muted:#64748b;
  --radius:    10px;
  --shadow:    0 4px 24px rgba(0,0,0,.4);
  --card-bg:   #161b27;
  --input-bg:  #0f1117;
}

/* ── 亮色主题 ── */
[data-theme="light"] {
  --bg:        #f0f2f7;
  --bg2:       #ffffff;
  --bg3:       #e8ecf4;
  --border:    #d1d8e8;
  --primary:   #2563eb;
  --primary-h: #1d4ed8;
  --success:   #dc2626;  /* A股：涨/盈利=红 */
  --danger:    #16a34a;  /* A股：跌/亏损=绿 */
  --warning:   #d97706;
  --purple:    #9333ea;
  --gold:      #ca8a04;
  --text:      #1e293b;
  --text-muted:#64748b;
  --shadow:    0 4px 24px rgba(0,0,0,.10);
  --card-bg:   #ffffff;
  --input-bg:  #f8fafc;
}

body { background: var(--bg); color: var(--text); font-family: 'Inter', 'PingFang SC', sans-serif; font-size: 14px; line-height: 1.6; transition: background .2s, color .2s; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- LAYOUT ---- */
.layout { display: flex; min-height: calc(100vh - 56px); }
.main-content { flex: 1; padding: 28px 32px; overflow-y: auto; }

/* ---- NAVBAR ---- */
.navbar { height: 56px; background: var(--bg2); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; padding: 0 24px; position: sticky; top:0; z-index:100; }
.nav-brand a { font-size: 18px; font-weight: 700; color: var(--text); text-decoration: none; }
.nav-user { display: flex; align-items: center; gap: 12px; }
.nav-right { display: flex; align-items: center; gap: 12px; }

/* 主题切换按钮 */
.theme-toggle {
  width: 36px; height: 36px; border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg3);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 16px; transition: background .15s, border-color .15s, transform .15s;
  flex-shrink: 0;
}
.theme-toggle:hover { background: var(--border); transform: scale(1.1); }
/* 深色模式：显示月亮，隐藏太阳 */
.theme-icon-light { display: none; }
.theme-icon-dark  { display: block; }
/* 亮色模式：显示太阳，隐藏月亮 */
[data-theme="light"] .theme-icon-light { display: block; }
[data-theme="light"] .theme-icon-dark  { display: none; }
.avatar { border-radius: 50%; object-fit: cover; }
.avatar-text { width:32px; height:32px; border-radius:50%; background:var(--primary); display:flex; align-items:center; justify-content:center; font-weight:700; font-size:13px; }
.username { color: var(--text); font-weight: 500; }

/* ---- SIDEBAR ---- */
.sidebar { width: 200px; background: var(--bg2); border-right: 1px solid var(--border); padding: 16px 0; flex-shrink: 0; }
.sidebar-menu { list-style: none; }
.sidebar-menu li a { display: block; padding: 10px 20px; color: var(--text-muted); border-radius: 0; transition: all .2s; }
.sidebar-menu li a:hover { background: var(--bg3); color: var(--text); text-decoration: none; }
.sidebar-menu li.active a { background: var(--bg3); color: var(--primary); border-left: 3px solid var(--primary); }

/* ---- PAGE HEADER ---- */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.page-header h1 { font-size: 22px; font-weight: 700; }
.user-plan { display: flex; align-items: center; gap: 10px; }

/* ---- CARDS ---- */
.card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 20px; overflow: hidden; }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-header h3 { font-size: 15px; font-weight: 600; }
.card-body { padding: 20px; }
.card-locked { opacity: .7; }
.blur-overlay { filter: blur(3px); pointer-events: none; user-select: none; }

/* ---- STAT CARDS ---- */
.stat-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; display: flex; align-items: center; gap: 16px; }
.stat-icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.icon-blue   { background: rgba(59,130,246,.15); color: var(--primary); }
.icon-green  { background: rgba(34,197,94,.15);  color: var(--danger); }
.icon-orange { background: rgba(245,158,11,.15); color: var(--warning); }
.icon-red    { background: rgba(239,68,68,.15);  color: var(--success); }
.stat-value { font-size: 22px; font-weight: 700; }
.stat-label { color: var(--text-muted); font-size: 12px; margin-top: 2px; }

/* ---- DASHBOARD GRID ---- */
.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* ---- TABLE ---- */
.table { width: 100%; border-collapse: collapse; }
.table th { padding: 10px 12px; text-align: left; color: var(--text-muted); font-weight: 500; font-size: 12px; border-bottom: 1px solid var(--border); }
.table td { padding: 12px; border-bottom: 1px solid var(--border); }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--bg3); }

/* ---- BUTTONS ---- */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 8px; font-size: 14px; font-weight: 500; cursor: pointer; border: none; transition: all .2s; text-decoration: none; white-space: nowrap; }
.btn:hover { text-decoration: none; }
.btn-primary  { background: var(--primary);  color: #fff; } .btn-primary:hover  { background: var(--primary-h); }
.btn-success  { background: var(--success);  color: #fff; } .btn-success:hover  { background: #16a34a; }
.btn-danger   { background: var(--danger);   color: #fff; } .btn-danger:hover   { background: #dc2626; }
.btn-outline  { background: transparent; border: 1px solid var(--border); color: var(--text); } .btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-ghost    { background: transparent; color: var(--text-muted); } .btn-ghost:hover { color: var(--text); }
.btn-gold     { background: var(--gold); color: #000; font-weight: 700; } .btn-gold:hover { background: #ca8a04; }
.btn-block    { width: 100%; justify-content: center; }
.btn-sm  { padding: 5px 10px; font-size: 12px; }
.btn-lg  { padding: 12px 24px; font-size: 15px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---- BADGES ---- */
.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-gray   { background: rgba(100,116,139,.2); color: var(--text-muted); }
.badge-blue   { background: rgba(59,130,246,.2);  color: var(--primary); }
.badge-green  { background: rgba(34,197,94,.2);   color: var(--danger); }
.badge-red    { background: rgba(239,68,68,.2);   color: var(--success); }
.badge-orange { background: rgba(245,158,11,.2);  color: var(--warning); }
.badge-purple { background: rgba(168,85,247,.2);  color: var(--purple); }
.badge-gold   { background: rgba(234,179,8,.2);   color: var(--gold); }
.lock-badge   { background: rgba(245,158,11,.2); color: var(--warning); padding: 2px 6px; border-radius: 4px; font-size: 10px; margin-left: 4px; }

/* ---- FORMS ---- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.form-group input, .form-group select, .form-group textarea {
  background: var(--bg3); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; color: var(--text); font-size: 14px; outline: none; transition: border .2s; }
.form-group input:focus, .form-group select:focus { border-color: var(--primary); }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.radio-group { display: flex; flex-direction: column; gap: 8px; }
.radio-group label { display: flex; align-items: center; gap: 8px; cursor: pointer; color: var(--text); font-size: 14px; }
.inline-inputs { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--text-muted); }
.form-actions { display: flex; gap: 12px; padding: 20px 0; }

/* ---- TOGGLE SWITCH ---- */
.toggle { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle input { display: none; }
.slider { position: absolute; inset: 0; background: var(--border); border-radius: 24px; cursor: pointer; transition: .3s; }
.slider::before { content:''; position:absolute; width:18px; height:18px; left:3px; top:3px; background:#fff; border-radius:50%; transition:.3s; }
.toggle input:checked + .slider { background: var(--primary); }
.toggle input:checked + .slider::before { transform: translateX(20px); }

/* ---- TABS ---- */
.tab-group { display: flex; gap: 4px; margin-bottom: 20px; background: var(--bg3); padding: 4px; border-radius: 8px; width: fit-content; }
.tab-btn { padding: 8px 16px; border-radius: 6px; border: none; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 13px; font-weight: 500; transition: all .2s; }
.tab-btn.active { background: var(--primary); color: #fff; }
.tab-btn.locked { cursor: not-allowed; }
.strat-panel.hidden { display: none; }

/* ---- ALERTS ---- */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; }
.alert-error { background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.3); color: #fca5a5; }
.alert-info  { background: rgba(59,130,246,.1); border: 1px solid rgba(59,130,246,.3); color: #93c5fd; }

/* ---- EMPTY STATE ---- */
.empty-state { text-align: center; padding: 40px 0; color: var(--text-muted); }
.empty-state p { margin-bottom: 16px; }

/* ---- AUTH PAGE ---- */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--bg); }
.auth-card { width: 400px; background: var(--bg2); border: 1px solid var(--border); border-radius: 16px; padding: 40px; }
.auth-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; }
.logo-icon { font-size: 28px; }
.logo-text { font-size: 20px; font-weight: 700; }
.auth-card h2 { font-size: 22px; font-weight: 700; margin-bottom: 24px; }
.auth-switch { text-align: center; margin-top: 20px; color: var(--text-muted); font-size: 13px; }
.divider { text-align: center; margin: 20px 0; position: relative; color: var(--text-muted); font-size: 12px; }
.divider::before, .divider::after { content:''; position:absolute; top:50%; width:42%; height:1px; background:var(--border); }
.divider::before { left:0; } .divider::after { right:0; }
.oauth-buttons { display: flex; flex-direction: column; gap: 10px; }
.btn-oauth { justify-content: center; background: var(--bg3); border: 1px solid var(--border); color: var(--text); padding: 10px; border-radius: 8px; }
.btn-oauth:hover { border-color: var(--primary); text-decoration: none; }
.btn-google:hover { border-color: #4285f4; }
.btn-twitter:hover { border-color: #1da1f2; }

/* ---- MODAL ---- */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.7); display: flex; align-items: center; justify-content: center; z-index: 99999; }
.modal-overlay.hidden { display: none; }
.modal { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); width: 480px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow); }
.modal-header { padding: 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 20px; cursor: pointer; }
.modal-body { padding: 20px; }
.modal-footer { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ── 仪表盘行情图 ── */
.market-chart-card .card-header { flex-wrap: wrap; gap: 10px; }
.chart-symbols { display: flex; gap: 4px; flex-wrap: wrap; }
.chart-sym-btn {
  padding: 5px 12px; border-radius: 6px; border: 1px solid var(--border);
  background: transparent; color: var(--text-muted); font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all .2s;
}
.chart-sym-btn:hover { border-color: var(--primary); color: var(--primary); }
.chart-sym-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ── PRICING ── */
.period-switch { display: flex; gap: 4px; background: var(--bg2); padding: 4px; border-radius: 8px; width: fit-content; margin-bottom: 28px; }
.period-btn { padding: 9px 20px; border-radius: 6px; border: none; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 14px; font-weight: 500; transition: all .2s; }
.period-btn.active { background: var(--primary); color: #fff; }
.save-tag { background: rgba(34,197,94,.2); color: var(--success); padding: 2px 6px; border-radius: 4px; font-size: 11px; margin-left: 4px; }

.pricing-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }
.pricing-card { background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; padding: 28px 24px; position: relative; transition: border .2s; }
.pricing-card:hover { border-color: var(--primary); }
.pricing-card.featured { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.pricing-card.current { border-color: var(--success); }
.plan-badge-top { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--primary); color: #fff; padding: 3px 14px; border-radius: 20px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.plan-name { font-size: 16px; font-weight: 700; margin-bottom: 12px; }
.plan-price { margin-bottom: 20px; }
.price-num { font-size: 36px; font-weight: 800; }
.price-period { color: var(--text-muted); font-size: 14px; }
.plan-features { list-style: none; margin-bottom: 24px; }
.plan-features li { padding: 6px 0; font-size: 13px; border-bottom: 1px solid var(--border); }
.plan-features li:last-child { border-bottom: none; }

/* ---- PAYMENT ---- */
.pay-info { text-align: center; }
.pay-plan { margin-bottom: 12px; color: var(--text-muted); }
.pay-amount { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.pay-usdt { font-size: 40px; font-weight: 800; color: var(--success); margin-bottom: 4px; }
.pay-usdt span { font-size: 18px; }
.pay-network { font-size: 12px; color: var(--text-muted); margin-bottom: 20px; }
.pay-address-wrap { background: var(--bg3); border-radius: 8px; padding: 16px; margin-bottom: 16px; }
.pay-address-label { font-size: 11px; color: var(--text-muted); margin-bottom: 8px; }
.pay-address { font-family: monospace; font-size: 13px; word-break: break-all; margin-bottom: 10px; }
.pay-countdown { font-size: 13px; color: var(--warning); margin: 12px 0; }
.pay-tips { font-size: 12px; color: var(--text-muted); margin-top: 12px; }
.loading-spinner { text-align: center; padding: 40px; color: var(--text-muted); }

/* ---- MISC ---- */
.text-green { color: var(--danger); }   /* A股：绿=跌=亏损，实际显示绿色 */
.text-red   { color: var(--success); } /* A股：红=涨=盈利，实际显示红色 */
.text-muted { color: var(--text-muted); }
.text-link  { color: var(--primary); font-size: 13px; }
.coin-tag   { background: rgba(59,130,246,.1); color: var(--primary); padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 600; }
.exchange-tag  { padding: 3px 8px; border-radius: 4px; font-size: 12px; font-weight: 700; }
.exchange-okx  { background: rgba(59,130,246,.1); color: var(--primary); }
.exchange-binance { background: rgba(234,179,8,.1); color: var(--gold); }
.strategy-form { max-width: 900px; }

/* Tutorial */
.tutorial-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tut-panel.hidden { display: none; }
.tut-panel ol { padding-left: 20px; }
.tut-panel ol li { padding: 6px 0; color: var(--text); }

/* Filter section */
.filter-section { padding: 12px 0; border-bottom: 1px solid var(--border); }
.filter-section:last-child { border-bottom: none; }
.filter-title { display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; }
.filter-options { margin-top: 12px; padding-left: 24px; display: flex; flex-direction: column; gap: 8px; }
.filter-options label { display: flex; align-items: center; gap: 8px; cursor: pointer; }

/* ── 亮色主题补充覆盖 ── */
[data-theme="light"] body { background: var(--bg); }
[data-theme="light"] .sidebar { background: var(--bg2); border-color: var(--border); }
[data-theme="light"] .navbar  { background: var(--bg2); border-color: var(--border); }
[data-theme="light"] .card, [data-theme="light"] .section-card,
[data-theme="light"] .pricing-card { background: var(--bg2); border-color: var(--border); }
[data-theme="light"] .sidebar-menu li a { color: #475569; }
[data-theme="light"] .sidebar-menu li a:hover,
[data-theme="light"] .sidebar-menu li.active a { background: var(--bg3); }
/* 亮色下硬编码半透明背景修正 */
[data-theme="light"] .pc-head,
[data-theme="light"] .follow-bar,
[data-theme="light"] .pos-bar { background: rgba(0,0,0,.02); }
[data-theme="light"] .ma-tabs { background: rgba(0,0,0,.04); }
[data-theme="light"] .ma-tab:hover { background: rgba(0,0,0,.06); color: var(--text); }
[data-theme="light"] .mode-card.active { background: rgba(99,102,241,.06); }
[data-theme="light"] .btn-ghost { color: #475569; }
[data-theme="light"] .btn-ghost:hover { color: var(--text); }
[data-theme="light"] .ma-type-btn { background: rgba(0,0,0,.04); }
[data-theme="light"] .ma-type-btn[data-val="MA"]:hover  { background: rgba(37,99,235,.08); }
[data-theme="light"] .ma-type-btn[data-val="EMA"]:hover { background: rgba(217,119,6,.08); }
[data-theme="light"] input, [data-theme="light"] select,
[data-theme="light"] .ma-num, [data-theme="light"] .ma-num-sm { color: var(--text); }

/* Responsive */
@media (max-width: 1200px) {
  .pricing-grid { grid-template-columns: repeat(2,1fr); }
  .stat-grid { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 768px) {
  .sidebar { display: none; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .pricing-grid { grid-template-columns: 1fr; }
  .main-content { padding: 16px; }
  .modal { width: 95vw; }
}
