/* ================================================================
   NTC Dashboard – Main Stylesheet
   Native Trade Copier | VPSTrading.net
   Theme: Professional Light | Indigo/Purple Accent
================================================================ */

@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&display=swap');

/* ── CSS Variables ─────────────────────────────────────── */
:root {
  --primary:       #4f46e5;
  --primary-dark:  #3730a3;
  --primary-light: #eef2ff;
  --primary-glow:  rgba(79, 70, 229, 0.12);

  --accent:        #7c3aed;
  --accent-light:  #f5f3ff;

  --success:       #16a34a;
  --success-bg:    #f0fdf4;
  --warning:       #d97706;
  --warning-bg:    #fffbeb;
  --danger:        #dc2626;
  --danger-bg:     #fef2f2;
  --info:          #0284c7;
  --info-bg:       #f0f9ff;

  --gray-50:       #f9fafb;
  --gray-100:      #f3f4f6;
  --gray-200:      #e5e7eb;
  --gray-300:      #d1d5db;
  --gray-400:      #9ca3af;
  --gray-500:      #6b7280;
  --gray-600:      #4b5563;
  --gray-700:      #374151;
  --gray-800:      #1f2937;
  --gray-900:      #111827;

  --bg:            #f5f6fa;
  --surface:       #ffffff;
  --border:        #e5e7eb;
  --text:          #1f2937;
  --text-muted:    #6b7280;

  --sidebar-w:     240px;
  --header-h:      64px;
  --radius:        10px;
  --radius-sm:     6px;
  --radius-lg:     16px;
  --shadow-sm:     0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow:        0 4px 12px rgba(0,0,0,.08);
  --shadow-lg:     0 10px 30px rgba(0,0,0,.12);

  --font-sans:     'DM Sans', system-ui, sans-serif;
  --font-mono:     'JetBrains Mono', monospace;
  --transition:    0.2s ease;
}

/* ── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; height: auto; }
button, input, select, textarea { font-family: inherit; }

/* ── Layout ─────────────────────────────────────────────── */
.app-wrapper { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform var(--transition);
}
.sidebar-logo {
  height: var(--header-h);
  display: flex;
  align-items: center;
  padding: 0 20px;
  background: var(--primary);
  gap: 10px;
  flex-shrink: 0;
}
.sidebar-logo img { height: 32px; width: auto; object-fit: contain; filter: brightness(0) invert(1); }
.sidebar-logo span { color: #fff; font-weight: 600; font-size: 13px; letter-spacing: .3px; white-space: nowrap; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 0; }
.nav-section { padding: 16px 16px 6px; font-size: 10px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--gray-400); }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 20px;
  color: var(--gray-600);
  font-size: 14px; font-weight: 500;
  transition: all var(--transition);
  border-radius: 0;
  cursor: pointer;
  position: relative;
}
.nav-item:hover { background: var(--primary-light); color: var(--primary); }
.nav-item.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute; left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 60%;
  background: var(--primary);
  border-radius: 0 2px 2px 0;
}
.nav-item .nav-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }

