/* =============================================
   AITrading — Dark SaaS Theme
   ============================================= */

:root {
  --bg-main:       #0D0D0D;
  --bg-card:       #111827;
  --bg-card-2:     #1A1A2E;
  --bg-sidebar:    #0F1117;
  --accent:        #3B82F6;
  --accent-2:      #6366F1;
  --accent-hover:  #2563EB;
  --success:       #10B981;
  --warning:       #F59E0B;
  --danger:        #EF4444;
  --text-main:     #F1F5F9;
  --text-sub:      #94A3B8;
  --border:        #1E293B;
  --border-2:      #334155;
  --radius:        12px;
  --radius-sm:     8px;
  --shadow-glow:   0 0 40px rgba(59,130,246,0.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
  overflow-x: hidden;
}

/* ---- UTILITY ---- */
.text-accent   { color: var(--accent) !important; }
.text-success  { color: var(--success) !important; }
.text-warning  { color: var(--warning) !important; }
.text-danger   { color: var(--danger) !important; }
.text-sub      { color: var(--text-sub) !important; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }
.font-mono { font-family: 'Courier New', monospace; }
.gradient-text {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ---- NAVBAR ---- */
#mainNav {
  background: rgba(13,13,13,0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 0;
  transition: all 0.3s ease;
}
#mainNav.scrolled {
  background: rgba(13,13,13,0.97);
  padding: 0.6rem 0;
}
.navbar-brand {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main) !important;
  letter-spacing: -0.03em;
}
.navbar-logo {
  height: 36px;
  width: auto;
  object-fit: contain;
  background: #ffffff;
  border-radius: 6px;
  padding: 4px 8px;
}
.nav-link {
  color: var(--text-sub) !important;
  font-weight: 500;
  font-size: 0.92rem;
  padding: 0.4rem 0.9rem !important;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}
.nav-link:hover { color: var(--text-main) !important; background: rgba(255,255,255,0.05); }
.nav-link.active { color: var(--accent) !important; background: rgba(59,130,246,0.1); }

/* Navbar dropdown override — bỏ nền xanh đậm Bootstrap */
#mainNav .dropdown-menu { background: #111827; border: 1px solid #1E293B; border-radius: 10px; padding: 6px; }
#mainNav .dropdown-item { color: #94A3B8 !important; font-size: .88rem; border-radius: 6px; padding: 8px 14px; transition: all .15s; background-color: transparent !important; }
#mainNav .dropdown-item:hover { color: #F1F5F9 !important; background-color: rgba(255,255,255,.06) !important; }
#mainNav .dropdown-item.active { color: #3B82F6 !important; background-color: rgba(59,130,246,.12) !important; font-weight: 600; }
[data-theme="light"] #mainNav .dropdown-menu { background: #fff; border-color: #E2E8F0; }
[data-theme="light"] #mainNav .dropdown-item { color: #475569 !important; }
[data-theme="light"] #mainNav .dropdown-item:hover { color: #0F172A !important; background-color: #F1F5F9 !important; }
[data-theme="light"] #mainNav .dropdown-item.active { color: #3B82F6 !important; background-color: rgba(59,130,246,.1) !important; }
.nav-coins {
  font-size: 0.875rem;
  color: var(--text-sub);
  background: rgba(255,255,255,0.05);
  padding: 0.4rem 0.85rem;
  border-radius: 20px;
  border: 1px solid var(--border);
}

