/* ============================================================
   COPY TRADING SYSTEM — PREMIUM DESIGN SYSTEM
   Version: 2.0 | Gold + Dark Trading Aesthetic
   ============================================================ */

/* ── FONTS ── */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ── CSS VARIABLES (Admin-customizable via JS) ── */
:root {
  /* Primary brand colors — defaults to gold */
  --primary: #D4A017;
  --primary-light: #F0C946;
  --primary-dark: #B8860B;
  --primary-rgb: 212, 160, 23;

  /* Accent */
  --accent: #22C55E;
  --accent-rgb: 34, 197, 94;
  --danger: #EF4444;
  --danger-rgb: 239, 68, 68;
  --warning: #F59E0B;
  --info: #3B82F6;

  /* Dark theme (default) */
  --bg-primary: #0B0E11;
  --bg-secondary: #12161C;
  --bg-card: #181C23;
  --bg-card-hover: #1E232B;
  --bg-elevated: #222830;
  --bg-input: #12161C;

  --border-primary: rgba(255,255,255,0.06);
  --border-secondary: rgba(255,255,255,0.1);
  --border-active: var(--primary);

  --text-primary: #F4F4F5;
  --text-secondary: #9CA3AF;
  --text-muted: #6B7280;
  --text-inverse: #0B0E11;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 20px rgba(var(--primary-rgb), 0.15);
  --shadow-glow-strong: 0 0 40px rgba(var(--primary-rgb), 0.25);

  /* Typography */
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Transitions */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 400ms;

  /* Spacing scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
}

/* ── LIGHT MODE ── */
[data-theme="light"] {
  --bg-primary: #F8F9FB;
  --bg-secondary: #FFFFFF;
  --bg-card: #FFFFFF;
  --bg-card-hover: #F3F4F6;
  --bg-elevated: #F9FAFB;
  --bg-input: #F3F4F6;

  --border-primary: rgba(0,0,0,0.06);
  --border-secondary: rgba(0,0,0,0.1);

  --text-primary: #111827;
  --text-secondary: #4B5563;
  --text-muted: #9CA3AF;
  --text-inverse: #F4F4F5;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --shadow-glow: 0 0 20px rgba(var(--primary-rgb), 0.1);
}

/* ── RESET & BASE ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  transition: background var(--duration-normal) var(--ease),
              color var(--duration-normal) var(--ease);
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.12);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }
[data-theme="light"] ::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); }

/* ── SELECTION ── */
::selection {
  background: rgba(var(--primary-rgb), 0.3);
  color: var(--text-primary);
}

/* ── LINKS ── */
a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease);
}
a:hover { color: var(--primary-light); }

/* ── TYPOGRAPHY ── */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.25;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.text-display {
  font-size: clamp(1.75rem, 4vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.text-headline {
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  font-weight: 600;
}

.text-label {
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.text-money {
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.text-gold {
  color: var(--primary);
}

.text-green {
  color: var(--accent);
}

.text-red {
  color: var(--danger);
}

/* ── LAYOUT ── */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

@media (min-width: 640px) {
  .container { padding: 0 var(--space-6); }
}

@media (min-width: 1024px) {
  .container { padding: 0 var(--space-8); }
}

/* ── CARDS ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  transition: all var(--duration-normal) var(--ease);
}

.card:hover {
  border-color: var(--border-secondary);
  box-shadow: var(--shadow-md);
}

.card-elevated {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.card-glow {
  background: var(--bg-card);
  border: 1px solid rgba(var(--primary-rgb), 0.15);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-glow);
}

.card-glow:hover {
  border-color: rgba(var(--primary-rgb), 0.3);
  box-shadow: var(--shadow-glow-strong);
}

/* ── STAT CARD ── */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  position: relative;
  overflow: hidden;
  transition: all var(--duration-normal) var(--ease);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary);
  opacity: 0;
  transition: opacity var(--duration-normal) var(--ease);
}

.stat-card:hover::before { opacity: 1; }
.stat-card:hover { border-color: rgba(var(--primary-rgb), 0.2); }

.stat-card .stat-value {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.stat-card .stat-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: var(--space-1);
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease);
  white-space: nowrap;
  text-decoration: none;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--primary);
  color: var(--text-inverse);
}
.btn-primary:hover {
  background: var(--primary-light);
  box-shadow: 0 4px 16px rgba(var(--primary-rgb), 0.3);
}

