/* SmartTrade - Global Styles */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg-primary: #050a14;
  --bg-secondary: #0a1628;
  --bg-card: #0d1f3c;
  --bg-card2: #111d35;
  --border: #1a2d50;
  --border-light: #1e3460;
  --accent-green: #00d4aa;
  --accent-blue: #0066ff;
  --accent-red: #ff3b6b;
  --accent-yellow: #f59e0b;
  --text-primary: #e8f0fe;
  --text-secondary: #6b7fa3;
  --text-muted: #3d5175;
  --gradient: linear-gradient(135deg, #00d4aa, #0066ff);
  --shadow: 0 8px 32px rgba(0,0,0,0.4);
  --radius: 12px;
  --radius-sm: 8px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Space Grotesk', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Disable right-click */
body { -webkit-user-select: none; user-select: none; }

a { color: var(--accent-green); text-decoration: none; }
a:hover { color: #00ffcc; }

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-blue); }

/* ============================================================
   LAYOUT
   ============================================================ */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  min-width: 240px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform 0.3s;
}

.main-content {
  flex: 1;
  margin-left: 240px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: 60px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.page-content {
  flex: 1;
  padding: 24px;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo .logo-text {
  font-size: 22px;
  font-weight: 700;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-logo .logo-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  font-family: 'JetBrains Mono', monospace;
}

.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }

.nav-section-title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  padding: 12px 20px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border-left: 3px solid transparent;
  text-decoration: none;
}

.nav-item:hover {
  background: rgba(0, 212, 170, 0.08);
  color: var(--text-primary);
  border-left-color: rgba(0, 212, 170, 0.3);
}

.nav-item.active {
  background: rgba(0, 212, 170, 0.12);
  color: var(--accent-green);
  border-left-color: var(--accent-green);
}

.nav-item .nav-icon { width: 18px; text-align: center; font-size: 16px; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--gradient);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; color: #fff;
  flex-shrink: 0;
}

.user-info .user-name { font-size: 13px; font-weight: 600; }
.user-info .user-plan { font-size: 11px; color: var(--text-muted); }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title { font-size: 16px; font-weight: 600; }
.card-subtitle { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

/* ============================================================
   STAT CARDS
   ============================================================ */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 60px; height: 60px;
  background: var(--gradient);
  opacity: 0.06;
  border-radius: 0 0 0 60px;
}

.stat-label { font-size: 12px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 1px; }
.stat-value { font-size: 28px; font-weight: 700; margin: 6px 0; font-family: 'JetBrains Mono', monospace; }
.stat-change { font-size: 12px; }
.stat-change.up { color: var(--accent-green); }
.stat-change.down { color: var(--accent-red); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  font-family: inherit;
  white-space: nowrap;
}

.btn-primary {
  background: var(--gradient);
  color: #fff;
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }

.btn-green { background: rgba(0,212,170,0.15); color: var(--accent-green); border: 1px solid rgba(0,212,170,0.3); }
.btn-green:hover { background: rgba(0,212,170,0.25); }

.btn-red { background: rgba(255,59,107,0.15); color: var(--accent-red); border: 1px solid rgba(255,59,107,0.3); }
.btn-red:hover { background: rgba(255,59,107,0.25); }

.btn-blue { background: rgba(0,102,255,0.15); color: var(--accent-blue); border: 1px solid rgba(0,102,255,0.3); }
.btn-blue:hover { background: rgba(0,102,255,0.25); }

.btn-ghost { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg-card2); color: var(--text-primary); }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-green { background: rgba(0,212,170,0.15); color: var(--accent-green); }
.badge-red { background: rgba(255,59,107,0.15); color: var(--accent-red); }
.badge-blue { background: rgba(0,102,255,0.15); color: var(--accent-blue); }
.badge-yellow { background: rgba(245,158,11,0.15); color: var(--accent-yellow); }
.badge-gray { background: rgba(107,127,163,0.15); color: var(--text-secondary); }

/* ============================================================
   TABLES
   ============================================================ */
.table-wrapper { overflow-x: auto; }

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

thead th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  font-weight: 600;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

tbody td {
  padding: 12px;
  border-bottom: 1px solid rgba(26,45,80,0.5);
  font-size: 13px;
  vertical-align: middle;
}