/* ---- BUTTONS ---- */
.btn-primary-gradient {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: all 0.25s ease;
  box-shadow: 0 4px 20px rgba(59,130,246,0.3);
}
.btn-primary-gradient:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(59,130,246,0.45);
  color: #fff;
}
.btn-outline-accent {
  border: 1px solid var(--accent);
  color: var(--accent);
  background: transparent;
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: all 0.2s ease;
}
.btn-outline-accent:hover { background: var(--accent); color: #fff; }
.btn-outline-light-custom {
  border: 1px solid rgba(255,255,255,0.2);
  color: var(--text-main);
  background: rgba(255,255,255,0.05);
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: all 0.2s ease;
}
.btn-outline-light-custom:hover { background: rgba(255,255,255,0.1); color: #fff; }
.btn-ghost-sm {
  background: transparent;
  color: var(--text-sub);
  border: 1px solid transparent;
  font-weight: 500;
  font-size: 0.9rem;
  padding: 0.4rem 0.75rem;
  transition: color 0.2s;
}
.btn-ghost-sm:hover { color: var(--text-main); border-color: var(--accent); }
.btn-white-gradient {
  background: #fff;
  color: #1a1a2e;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-sm);
  transition: all 0.25s ease;
}
.btn-white-gradient:hover { transform: translateY(-2px); box-shadow: 0 8px 30px rgba(255,255,255,0.2); }
.btn-outline-white {
  border: 1px solid rgba(255,255,255,0.4);
  color: #fff;
  background: transparent;
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: all 0.2s ease;
}
.btn-outline-white:hover { background: rgba(255,255,255,0.1); color: #fff; }

/* ---- MESSAGES / TOAST ---- */
.messages-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 380px;
}
.alert-toast {
  display: flex;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: #1A1A2E;
  border: 1px solid var(--border-2);
  border-left: 4px solid var(--border-2);
  font-size: 0.875rem;
  line-height: 1.5;
  box-shadow: 0 8px 24px rgba(0,0,0,0.6);
  animation: toastSlideIn 0.3s ease;
  gap: 10px;
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.alert-toast.hiding {
  opacity: 0;
  transform: translateX(20px);
}
.alert-toast i { margin-top: 2px; flex-shrink: 0; font-size: 1rem; }
@keyframes toastSlideIn {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}
.alert-toast-success {
  background: #0d2b1e;
  border-color: rgba(16,185,129,0.35);
  border-left-color: var(--success);
}
.alert-toast-success i { color: var(--success); }

.alert-toast-error,
.alert-toast-danger {
  background: #2b0d0d;
  border-color: rgba(239,68,68,0.35);
  border-left-color: var(--danger);
}
.alert-toast-error i, .alert-toast-danger i { color: var(--danger); }

.alert-toast-warning {
  background: #2b1f0d;
  border-color: rgba(245,158,11,0.35);
  border-left-color: var(--warning);
}
.alert-toast-warning i { color: var(--warning); }

.alert-toast-info {
  background: #0d1a2b;
  border-color: rgba(59,130,246,0.35);
  border-left-color: var(--accent);
}
.alert-toast-info i { color: var(--accent); }
.toast-close {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-sub);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}

/* ---- HERO SECTION ---- */
.hero-section {
  padding: 160px 0 80px;
  position: relative;
  overflow: hidden;
}
.hero-bg-blur {
  position: absolute;
  top: -200px;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 800px;
  background: radial-gradient(circle, rgba(59,130,246,0.15) 0%, transparent 70%);
  pointer-events: none;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(59,130,246,0.1);
  border: 1px solid rgba(59,130,246,0.3);
  color: var(--accent);
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
}
.hero-title {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 1.5rem;
}
.hero-subtitle {
  font-size: 1.15rem;
  color: var(--text-sub);
  max-width: 580px;
  margin: 0 auto 2.5rem;
}
.hero-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}
.hero-dashboard {
  margin-top: 4rem;
}
.dashboard-mockup {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-glow);
  max-width: 700px;
  margin: 0 auto;
}
.mockup-header {
  background: var(--bg-card-2);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border);
}
.dot { width: 12px; height: 12px; border-radius: 50%; }
.dot.red { background: #EF4444; }
.dot.yellow { background: #F59E0B; }
.dot.green { background: #10B981; }
.mockup-url { margin-left: 12px; color: var(--text-sub); font-size: 0.8rem; font-family: monospace; }
.mockup-body { padding: 24px; }
.mockup-stat { background: var(--bg-card-2); border-radius: var(--radius-sm); padding: 12px 16px; }
.mockup-stat-label { font-size: 0.75rem; color: var(--text-sub); }
.mockup-stat-val { font-size: 1.25rem; font-weight: 700; }
.mockup-chart { border-radius: var(--radius-sm); overflow: hidden; background: var(--bg-card-2); padding: 8px; }

/* ---- STATS BAR ---- */
.stats-bar {
  padding: 3rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.01);
}
.stat-item .stat-number {
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.stat-item .stat-label { font-size: 0.85rem; color: var(--text-sub); margin-top: 4px; }

/* ---- SECTIONS ---- */
.section-badge {
  display: inline-block;
  background: rgba(59,130,246,0.1);
  border: 1px solid rgba(59,130,246,0.25);
  color: var(--accent);
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.section-header { margin-bottom: 1rem; }
.section-title {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-top: 0.75rem;
}
.section-subtitle { color: var(--text-sub); max-width: 560px; margin: 0.75rem auto 0; font-size: 1.05rem; }

/* ---- FEATURES SECTION ---- */
.features-section { padding: 6rem 0; }
.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  height: 100%;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}
.feature-card:hover {
  border-color: var(--accent);
  transform: translateY(-6px);
  box-shadow: 0 20px 60px rgba(59,130,246,0.15);
}
.feature-card-highlight {
  background: linear-gradient(145deg, #111827, #1a1a2e);
  border-color: rgba(99,102,241,0.4);
}
.feature-badge-top {
  position: absolute;
  top: 16px;
  right: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  text-transform: uppercase;
}
.feature-icon {
  width: 52px;
  height: 52px;
  background: rgba(59,130,246,0.1);
  border: 1px solid rgba(59,130,246,0.2);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--accent);
  margin-bottom: 1.25rem;
}
.feature-title { font-size: 1.15rem; font-weight: 700; margin-bottom: 0.75rem; }
.feature-desc { color: var(--text-sub); font-size: 0.92rem; margin-bottom: 1.25rem; }
.feature-list { list-style: none; padding: 0; }
.feature-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--text-sub);
  padding: 4px 0;
}
.feature-list li i { font-size: 1rem; }

/* ---- HOW SECTION ---- */
.how-section { padding: 6rem 0; background: rgba(255,255,255,0.01); }
.step-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  position: relative;
  transition: all 0.3s ease;
}
.step-card:hover { border-color: var(--accent); transform: translateY(-4px); }
.step-number {
  font-size: 4rem;
  font-weight: 800;
  color: rgba(59,130,246,0.15);
  line-height: 1;
  margin-bottom: 0.5rem;
}
.step-icon {
  font-size: 2rem;
  color: var(--accent);
  margin-bottom: 1rem;
}
.step-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.5rem; }
.step-desc { color: var(--text-sub); font-size: 0.9rem; }

/* ---- CTA SECTION ---- */
.cta-section { padding: 5rem 0; }
.cta-card {
  background: linear-gradient(135deg, #1e3a8a 0%, #3730a3 50%, #1e1b4b 100%);
  border-radius: 20px;
  padding: 3.5rem;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(99,102,241,0.3);
}
.cta-bg-blur {
  position: absolute;
  top: -100px;
  right: -100px;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(59,130,246,0.3), transparent 70%);
  pointer-events: none;
}
.cta-title { font-size: 2rem; font-weight: 800; color: #fff; margin-bottom: 0.75rem; }
.cta-subtitle { color: rgba(255,255,255,0.75); font-size: 1.05rem; }

/* ---- AUTH PAGES ---- */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 100px 0 40px;
  position: relative;
}
.auth-bg-blur {
  position: absolute;
  top: 0; left: 50%; transform: translateX(-50%);
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(59,130,246,0.1) 0%, transparent 70%);
  pointer-events: none;
}
.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2.5rem;
  box-shadow: var(--shadow-glow);
}
.auth-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 1.5rem;
}
.auth-logo i { font-size: 1.5rem; }
.auth-title { font-size: 1.6rem; font-weight: 800; margin-bottom: 0.4rem; }
.auth-subtitle { color: var(--text-sub); font-size: 0.9rem; margin-bottom: 1.75rem; }
.auth-divider {
  text-align: center;
  margin: 1.5rem 0;
  position: relative;
  color: var(--text-sub);
  font-size: 0.85rem;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 40%;
  height: 1px;
  background: var(--border);
}
.auth-divider::before { left: 0; }
.auth-divider::after { right: 0; }
.auth-switch { text-align: center; color: var(--text-sub); font-size: 0.9rem; }