.btn-accent {
  background: var(--accent);
  color: #fff;
}
.btn-accent:hover {
  background: #16A34A;
  box-shadow: 0 4px 16px rgba(var(--accent-rgb), 0.3);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover {
  background: #DC2626;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-secondary);
  color: var(--text-primary);
}
.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(var(--primary-rgb), 0.05);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text-primary);
}

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: 1rem;
  border-radius: var(--radius-lg);
}

.btn-sm {
  padding: var(--space-2) var(--space-3);
  font-size: 0.8125rem;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-md);
}

/* ── FORM INPUTS ── */
.input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-input);
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  transition: all var(--duration-fast) var(--ease);
  outline: none;
}

.input::placeholder { color: var(--text-muted); }

.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
}

.input-lg {
  padding: var(--space-4) var(--space-5);
  font-size: 1.125rem;
}

.input-money {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 600;
}

select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239CA3AF' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

/* ── BADGES ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 0.6875rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-success { background: rgba(var(--accent-rgb), 0.12); color: var(--accent); }
.badge-danger { background: rgba(var(--danger-rgb), 0.12); color: var(--danger); }
.badge-warning { background: rgba(245, 158, 11, 0.12); color: #F59E0B; }
.badge-info { background: rgba(59, 130, 246, 0.12); color: #3B82F6; }
.badge-gold { background: rgba(var(--primary-rgb), 0.12); color: var(--primary); }
.badge-neutral { background: rgba(255,255,255,0.06); color: var(--text-muted); }

/* ── TABLES ── */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-primary);
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th {
  padding: var(--space-3) var(--space-4);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-align: left;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-primary);
}

.table td {
  padding: var(--space-3) var(--space-4);
  font-size: 0.875rem;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-primary);
  vertical-align: middle;
}

.table tbody tr {
  transition: background var(--duration-fast) var(--ease);
}

.table tbody tr:hover {
  background: rgba(255,255,255,0.02);
}

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

/* ── TOP NAV ── */
.topnav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11,14,17,0.85);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid var(--border-primary);
  height: 60px;
}

[data-theme="light"] .topnav {
  background: rgba(255,255,255,0.88);
}

.topnav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

/* ── SIDEBAR (Admin) ── */
.sidebar {
  position: fixed;
  top: 60px;
  left: 0;
  bottom: 0;
  width: 240px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-primary);
  overflow-y: auto;
  z-index: 90;
  transition: transform var(--duration-normal) var(--ease);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 0;
  transition: all var(--duration-fast) var(--ease);
  border-left: 2px solid transparent;
}

.sidebar-link:hover {
  background: rgba(255,255,255,0.03);
  color: var(--text-primary);
}

.sidebar-link.active {
  background: rgba(var(--primary-rgb), 0.06);
  color: var(--primary);
  border-left-color: var(--primary);
}

.sidebar-link i {
  width: 20px;
  text-align: center;
  font-size: 0.9375rem;
}

/* ── BOTTOM NAV (Mobile) ── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-primary);
  padding: var(--space-2) 0;
  display: none;
}

@media (max-width: 767px) {
  .bottom-nav { display: block; }
}

.bottom-nav-inner {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--space-2) 0;
  color: var(--text-muted);
  font-size: 0.625rem;
  font-weight: 500;
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease);
}

.bottom-nav-item i { font-size: 1.125rem; }

.bottom-nav-item.active {
  color: var(--primary);
}

/* ── PROGRESS BAR ── */
.progress {
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--primary);
  transition: width 1s var(--ease);
}

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

/* ── AVATAR ── */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--text-inverse);
  background: var(--primary);
  flex-shrink: 0;
}