.sidebar-footer { padding: 12px 20px 16px; border-top: 1px solid var(--border); }
.sidebar-user { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.sidebar-user .avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary); font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.sidebar-user .user-info { overflow: hidden; }
.sidebar-user .user-name { font-size: 13px; font-weight: 600; color: var(--gray-800); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .user-email { font-size: 11px; color: var(--gray-400); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Main Content */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Top Header */
.topbar {
  height: var(--header-h);
  background: var(--surface);
  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;
}
.topbar-title { font-size: 16px; font-weight: 600; color: var(--gray-800); }
.topbar-right { display: flex; align-items: center; gap: 12px; }

/* Page Content */
.page-content { padding: 28px 24px; flex: 1; }
.page-header { margin-bottom: 24px; }
.page-title { font-size: 22px; font-weight: 700; color: var(--gray-900); }
.page-subtitle { font-size: 14px; color: var(--text-muted); margin-top: 4px; }

/* ── Cards ──────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-size: 15px; font-weight: 600; color: var(--gray-800); }
.card-body { padding: 20px; }
.card-footer { padding: 14px 20px; border-top: 1px solid var(--border); background: var(--gray-50); border-radius: 0 0 var(--radius) var(--radius); }

/* Stat Cards */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex; align-items: flex-start; gap: 14px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow); }
.stat-icon {
  width: 44px; height: 44px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.stat-icon.blue   { background: #dbeafe; }
.stat-icon.purple { background: #ede9fe; }
.stat-icon.green  { background: #dcfce7; }
.stat-icon.yellow { background: #fef9c3; }
.stat-icon.red    { background: #fee2e2; }
.stat-body { flex: 1; }
.stat-value { font-size: 26px; font-weight: 700; color: var(--gray-900); line-height: 1.2; }
.stat-label { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ── Tables ─────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  padding: 10px 14px; text-align: left;
  font-size: 11px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase;
  color: var(--gray-500); background: var(--gray-50);
  border-bottom: 1px solid var(--border);
}
tbody td { padding: 12px 14px; border-bottom: 1px solid var(--gray-100); color: var(--gray-700); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--gray-50); }

/* ── Forms ──────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block; margin-bottom: 6px;
  font-size: 13px; font-weight: 600; color: var(--gray-700);
}
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 14px; color: var(--text);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.form-control::placeholder { color: var(--gray-400); }
.form-text { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px;
  font-size: 14px; font-weight: 600; font-family: inherit;
  border: none; border-radius: var(--radius-sm);
  cursor: pointer; transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
}
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary   { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-secondary { background: var(--gray-200); color: var(--gray-700); }
.btn-secondary:hover:not(:disabled) { background: var(--gray-300); }
.btn-success   { background: var(--success); color: #fff; }
.btn-success:hover:not(:disabled) { background: #15803d; }
.btn-danger    { background: var(--danger);  color: #fff; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }
.btn-warning   { background: var(--warning); color: #fff; }
.btn-warning:hover:not(:disabled) { background: #b45309; }
.btn-outline   { background: transparent; border: 1.5px solid var(--primary); color: var(--primary); }
.btn-outline:hover:not(:disabled) { background: var(--primary-light); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 16px; }
.btn-block { width: 100%; }
.btn-icon { padding: 8px; aspect-ratio: 1; }

/* Spinner */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
  display: none;
}
.btn.loading .spinner { display: block; }
.btn.loading .btn-text { opacity: .7; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; font-size: 11px; font-weight: 600;
  border-radius: 20px;
}
.badge-success  { background: var(--success-bg); color: var(--success); }
.badge-warning  { background: var(--warning-bg); color: var(--warning); }
.badge-danger   { background: var(--danger-bg);  color: var(--danger); }
.badge-secondary{ background: var(--gray-100);   color: var(--gray-500); }
.badge-info     { background: var(--info-bg);    color: var(--info); }

/* ── Alerts ──────────────────────────────────────────────── */
.alert {
  padding: 13px 16px; border-radius: var(--radius-sm);
  font-size: 14px; display: flex; align-items: flex-start; gap: 10px;
  margin-bottom: 16px;
}
.alert-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.alert-success  { background: var(--success-bg); color: #14532d; border-left: 3px solid var(--success); }
.alert-warning  { background: var(--warning-bg); color: #78350f; border-left: 3px solid var(--warning); }
.alert-danger   { background: var(--danger-bg);  color: #7f1d1d; border-left: 3px solid var(--danger); }
.alert-info     { background: var(--info-bg);    color: #0c4a6e; border-left: 3px solid var(--info); }

/* ── Login Page ───────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.login-page::before {
  content: '';
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.login-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  width: 100%; max-width: 420px;
  box-shadow: var(--shadow-lg);
  position: relative;
  animation: slideUp .4s ease;
}
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo img { height: 40px; }
.login-logo-fallback {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 18px; font-weight: 700; color: var(--primary);
}
.login-title { font-size: 22px; font-weight: 700; color: var(--gray-900); text-align: center; }
.login-subtitle { font-size: 13px; color: var(--text-muted); text-align: center; margin-top: 4px; margin-bottom: 28px; }
.login-divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.login-footer { text-align: center; font-size: 13px; color: var(--text-muted); margin-top: 20px; }

/* ── Modal ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  animation: fadeIn .2s ease;
}
.modal-overlay.hidden { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface); border-radius: var(--radius);
  width: 100%; max-width: 500px;
  box-shadow: var(--shadow-lg);
  animation: slideUp .25s ease;
  max-height: 90vh; overflow-y: auto;
}
.modal-header {
  padding: 18px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 16px; font-weight: 600; }
.modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--gray-400); font-size: 20px; line-height: 1;
  transition: color var(--transition);
}
.modal-close:hover { color: var(--gray-700); }
.modal-body { padding: 20px; }
.modal-footer { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ── Code / API URL box ────────────────────────────────── */
.code-box {
  background: var(--gray-900); color: #e2e8f0;
  font-family: var(--font-mono); font-size: 13px;
  padding: 14px 16px; border-radius: var(--radius-sm);
  white-space: pre-wrap; word-break: break-all;
  position: relative;
}
.code-box .copy-btn {
  position: absolute; top: 8px; right: 8px;
  background: var(--gray-700); color: #cbd5e1;
  border: none; padding: 4px 10px; border-radius: 4px;
  font-size: 11px; cursor: pointer; font-family: var(--font-sans);
  transition: all var(--transition);
}
.code-box .copy-btn:hover { background: var(--primary); color: #fff; }
.api-endpoint-label { font-size: 11px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--text-muted); margin-bottom: 6px; }

/* ── Lang switcher ───────────────────────────────────────── */
.lang-switcher { display: flex; gap: 4px; }
.lang-btn {
  padding: 4px 10px; font-size: 12px; font-weight: 600;
  border: 1.5px solid var(--border); border-radius: 20px;
  background: var(--surface); color: var(--text-muted);
  cursor: pointer; transition: all var(--transition);
  text-decoration: none;
}
.lang-btn.active, .lang-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

/* ── Mobile toggle ───────────────────────────────────────── */
.sidebar-toggle {
  display: none;
  background: none; border: none; cursor: pointer;
  font-size: 22px; color: var(--gray-600); padding: 4px;
}

/* ── Pagination ──────────────────────────────────────────── */
.pagination { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.page-link {
  padding: 6px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 13px; font-weight: 500;
  color: var(--text-muted); background: var(--surface);
  text-decoration: none; transition: all var(--transition);
}
.page-link:hover, .page-link.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── Filter tabs ─────────────────────────────────────────── */
.filter-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.filter-tab {
  padding: 6px 14px; border-radius: 20px;
  font-size: 13px; font-weight: 500;
  background: var(--gray-100); color: var(--text-muted);
  cursor: pointer; text-decoration: none;
  transition: all var(--transition);
}
.filter-tab:hover, .filter-tab.active { background: var(--primary); color: #fff; }

/* ── Empty state ─────────────────────────────────────────── */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ── Toast notification ──────────────────────────────────── */
#toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--gray-900); color: #fff;
  padding: 12px 18px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow);
  animation: slideIn .3s ease;
  min-width: 200px;
}
.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* ── OTP input ───────────────────────────────────────────── */
.otp-input {
  width: 100%; text-align: center; letter-spacing: 12px;
  font-size: 28px; font-weight: 700; font-family: var(--font-mono);
  padding: 14px; border: 2px solid var(--border); border-radius: var(--radius-sm);
}
.otp-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); outline: none; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-240px); width: 240px; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .sidebar-toggle { display: block; }
  .sidebar-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 99;
  }
  .sidebar-overlay.active { display: block; }
  .form-row { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 540px) {
  .page-content { padding: 16px; }
  .login-card { padding: 28px 20px; }
  .stat-grid { grid-template-columns: 1fr; }
  .topbar { padding: 0 16px; }
}