/* ---- FORMS ---- */
.form-label-dark { font-size: 0.85rem; font-weight: 600; color: var(--text-main); margin-bottom: 6px; display: block; }
.input-icon-wrap { position: relative; }
.input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-sub);
  font-size: 0.95rem;
  z-index: 1;
}
.form-control {
  background: var(--bg-card-2) !important;
  border: 1px solid var(--border-2) !important;
  color: var(--text-main) !important;
  border-radius: var(--radius-sm) !important;
  padding: 0.65rem 1rem 0.65rem 2.6rem !important;
  font-size: 0.9rem !important;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-control:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15) !important;
  outline: none;
}
.form-control::placeholder { color: var(--border-2) !important; }
select.form-control { padding-right: 2rem !important; cursor: pointer; }
select.form-control option { background: var(--bg-card); color: var(--text-main); }
.form-error { color: var(--danger); font-size: 0.8rem; margin-top: 4px; }
.pw-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-sub);
  cursor: pointer;
  padding: 0;
  font-size: 1rem;
  line-height: 1;
  z-index: 2;
  transition: color 0.2s;
}
.pw-toggle:hover { color: var(--accent); }
.form-control.pw-with-toggle { padding-right: 2.8rem !important; }

/* OTP Input */
.otp-input {
  font-size: 2rem !important;
  font-weight: 700 !important;
  text-align: center !important;
  letter-spacing: 0.5rem !important;
  padding: 1rem !important;
}
.otp-icon-wrap {
  font-size: 3rem;
  color: var(--accent);
  background: rgba(59,130,246,0.1);
  width: 80px; height: 80px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1.5rem;
}

/* OTP Countdown */
.otp-countdown-wrap {
  font-size: 0.875rem;
  color: var(--text-sub);
}
.otp-countdown {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--accent);
  margin-left: 4px;
  transition: color 0.3s;
}
.otp-countdown.otp-countdown-warn { color: var(--warning); }
.otp-countdown.otp-countdown-expired { color: var(--danger); }

/* ---- DASHBOARD LAYOUT ---- */
.dashboard-layout {
  display: flex;
  min-height: 100vh;
  padding-top: 65px;
}
.sidebar {
  width: 240px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1rem;
  position: fixed;
  top: 65px;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width 0.25s ease, padding 0.25s ease;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}
.sidebar-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.sidebar-avatar-placeholder {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(59,130,246,0.15);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent);
  font-size: 1.2rem;
  flex-shrink: 0;
}
.sidebar-username { font-size: 0.875rem; font-weight: 600; color: var(--text-main); }
.sidebar-email { font-size: 0.72rem; color: var(--text-sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 145px; }
.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius-sm);
  color: var(--text-sub);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
}
.sidebar-link:hover { background: rgba(255,255,255,0.05); color: var(--text-main); }
.sidebar-link.active { background: rgba(59,130,246,0.12); color: var(--accent); border-left: 3px solid var(--accent); }
.sidebar-link i { font-size: 1.05rem; }
.sidebar-logout {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius-sm);
  color: var(--danger);
  background: rgba(239,68,68,0.08);
  border: 1px solid transparent;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
  margin-top: 0.5rem;
}
.sidebar-logout:hover {
  background: #EF4444 !important;
  border: 1px solid #EF4444 !important;
  color: #fff !important;
  box-shadow: 0 4px 12px rgba(239,68,68,0.4);
  transition: none;
}
/* Sidebar toggle button */
.sidebar-toggle {
  position: absolute;
  top: 50%;
  right: 0.75rem;
  transform: translateY(-50%);
  width: 28px; height: 28px;
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-sub);
  font-size: 0.75rem;
  z-index: 10;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.sidebar-toggle:hover { color: var(--accent); border-color: var(--accent); }
.sidebar.collapsed .sidebar-toggle { right: 50%; transform: translate(50%, -50%); }
/* Collapsed state */
.sidebar.collapsed { width: 64px; padding: 1.5rem 0.5rem; }
.sidebar.collapsed .sidebar-toggle .bi { transform: rotate(180deg); }
.sidebar.collapsed .sidebar-username,
.sidebar.collapsed .sidebar-email { display: none; }
.sidebar.collapsed .sidebar-user { justify-content: center; }
.sidebar.collapsed .sidebar-link span,
.sidebar.collapsed .sidebar-logout span { display: none; }
.sidebar.collapsed .sidebar-link { justify-content: center; gap: 0; padding: 0.7rem; }
.sidebar.collapsed .sidebar-link.active { border-left: none; }
.sidebar.collapsed .sidebar-logout { justify-content: center; gap: 0; padding: 0.7rem; }
.sidebar.collapsed + .dashboard-main { margin-left: 64px; max-width: calc(100vw - 64px); }
.dashboard-main {
  flex: 1;
  margin-left: 240px;
  padding: 2rem 2.5rem;
  max-width: calc(100vw - 240px);
  transition: margin-left 0.25s ease, max-width 0.25s ease;
}
.dashboard-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 2rem;
  gap: 1rem;
}
.dashboard-title { font-size: 1.75rem; font-weight: 800; letter-spacing: -0.02em; }
.dashboard-sub { color: var(--text-sub); font-size: 0.9rem; }
.coins-display {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
}