.avatar-sm { width: 32px; height: 32px; font-size: 0.75rem; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.125rem; }

/* ── DIVIDER ── */
.divider {
  height: 1px;
  background: var(--border-primary);
  margin: var(--space-4) 0;
}

/* ── LOADING ── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.1);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* ── SKELETON ── */
.skeleton {
  background: linear-gradient(90deg,
    rgba(255,255,255,0.04) 0%,
    rgba(255,255,255,0.08) 50%,
    rgba(255,255,255,0.04) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── TOAST / NOTIFICATION ── */
.toast {
  position: fixed;
  top: var(--space-4);
  right: var(--space-4);
  z-index: 9999;
  padding: var(--space-3) var(--space-5);
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  animation: toastIn 0.3s var(--ease);
  max-width: 360px;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-12px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.toast-success { border-left: 3px solid var(--accent); }
.toast-error { border-left: 3px solid var(--danger); }
.toast-warning { border-left: 3px solid var(--warning); }

/* ── ANIMATIONS ── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.animate-fade-in { animation: fadeIn 0.4s var(--ease); }
.animate-fade-in-up { animation: fadeInUp 0.5s var(--ease); }
.animate-scale-in { animation: scaleIn 0.3s var(--ease); }
.animate-pulse { animation: pulse 2s infinite; }

/* Staggered children */
.stagger > *:nth-child(1) { animation-delay: 0ms; }
.stagger > *:nth-child(2) { animation-delay: 60ms; }
.stagger > *:nth-child(3) { animation-delay: 120ms; }
.stagger > *:nth-child(4) { animation-delay: 180ms; }
.stagger > *:nth-child(5) { animation-delay: 240ms; }
.stagger > *:nth-child(6) { animation-delay: 300ms; }
.stagger > * {
  animation: fadeInUp 0.5s var(--ease) both;
}

/* ── CHART / TRADING CANVAS ── */
.trading-chart-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

/* ── PACKAGE CARD ── */
.package-card {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  position: relative;
  overflow: hidden;
  transition: all var(--duration-normal) var(--ease);
}

.package-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary);
  transform: scaleX(0);
  transition: transform var(--duration-normal) var(--ease);
}

.package-card:hover {
  border-color: rgba(var(--primary-rgb), 0.2);
  transform: translateY(-4px);
  box-shadow: var(--shadow-glow);
}

.package-card:hover::after { transform: scaleX(1); }

.package-card.featured {
  border-color: rgba(var(--primary-rgb), 0.3);
}

.package-card.featured::after { transform: scaleX(1); }

/* ── COUNTDOWN ── */
.countdown-display {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 1.125rem;
  color: var(--primary);
  letter-spacing: 0.05em;
}

/* ── MODAL ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  animation: fadeIn 0.2s var(--ease);
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: scaleIn 0.3s var(--ease);
}

/* ── MOBILE RESPONSIVE ── */
@media (max-width: 767px) {
  body { padding-bottom: 72px; }

  .hide-mobile { display: none !important; }

  .stat-card { padding: var(--space-4); }
  .stat-card .stat-value { font-size: 1.25rem; }

  .card-elevated, .card-glow {
    border-radius: var(--radius-md);
  }
}

@media (min-width: 768px) {
  .hide-desktop { display: none !important; }
}

/* ── UTILITY ── */
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

.glass {
  background: rgba(255,255,255,0.03);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* ── LIVE DOT ── */
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2s infinite;
  flex-shrink: 0;
}

/* ── THEME TOGGLE ── */
.theme-toggle {
  width: 44px;
  height: 24px;
  background: var(--bg-input);
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-full);
  position: relative;
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease);
}

.theme-toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  transition: transform var(--duration-fast) var(--ease);
}

[data-theme="light"] .theme-toggle::after {
  transform: translateX(20px);
}

/* ── NOTIFICATION DOT ── */
.notification-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  border: 2px solid var(--bg-primary);
}

/* ── SECURITY: Prevent content injection display ── */
[data-sanitized] { all: initial; }