tbody tr:hover { background: rgba(0,212,170,0.03); }
tbody tr:last-child td { border-bottom: none; }

.mono { font-family: 'JetBrains Mono', monospace; font-size: 12px; }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.2s;
  outline: none;
}

.form-control:focus { border-color: var(--accent-green); }
.form-control::placeholder { color: var(--text-muted); }

select.form-control option { background: var(--bg-secondary); }

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal-overlay.show { opacity: 1; pointer-events: all; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95) translateY(20px);
  transition: transform 0.2s;
}

.modal-overlay.show .modal { transform: scale(1) translateY(0); }

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title { font-size: 18px; font-weight: 700; }
.modal-body { padding: 20px 24px; }
.modal-footer { padding: 16px 24px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

.btn-close {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  transition: all 0.2s;
}
.btn-close:hover { background: rgba(255,59,107,0.15); color: var(--accent-red); border-color: rgba(255,59,107,0.3); }

/* ============================================================
   SIGNAL INDICATORS
   ============================================================ */
.signal-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}
.signal-dot.buy { background: var(--accent-green); box-shadow: 0 0 6px var(--accent-green); }
.signal-dot.sell { background: var(--accent-red); box-shadow: 0 0 6px var(--accent-red); }
.signal-dot.hold { background: var(--accent-yellow); }

.signal-buy { color: var(--accent-green); font-weight: 700; }
.signal-sell { color: var(--accent-red); font-weight: 700; }
.signal-hold { color: var(--accent-yellow); font-weight: 700; }

/* ============================================================
   TOGGLE SWITCH
   ============================================================ */
.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--border-light);
  border-radius: 24px;
  cursor: pointer;
  transition: all 0.3s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  background: #fff;
  border-radius: 50%;
  left: 3px; top: 3px;
  transition: all 0.3s;
}
input:checked + .toggle-slider { background: var(--accent-green); }
input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ============================================================
   GRID
   ============================================================ */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.alert-success { background: rgba(0,212,170,0.1); border: 1px solid rgba(0,212,170,0.3); color: var(--accent-green); }
.alert-error { background: rgba(255,59,107,0.1); border: 1px solid rgba(255,59,107,0.3); color: var(--accent-red); }
.alert-info { background: rgba(0,102,255,0.1); border: 1px solid rgba(0,102,255,0.3); color: #60a5fa; }
.alert-warning { background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.3); color: var(--accent-yellow); }

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header { margin-bottom: 24px; }
.page-title { font-size: 24px; font-weight: 700; }
.page-desc { font-size: 14px; color: var(--text-secondary); margin-top: 4px; }

/* ============================================================
   LOADING / SPINNER
   ============================================================ */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent-green);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

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

.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(5,10,20,0.8);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
}

/* ============================================================
   PRICE CHANGE
   ============================================================ */
.price-up { color: var(--accent-green); }
.price-down { color: var(--accent-red); }
.price-neutral { color: var(--text-secondary); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .page-content { padding: 16px; }
}

/* ============================================================
   TOASTS
   ============================================================ */
#toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 250px;
  box-shadow: var(--shadow);
  animation: slideInRight 0.3s ease;
}

.toast.success { border-left: 3px solid var(--accent-green); }
.toast.error { border-left: 3px solid var(--accent-red); }
.toast.info { border-left: 3px solid var(--accent-blue); }

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ============================================================
   MARKET STATUS BAR
   ============================================================ */
.market-status-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.market-open { background: rgba(0,212,170,0.1); color: var(--accent-green); }
.market-closed { background: rgba(255,59,107,0.1); color: var(--accent-red); }

/* ============================================================
   SUBSCRIPTION LOCK STYLES
   ============================================================ */
.nav-locked {
    position: relative;
    cursor: not-allowed !important;
}

.lock-icon {
    margin-left: auto;
    font-size: 11px;
    opacity: 0.7;
}

/* Subscription lock overlay for pages */
.subscription-lock-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5,10,20,0.85);
    backdrop-filter: blur(8px);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    text-align: center;
    padding: 24px;
}

.subscription-lock-box {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 20px;
    padding: 48px 40px;
    max-width: 460px;
    width: 100%;
}

.lock-icon-big {
    font-size: 64px;
    margin-bottom: 16px;
}