/* ---- STAT CARDS ---- */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: all 0.3s ease;
}
.stat-card:hover { border-color: var(--accent); transform: translateY(-4px); box-shadow: 0 12px 40px rgba(59,130,246,0.12); }
.stat-card-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
  color: #fff;
  margin-bottom: 1rem;
}
.bg-blue { background: linear-gradient(135deg, #3B82F6, #6366F1); }
.bg-green { background: linear-gradient(135deg, #10B981, #059669); }
.bg-purple { background: linear-gradient(135deg, #8B5CF6, #6366F1); }
.bg-orange { background: linear-gradient(135deg, #F59E0B, #D97706); }
.stat-card-val { font-size: 1.6rem; font-weight: 800; margin-bottom: 0.25rem; line-height: 1.2; }
.stat-card-label { font-size: 0.8rem; color: var(--text-sub); font-weight: 500; }

/* ---- DASHBOARD CARD ---- */
.dashboard-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
}
.card-title-dark { font-size: 1.05rem; font-weight: 700; color: var(--text-main); }

/* ---- TABLE ---- */
.table-dark-custom {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.table-dark-custom thead tr {
  border-bottom: 2px solid var(--border);
}
.table-dark-custom th {
  padding: 0.75rem 1rem;
  color: var(--text-sub);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: left;
}
.table-dark-custom td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table-dark-custom tbody tr:hover { background: rgba(255,255,255,0.02); }
.table-dark-custom tbody tr:last-child td { border-bottom: none; }

/* ---- STATUS BADGES ---- */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.status-completed { background: rgba(16,185,129,0.12); color: var(--success); border: 1px solid rgba(16,185,129,0.25); }
.status-pending   { background: rgba(245,158,11,0.12); color: var(--warning); border: 1px solid rgba(245,158,11,0.25); }
.status-failed    { background: rgba(239,68,68,0.12);  color: var(--danger);  border: 1px solid rgba(239,68,68,0.25); }
.badge-verified   { color: var(--success); font-size: 0.85rem; font-weight: 600; }
.badge-unverified { color: var(--warning); font-size: 0.85rem; font-weight: 600; text-decoration: none; }

/* ---- COPY BUTTONS ---- */
.btn-copy {
  background: none; border: none; cursor: pointer;
  color: var(--text-sub); font-size: 0.8rem;
  padding: 2px 6px; border-radius: 4px;
  transition: color 0.2s;
}
.btn-copy:hover { color: var(--accent); }
.btn-copy-inline {
  background: rgba(59,130,246,0.1);
  border: 1px solid rgba(59,130,246,0.2);
  color: var(--accent);
  font-size: 0.8rem; font-weight: 600;
  padding: 4px 12px; border-radius: 6px;
  cursor: pointer; transition: all 0.2s;
  white-space: nowrap;
}
.btn-copy-inline:hover { background: var(--accent); color: #fff; }

/* ---- DEPOSIT PAGE ---- */
.wallet-field { }
.wallet-field-label { font-size: 0.8rem; font-weight: 600; color: var(--text-sub); margin-bottom: 8px; display: block; text-transform: uppercase; letter-spacing: 0.04em; }
.qr-wallet-img { border-radius: 12px; border: 4px solid #ffffff; box-shadow: 0 4px 20px rgba(0,0,0,0.4); display: block; margin: 0 auto; }
.wallet-address-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--bg-card-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 0.82rem;
  word-break: break-all;
}
.accent-border { border-color: rgba(59,130,246,0.4) !important; }
.help-text { font-size: 0.78rem; color: var(--text-sub); }
.network-badge {
  display: inline-flex;
  align-items: center;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
}
.rate-info {
  background: rgba(16,185,129,0.05);
  border: 1px solid rgba(16,185,129,0.2);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: 0.875rem;
  color: var(--success);
}
.steps-mini { display: flex; flex-direction: column; gap: 8px; }
.step-mini {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.875rem;
  color: var(--text-sub);
}
.step-mini-num {
  width: 24px; height: 24px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}
.step-mini--warn { color: var(--text-main); }
.step-mini-num--warn {
  background: linear-gradient(135deg, #F59E0B, #D97706);
}
.info-box {
  display: flex;
  gap: 12px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  font-size: 0.85rem;
}
.info-box-warning {
  background: rgba(245,158,11,0.08);
  border-color: rgba(245,158,11,0.35);
}

/* Deposit method selection cards */
.method-card {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease;
  height: 100%;
  user-select: none;
}
.method-card:hover,
.method-card:focus {
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: 0 8px 30px rgba(59,130,246,0.2);
  outline: none;
}
.method-card--mm:hover,
.method-card--mm:focus {
  border-color: #F6851B;
  box-shadow: 0 8px 30px rgba(246,133,27,0.2);
}
.method-icon-wrap {
  font-size: 3.5rem;
  line-height: 1;
}
.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-sub);
  padding: 8px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.875rem;
  transition: all 0.2s ease;
}
.btn-back:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.dep-modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-main);
}
.dep-modal .modal-header {
  border-bottom: 1px solid var(--border);
}

.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--text-sub);
}
.empty-state i { font-size: 2.5rem; display: block; margin-bottom: 0.75rem; opacity: 0.5; }

/* ---- PROFILE ---- */
.profile-avatar-wrap {
  position: relative;
  display: inline-block;
  margin-bottom: 1rem;
}
.profile-avatar {
  width: 100px; height: 100px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--accent);
}
.profile-avatar-placeholder {
  width: 100px; height: 100px;
  border-radius: 50%;
  background: rgba(59,130,246,0.1);
  border: 3px solid var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem; color: var(--accent);
}
.avatar-edit-btn {
  position: absolute;
  bottom: 4px; right: 4px;
  width: 28px; height: 28px;
  background: var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 0.75rem;
  cursor: pointer;
  transition: transform 0.2s;
}
.avatar-edit-btn:hover { transform: scale(1.1); }
.profile-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  background: var(--bg-card-2);
  border-radius: var(--radius-sm);
  padding: 1rem;
  border: 1px solid var(--border);
}
.profile-stat { text-align: center; }
.profile-stat-val { font-size: 1.1rem; font-weight: 700; }
.profile-stat-label { font-size: 0.72rem; color: var(--text-sub); }
.profile-stat-divider { width: 1px; height: 30px; background: var(--border); }
.profile-info-val {
  color: var(--text-main);
  font-size: 0.95rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
  min-height: 2.1rem;
}

/* ---- SETTINGS PAGE ---- */
.settings-option-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.settings-option-btn {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  color: var(--text-main);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.settings-option-btn:hover {
  border-color: var(--accent);
  background: rgba(59,130,246,0.06);
}
.settings-option-btn.active {
  border-color: var(--accent);
  background: rgba(59,130,246,0.1);
}
.settings-option-icon {
  width: 2.5rem; height: 2.5rem;
  display: flex; align-items: center; justify-content: center;
  background: rgba(59,130,246,0.12);
  border-radius: var(--radius-sm);
  font-size: 1.2rem;
  color: var(--accent);
  flex-shrink: 0;
}
.settings-option-label { font-weight: 600; font-size: 0.95rem; }
.settings-option-sub   { font-size: 0.78rem; color: var(--text-sub); margin-top: 2px; }
.settings-option-check { color: var(--accent); font-size: 1.1rem; }

/* ---- TRADING PAGE ---- */
.page-hero-sm {
  padding: 140px 0 60px;
  background: radial-gradient(ellipse at top, rgba(59,130,246,0.1) 0%, transparent 70%);
}
.page-hero-title { font-size: 2.5rem; font-weight: 800; margin-top: 0.75rem; }
.page-hero-sub { color: var(--text-sub); font-size: 1.05rem; max-width: 500px; margin: 0.75rem auto 0; }
.algo-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}
.algo-header { display: flex; justify-content: space-between; align-items: center; }
.status-live {
  background: rgba(16,185,129,0.1);
  border: 1px solid rgba(16,185,129,0.3);
  color: var(--success);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
}
.status-live i { font-size: 0.5rem; animation: blink 1.5s infinite; }
.algo-stat-val { font-size: 1.3rem; font-weight: 800; }
.algo-stat-label { font-size: 0.75rem; color: var(--text-sub); }
.feature-list-lg { display: flex; flex-direction: column; gap: 1.25rem; }
.feature-item-lg { display: flex; gap: 1rem; align-items: flex-start; }
.feature-icon-sm {
  width: 40px; height: 40px;
  background: rgba(59,130,246,0.1);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--accent);
  font-size: 1.1rem;
  flex-shrink: 0;
}
.backtest-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: all 0.3s ease;
}
.backtest-card:hover { border-color: var(--accent); transform: translateY(-4px); }
.backtest-pair { font-size: 1.25rem; font-weight: 800; margin-bottom: 1rem; color: var(--accent); }
.backtest-stats { display: flex; flex-direction: column; gap: 0.75rem; }
.backtest-stat { display: flex; justify-content: space-between; align-items: center; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border); }
.backtest-stat:last-child { border-bottom: none; }

/* ---- TRADING PAGE ---- */
.trading-page {
  max-width: 1400px;
  margin: 0 auto;
  padding: calc(65px + 1.75rem) 2rem 3rem;
}

.trading-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}
.trading-header-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(16,185,129,0.1);
  border: 1px solid rgba(16,185,129,0.25);
  border-radius: 20px;
  padding: 0.2rem 0.65rem;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--success);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}
.trading-title {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
}
.trading-sub { color: var(--text-sub); font-size: 0.875rem; }

.trading-header-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}
.trading-meta-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 1rem;
  text-align: right;
}
.trading-meta-label { font-size: 0.7rem; color: var(--text-sub); font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; }
.trading-meta-val { font-size: 1rem; font-weight: 700; }

/* Chart Card */
.trading-chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

/* Toolbar */
.tv-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card-2);
}
.tv-toolbar-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Custom dropdown */
.tv-dropdown { position: relative; }

.tv-dropdown-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-card);
  border: 1px solid var(--border-2);
  border-radius: 6px;
  color: var(--text-main);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0 0.6rem;
  height: 30px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  white-space: nowrap;
  min-width: 90px;
}
.tv-dropdown-btn:hover { border-color: var(--accent); }
.tv-dropdown.open .tv-dropdown-btn {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(59,130,246,0.15);
}
.tv-dropdown-icon { font-size: 0.72rem; color: var(--text-sub); }
.tv-dropdown-label { flex: 1; }
.tv-dropdown-arrow {
  font-size: 0.62rem;
  color: var(--text-sub);
  transition: transform 0.2s ease;
}
.tv-dropdown.open .tv-dropdown-arrow { transform: rotate(180deg); }

.tv-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 200px;
  background: var(--bg-card-2);
  border: 1px solid var(--border-2);
  border-radius: 10px;
  padding: 0.4rem 0;
  z-index: 9999;
  box-shadow: 0 12px 32px rgba(0,0,0,0.5);
  opacity: 0;
  transform: translateY(-8px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.tv-dropdown.open .tv-dropdown-menu {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}
.tv-dropdown-menu-sm { min-width: 100px; }

.tv-dropdown-group {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--text-sub);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.45rem 0.85rem 0.2rem;
}
.tv-dropdown-sep {
  height: 1px;
  background: var(--border);
  margin: 0.3rem 0;
}
.tv-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.42rem 0.85rem;
  cursor: pointer;
  transition: background 0.1s;
}
.tv-dropdown-item:hover { background: rgba(59,130,246,0.1); }
.tv-dropdown-item.active { background: rgba(59,130,246,0.14); }
.tv-item-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
}
.tv-dropdown-item.active .tv-item-name { color: var(--accent); }
.tv-item-desc {
  font-size: 0.72rem;
  color: var(--text-sub);
  margin-left: auto;
}
.tv-dropdown-item:hover .tv-item-desc { color: var(--text-main); }
.tv-dropdown-menu-sm .tv-dropdown-item {
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
}
.tv-dropdown-menu-sm .tv-dropdown-item.active,
.tv-dropdown-menu-sm .tv-dropdown-item:hover { color: var(--accent); }

.tv-toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
.tv-search-wrap {
  display: flex;
  align-items: center;
}
.tv-search-input {
  background: var(--bg-card);
  border: 1px solid var(--border-2);
  border-right: none;
  border-radius: 6px 0 0 6px;
  color: var(--text-main);
  font-size: 0.8rem;
  padding: 0 0.65rem;
  height: 30px;
  width: 150px;
  outline: none;
  transition: border-color 0.15s;
}
.tv-search-input::placeholder { color: var(--text-sub); opacity: 0.6; }
.tv-search-input:focus { border-color: var(--accent); }
.tv-search-btn {
  height: 30px;
  width: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border-2);
  border-left: none;
  border-radius: 0 6px 6px 0;
  color: var(--text-sub);
  cursor: pointer;
  font-size: 0.78rem;
  flex-shrink: 0;
  transition: all 0.15s;
}
.tv-search-btn:hover { border-color: var(--accent); color: var(--accent); background: rgba(59,130,246,0.06); }
.tv-search-input:focus ~ .tv-search-btn { border-color: var(--accent); }

.btn-outline-accent {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.65rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  height: 32px;
}
.btn-outline-accent:hover { background: var(--accent); color: #fff; }


/* Interval bar */
.tv-interval-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.3rem;
  padding: 0.5rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card-2);
}
.tv-interval-btn {
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  background: transparent;
  border: 1px solid var(--border-2);
  border-radius: 4px;
  color: var(--text-sub);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.tv-interval-btn:hover { border-color: var(--accent); color: var(--accent); background: rgba(59,130,246,0.06); }
.tv-interval-btn.active { background: rgba(59,130,246,0.15); border-color: var(--accent); color: var(--accent); }

/* Live bar */
.tv-live-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.tv-live-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
  position: relative;
}
.tv-live-dot::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid var(--success);
  opacity: 0;
  animation: livePulse 1.8s ease-out infinite;
}
@keyframes livePulse {
  0%   { transform: scale(0.6); opacity: 0.8; }
  100% { transform: scale(2);   opacity: 0; }
}

.tradingview-widget-container { overflow: hidden; }

/* AI Analyze Button */
.btn-ai-analyze {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.btn-ai-analyze:hover { opacity: 0.88; transform: translateY(-1px); }
.btn-ai-analyze:active { transform: translateY(0); }
.ai-cost-badge {
  background: rgba(255,255,255,0.18);
  border-radius: 10px;
  padding: 0.05rem 0.45rem;
  font-size: 0.7rem;
  font-weight: 700;
}

/* Chart + sidebar wrapper */
.trading-chart-wrapper {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.trading-chart-wrapper .trading-chart-card {
  flex: 1;
  min-width: 0;
  transition: flex 0.3s ease;
}

/* AI Result Panel — sidebar bên phải */
.ai-result-panel {
  width: 320px;
  flex-shrink: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.ai-history-view {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}
.ai-history-list-wrap {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}
.ai-active-view {
  display: none;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}
#aiResultContent {
  flex: 1;
  overflow-y: auto;
  display: none;
  flex-direction: column;
  min-height: 0;
}
@media (max-width: 1024px) {
  .trading-chart-wrapper { flex-direction: column; }
  .ai-result-panel { width: 100%; height: auto !important; }
  .ai-history-list-wrap { max-height: 300px; }
}

.ai-result-loading {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
}
.ai-loading-spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--border-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* === AI Result Panel redesign === */

/* Header */
.air-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card-2);
  flex-shrink: 0;
  gap: 8px;
}
.air-signal-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.air-meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.air-symbol {
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.air-time {
  font-size: .68rem;
  color: var(--text-sub);
}
.ai-close-btn {
  background: none;
  border: none;
  color: var(--text-sub);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: .85rem;
  flex-shrink: 0;
  transition: color .2s, background .2s;
}
.ai-close-btn:hover { color: var(--accent); background: var(--border); }

/* Signal badge */
.ai-signal-badge {
  font-size: .8rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  letter-spacing: .06em;
  flex-shrink: 0;
  white-space: nowrap;
}
.ai-signal-buy  { background: rgba(16,185,129,.15); color: var(--success); border: 1px solid rgba(16,185,129,.3); }
.ai-signal-sell { background: rgba(239,68,68,.12);  color: var(--danger);  border: 1px solid rgba(239,68,68,.3); }
.ai-signal-hold { background: rgba(245,158,11,.12); color: var(--warning); border: 1px solid rgba(245,158,11,.3); }

/* Prices 2×2 grid */
.air-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  flex-shrink: 0;
}
.air-cell {
  padding: 9px 12px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.air-cell:nth-child(2n)      { border-right: none; }
.air-cell:nth-last-child(-n+2) { border-bottom: none; }
.air-cell-label {
  font-size: .68rem;
  color: var(--text-sub);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 3px;
  font-weight: 600;
}
.air-cell-val {
  font-size: .9rem;
  font-family: 'Courier New', monospace;
  line-height: 1.3;
}
.air-cell-dist {
  font-size: .68rem;
  margin-top: 2px;
  opacity: .85;
}

/* Reasoning */
.ai-reasoning {
  padding: 10px 12px;
  font-size: .82rem;
  color: var(--text-main);
  line-height: 1.65;
  white-space: pre-wrap;
}

/* Loading */
.ai-result-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 16px;
  flex: 1;
  justify-content: center;
  flex-direction: column;
  text-align: center;
}
.ai-loading-spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Error */
.ai-result-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  font-size: .85rem;
  color: var(--danger);
  text-align: center;
  flex: 1;
  gap: 4px;
}

@media (max-width: 768px) {
  .trading-page { padding: calc(65px + 1rem) 1rem 2rem; }
  .trading-header { flex-direction: column; gap: 1rem; }
  .trading-header-meta { align-self: flex-start; }
  .tv-toolbar { flex-direction: column; align-items: flex-start; }
  .tv-toolbar-right { flex-wrap: wrap; }
  .tv-search-input { width: 120px; }
  .tv-divider { display: none; }
  .ai-signal-row { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
  .ai-confidence-wrap { width: 100%; }
}

/* ---- AI SUBSCRIPTION GATE ---- */
.ai-sub-gate {
  max-width: 940px;
  margin: 0 auto;
  text-align: center;
  padding: 2.5rem 0 3rem;
}
.ai-sub-gate-inner { margin-bottom: 2.5rem; }
.ai-sub-gate-badge {
  display: inline-flex;
  align-items: center;
  background: rgba(59,130,246,0.1);
  border: 1px solid rgba(59,130,246,0.25);
  border-radius: 20px;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}
.ai-sub-gate-title {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}
.ai-sub-gate-sub {
  color: var(--text-sub);
  font-size: 0.95rem;
  max-width: 520px;
  margin: 0 auto;
}

/* Plan grid */
.ai-plans-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}
.ai-plan-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 1.5rem 1.5rem;
  position: relative;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.ai-plan-card:hover { transform: translateY(-4px); box-shadow: 0 8px 30px rgba(59,130,246,0.1); border-color: var(--border-2); }
.ai-plan-card-featured {
  border-color: var(--accent);
  background: linear-gradient(145deg, var(--bg-card), rgba(59,130,246,0.04));
  box-shadow: 0 0 0 1px var(--accent), 0 8px 30px rgba(59,130,246,0.15);
}
.ai-plan-card-featured:hover { box-shadow: 0 0 0 1px var(--accent), 0 12px 40px rgba(59,130,246,0.25); }

.ai-plan-popular {
  position: absolute;
  top: -13px; left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 0.2rem 0.8rem;
  border-radius: 12px;
  white-space: nowrap;
}
.ai-plan-saving {
  position: absolute;
  top: -13px; right: 1rem;
  background: rgba(16,185,129,0.15);
  border: 1px solid rgba(16,185,129,0.3);
  color: var(--success);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.6rem;
  border-radius: 10px;
}
.ai-plan-name {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-sub);
  margin-bottom: 0.75rem;
}
.ai-plan-price {
  font-size: 3rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text-main);
  margin-bottom: 0.2rem;
}
.ai-plan-unit { font-size: 1rem; font-weight: 600; color: var(--text-sub); margin-left: 0.2rem; }
.ai-plan-period { font-size: 0.78rem; color: var(--text-sub); margin-bottom: 1.5rem; }
.ai-plan-features {
  list-style: none;
  padding: 0; margin: 0 0 1.5rem;
  width: 100%; text-align: left;
  display: flex; flex-direction: column; gap: 0.5rem;
  flex: 1;
}
.ai-plan-features li { font-size: 0.82rem; color: var(--text-sub); }

.btn-ai-buy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.65rem 1.25rem;
  background: transparent;
  border: 1.5px solid var(--accent);
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-ai-buy:hover { background: rgba(59,130,246,0.1); }
.btn-ai-buy:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-ai-buy-featured {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #fff;
}
.btn-ai-buy-featured:hover { background: linear-gradient(135deg, var(--accent), var(--accent-2)); opacity: 0.88; }
.btn-ai-buy-featured:disabled { opacity: 0.5; }

.ai-sub-coins-note { font-size: 0.875rem; color: var(--text-sub); }
.ai-sub-coins-note a { color: var(--accent); text-decoration: none; }
.ai-sub-coins-note a:hover { text-decoration: underline; }

/* Subscription status bar (subscribed view) */
.ai-sub-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(16,185,129,0.08);
  border: 1px solid rgba(16,185,129,0.2);
  border-radius: var(--radius);
  padding: 0.65rem 1.25rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.ai-sub-expiry-badge {
  font-size: 0.78rem;
  color: var(--text-sub);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.15rem 0.5rem;
}
.btn-ai-renew {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.75rem;
  background: transparent;
  border: 1px solid rgba(16,185,129,0.35);
  border-radius: 6px;
  color: var(--success);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-ai-renew:hover { background: rgba(16,185,129,0.1); border-color: var(--success); }

/* Renew Modal */
.ai-modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.ai-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.ai-modal-close {
  background: none;
  border: none;
  color: var(--text-sub);
  cursor: pointer;
  padding: 0.25rem 0.4rem;
  border-radius: 4px;
  font-size: 0.85rem;
  transition: color 0.2s;
}
.ai-modal-close:hover { color: var(--danger); }
.ai-renew-plans {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  padding: 1.25rem;
}
.ai-modal-footer {
  padding: 0.75rem 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-sub);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.3rem;
}

/* Light theme */
[data-theme="light"] .tv-dropdown-menu { box-shadow: 0 8px 24px rgba(0,0,0,0.12); }
[data-theme="light"] .ai-plan-card { background: #FFFFFF; border-color: #E2E8F0; }
[data-theme="light"] .ai-plan-card:hover { box-shadow: 0 8px 24px rgba(59,130,246,0.08); }
[data-theme="light"] .ai-plan-card-featured { box-shadow: 0 0 0 1px var(--accent), 0 8px 24px rgba(59,130,246,0.1); }
[data-theme="light"] .ai-sub-status-bar { background: rgba(16,185,129,0.05); }
[data-theme="light"] .ai-sub-expiry-badge { background: #FFFFFF; border-color: #E2E8F0; }
[data-theme="light"] .ai-modal-content { background: #FFFFFF; border-color: #E2E8F0; }
[data-theme="light"] .ai-modal-header, [data-theme="light"] .ai-modal-footer { border-color: #E2E8F0; }

@media (max-width: 768px) {
  .ai-plans-grid { grid-template-columns: 1fr; max-width: 360px; margin-inline: auto; }
  .ai-renew-plans { grid-template-columns: 1fr; }
  .ai-sub-status-bar { flex-direction: column; align-items: flex-start; }
}

/* ---- FOOTER ---- */
.footer {
  padding: 4rem 0 2rem;
  border-top: 1px solid var(--border);
  background: var(--bg-sidebar);
  transition: margin-left 0.25s ease;
}
/* Khi có sidebar mở → footer lùi sang phải cùng chiều rộng sidebar */
.dashboard-layout + .footer { margin-left: 240px; }
/* Khi sidebar thu gọn */
.dashboard-layout:has(.sidebar.collapsed) + .footer { margin-left: 64px; }
/* Mobile: sidebar ẩn → footer full width */
@media (max-width: 767px) {
  .dashboard-layout + .footer { margin-left: 0; }
}
.footer-brand { font-size: 1.25rem; font-weight: 800; margin-bottom: 0.75rem; }
.footer-desc { color: var(--text-sub); font-size: 0.875rem; }
.footer-heading { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-sub); margin-bottom: 1rem; }
.footer-links { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.footer-links a { color: var(--text-sub); text-decoration: none; font-size: 0.875rem; transition: color 0.2s; }
.footer-links a:hover { color: var(--accent); }
.footer-divider { border-color: var(--border); margin: 2rem 0 1.5rem; }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-sub);
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* ---- DROPDOWN ---- */
.dropdown-menu-dark {
  background: var(--bg-card) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm);
}
.dropdown-item { color: var(--text-sub) !important; font-size: 0.875rem; transition: all 0.2s; }
.dropdown-item:hover { background: rgba(255,255,255,0.05) !important; color: var(--text-main) !important; }

/* ---- ANIMATIONS ---- */
@keyframes slideIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}
.animate-fadeInUp { animation: fadeInUp 0.6s ease forwards; opacity: 0; }
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.5s; }
.animate-on-scroll { opacity: 0; transform: translateY(28px); }
.animate-on-scroll.visible { animation: scrollFadeUp 0.55s ease forwards; }
@keyframes scrollFadeUp {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: translateY(0);    }
}

/* ---- LIGHT THEME ---- */
[data-theme="light"] {
  --bg-main:    #F8FAFC;
  --bg-card:    #FFFFFF;
  --bg-card-2:  #F1F5F9;
  --bg-sidebar: #F1F5F9;
  --text-main:  #0F172A;
  --text-sub:   #64748B;
  --border:     #E2E8F0;
  --border-2:   #CBD5E1;
  --shadow-glow: 0 0 40px rgba(59,130,246,0.07);
}
[data-theme="light"] #mainNav {
  background: rgba(248,250,252,0.88);
  border-bottom-color: #E2E8F0;
}
[data-theme="light"] #mainNav.scrolled { background: rgba(248,250,252,0.97); }
[data-theme="light"] .nav-link:hover   { background: rgba(0,0,0,0.04); }
[data-theme="light"] .how-section      { background: rgba(0,0,0,0.02); }
[data-theme="light"] .stats-bar        { background: rgba(0,0,0,0.02); }
[data-theme="light"] .feature-card-highlight { background: linear-gradient(145deg, #EEF2FF, #E0E7FF); }
[data-theme="light"] .footer           { background: #EFF4FF; border-top-color: #E2E8F0; }
[data-theme="light"] .form-control     { background: #F8FAFC !important; color: #0F172A !important; border-color: #CBD5E1 !important; }
[data-theme="light"] .form-control:focus { border-color: var(--accent) !important; }
[data-theme="light"] .form-control::placeholder { color: #94A3B8 !important; }
[data-theme="light"] .dropdown-menu-dark { background: #FFFFFF !important; border-color: #E2E8F0 !important; }
[data-theme="light"] .dropdown-item    { color: #334155 !important; }
[data-theme="light"] .dropdown-item:hover { background: rgba(0,0,0,0.04) !important; color: #0F172A !important; }
[data-theme="light"] .alert-toast               { color: #0F172A; box-shadow: 0 8px 24px rgba(0,0,0,0.15); }
[data-theme="light"] .alert-toast-success       { background: #d1fae5; border-color: #6ee7b7; border-left-color: var(--success); }
[data-theme="light"] .alert-toast-error,
[data-theme="light"] .alert-toast-danger        { background: #fee2e2; border-color: #fca5a5; border-left-color: var(--danger); }
[data-theme="light"] .alert-toast-warning       { background: #fef3c7; border-color: #fcd34d; border-left-color: var(--warning); }
[data-theme="light"] .alert-toast-info          { background: #dbeafe; border-color: #93c5fd; border-left-color: var(--accent); }
[data-theme="light"] .btn-outline-light-custom { border-color: rgba(0,0,0,0.15); color: #0F172A; background: rgba(0,0,0,0.04); }
[data-theme="light"] .btn-outline-light-custom:hover { background: rgba(0,0,0,0.08); }
[data-theme="light"] .nav-coins { background: rgba(0,0,0,0.04); border-color: #E2E8F0; }
[data-theme="light"] .sidebar-link:hover { background: rgba(0,0,0,0.04); }
[data-theme="light"] .sidebar-logout:hover {
  background: #EF4444 !important;
  border: 1px solid #EF4444 !important;
  color: #fff !important;
  transition: none;
}
[data-theme="light"] .table-dark-custom tbody tr:hover { background: rgba(0,0,0,0.03); }
[data-theme="light"] .network-badge { background: rgba(0,0,0,0.04); border-color: #E2E8F0; }
[data-theme="light"] .info-box { background: rgba(0,0,0,0.02); border-color: #E2E8F0; }
[data-theme="light"] .info-box-warning { background: rgba(245,158,11,0.06); border-color: rgba(245,158,11,0.4); }
[data-theme="light"] .method-card { background: #FFFFFF; }
[data-theme="light"] .dep-modal { background: #FFFFFF; }

/* ---- RESPONSIVE ---- */

/* Màn lớn — nới rộng container để giảm khoảng trắng hai bên */
@media (min-width: 1600px) {
  .container { max-width: 1520px; }
  .trading-page { max-width: 1680px; }
  .tv-page .container { max-width: 1520px; }
}
@media (min-width: 1920px) {
  .container { max-width: 1800px; }
  .trading-page { max-width: 1880px; }
  .tv-page .container { max-width: 1800px; }
}

@media (max-width: 991px) {
  .sidebar { display: none; }
  .dashboard-main { margin-left: 0; max-width: 100%; padding: 1.5rem; }
  .dashboard-header { flex-direction: column; }
  .hero-section { padding: 120px 0 60px; }
  .cta-card { padding: 2rem; }
}
@media (max-width: 576px) {
  .hero-title { font-size: 2rem; }
  .hero-actions { flex-direction: column; align-items: center; }
  .stat-card-val { font-size: 1.3rem; }
}

/* ---- 404 ERROR PAGE ---- */

/* Override scroll animation — 404 content must be visible immediately */
.error-page .animate-on-scroll {
  opacity: 1;
  transform: translateY(0);
}

.error-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 80px 0 60px;
}

.error-bg-blur {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
}
.error-bg-blur-1 {
  width: 600px; height: 600px;
  background: rgba(239,68,68,0.06);
  top: -100px; left: -150px;
}
.error-bg-blur-2 {
  width: 400px; height: 400px;
  background: rgba(245,158,11,0.06);
  bottom: -50px; right: -100px;
}

/* Warning banner */
.error-warning-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  color: #FCA5A5;
  border-radius: 8px;
  padding: 12px 20px;
  font-size: 0.9rem;
  margin: 0 auto 2.5rem;
  max-width: 600px;
  animation: error-pulse-border 2.5s ease-in-out infinite;
}
@keyframes error-pulse-border {
  0%, 100% { border-color: rgba(239,68,68,0.3); box-shadow: none; }
  50%       { border-color: rgba(239,68,68,0.6); box-shadow: 0 0 16px rgba(239,68,68,0.15); }
}

/* Shield icon + 404 side by side */
.error-headline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.15em;
  margin-bottom: 0.25rem;
  line-height: 1;
}
.error-shield-icon {
  font-size: clamp(4.5rem, 15vw, 9rem);
  background: linear-gradient(135deg, var(--danger), var(--warning));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  flex-shrink: 0;
}
@keyframes error-icon-float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-10px); }
}

/* 404 number */
.error-code {
  font-size: clamp(5rem, 18vw, 10rem);
  font-weight: 600;
  line-height: 1;
  background: linear-gradient(135deg, var(--danger), var(--warning));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.04em;
}

.error-title {
  font-size: clamp(1.4rem, 4vw, 2rem);
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.75rem;
}

.error-subtitle {
  font-size: 1rem;
  color: var(--text-sub);
  max-width: 500px;
  margin: 0 auto 1.75rem;
}

.error-path {
  background: var(--bg-card-2);
  color: var(--warning);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 7px;
  font-size: 0.875em;
  word-break: break-all;
}

/* Detail card */
.error-detail-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.75rem;
  max-width: 480px;
  margin: 0 auto 2rem;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.error-detail-row {
  display: flex;
  align-items: center;
  font-size: 0.9rem;
  color: var(--text-sub);
}

/* Actions */
.error-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.75rem;
}

/* Quick links */
.error-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.error-link {
  color: var(--text-sub);
  font-size: 0.875rem;
  text-decoration: none;
  transition: color 0.2s ease;
}
.error-link:hover { color: var(--accent); }

/* Light theme */
[data-theme="light"] .error-warning-banner { background: rgba(239,68,68,0.07); color: #B91C1C; border-color: rgba(239,68,68,0.25); }
[data-theme="light"] .error-path           { background: #FEF2F2; color: #B45309; border-color: #FCD34D; }
[data-theme="light"] .error-detail-card    { background: #FFFFFF; border-color: #E2E8F0; }
[data-theme="light"] .error-detail-row     { color: #475569; }
[data-theme="light"] .error-link           { color: #64748B; }

@media (max-width: 576px) {
  .error-actions { flex-direction: column; align-items: center; }
  .error-detail-card { padding: 1rem 1.25rem; }
}
