/* =====================================================
   MARKETER STREAD — Premium Dark Dashboard UI
   ===================================================== */

/* ─── Google Fonts ─────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* ─── CSS Variables ────────────────────────────────── */
:root {
  /* Colors */
  --bg-base:        #0b0e1a;
  --bg-surface:     #111627;
  --bg-card:        #161d32;
  --bg-card-hover:  #1b2540;
  --bg-input:       #0e1526;
  --bg-sidebar:     #0d1124;

  --accent:         #4f76ff;
  --accent-light:   #7099ff;
  --accent-dim:     rgba(79,118,255,0.12);
  --accent-glow:    rgba(79,118,255,0.35);

  --success:        #22d3a8;
  --success-dim:    rgba(34,211,168,0.12);
  --warning:        #f59e0b;
  --warning-dim:    rgba(245,158,11,0.12);
  --danger:         #f43f5e;
  --danger-dim:     rgba(244,63,94,0.12);
  --info:           #38bdf8;
  --info-dim:       rgba(56,189,248,0.12);

  --text-primary:   #e8eaf6;
  --text-secondary: #8892b0;
  --text-muted:     #4a5568;
  --text-accent:    #7099ff;

  --border:         rgba(255,255,255,0.06);
  --border-accent:  rgba(79,118,255,0.3);

  /* Sizing */
  --sidebar-w:      260px;
  --topbar-h:       64px;
  --radius-sm:      8px;
  --radius-md:      12px;
  --radius-lg:      16px;
  --radius-xl:      20px;

  /* Shadows */
  --shadow-sm:  0 2px 8px rgba(0,0,0,0.3);
  --shadow-md:  0 4px 20px rgba(0,0,0,0.4);
  --shadow-lg:  0 8px 40px rgba(0,0,0,0.5);
  --shadow-glow:0 0 20px var(--accent-glow);

  /* Transitions */
  --transition: 0.2s cubic-bezier(0.4,0,0.2,1);
}

/* ─── Reset ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; }
ul { list-style: none; }

/* ─── Scrollbar ────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-dim); }

/* ─── Background Grid ──────────────────────────────── */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: -1;
  background-image:
    linear-gradient(rgba(79,118,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79,118,255,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
}

/* ─── Layout ───────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }

/* ─── Sidebar ──────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-logo {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-logo .logo-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  box-shadow: 0 0 16px var(--accent-glow);
  flex-shrink: 0;
}
.sidebar-logo .logo-text { font-size: 15px; font-weight: 700; line-height: 1.2; }
.sidebar-logo .logo-text span { display: block; font-size: 11px; font-weight: 400; color: var(--text-secondary); }

.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }

.nav-section-title {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 12px 8px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: 2px;
  position: relative;
}
.nav-item:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}
.nav-item.active {
  background: var(--accent-dim);
  color: var(--accent-light);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: var(--accent);
  border-radius: 0 4px 4px 0;
}
.nav-item .nav-icon {
  width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.nav-item .nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
  min-width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border);
}
.userbot-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.userbot-badge .avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; flex-shrink: 0;
}
.userbot-badge .info { flex: 1; overflow: hidden; }
.userbot-badge .info .name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.userbot-badge .info .status-label { font-size: 11px; color: var(--text-secondary); }
.status-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  animation: pulse-dot 2s infinite;
}
.status-dot.online  { background: var(--success); box-shadow: 0 0 8px var(--success); }
.status-dot.offline { background: var(--text-muted); animation: none; }
@keyframes pulse-dot { 0%,100% { opacity:1; } 50% { opacity:0.4; } }

/* ─── Main Content ─────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ─── Topbar ───────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: rgba(17,22,39,0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar .page-title { font-size: 18px; font-weight: 700; flex: 1; }
.topbar .page-title span { font-size: 13px; font-weight: 400; color: var(--text-secondary); display: block; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.topbar-badge {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-secondary);
}
.topbar-badge.connected { border-color: var(--success); color: var(--success); }

/* ─── Page Content ─────────────────────────────────── */
.page-content {
  flex: 1;
  padding: 28px;
  display: none;
}
.page-content.active { display: block; }

/* ─── Cards ────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.card:hover { border-color: var(--border-accent); }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.card-title {
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-title .icon {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
}

/* ─── Stat Cards ───────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}
.stat-card.blue::before   { background: linear-gradient(90deg, var(--accent), #7c3aed); }
.stat-card.green::before  { background: linear-gradient(90deg, var(--success), #059669); }
.stat-card.orange::before { background: linear-gradient(90deg, var(--warning), #d97706); }
.stat-card.red::before    { background: linear-gradient(90deg, var(--danger), #c2185b); }
.stat-card.cyan::before   { background: linear-gradient(90deg, var(--info), #0284c7); }

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-accent); }
.stat-card .stat-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  margin-bottom: 14px;
}
.stat-card.blue   .stat-icon { background: var(--accent-dim); }
.stat-card.green  .stat-icon { background: var(--success-dim); }
.stat-card.orange .stat-icon { background: var(--warning-dim); }
.stat-card.red    .stat-icon { background: var(--danger-dim); }
.stat-card.cyan   .stat-icon { background: var(--info-dim); }
.stat-card .stat-value { font-size: 28px; font-weight: 800; line-height: 1; margin-bottom: 4px; }
.stat-card .stat-label { font-size: 13px; color: var(--text-secondary); }

/* ─── Grid Layouts ─────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 20px; }

/* ─── Buttons ──────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  border: none;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 12px var(--accent-glow);
}
.btn-primary:hover { background: var(--accent-light); transform: translateY(-1px); box-shadow: 0 0 20px var(--accent-glow); }
.btn-success { background: var(--success); color: #0b0e1a; }
.btn-success:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-danger:hover  { filter: brightness(1.1); transform: translateY(-1px); }
.btn-warning { background: var(--warning); color: #0b0e1a; }
.btn-warning:hover { filter: brightness(1.1); }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 14px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-icon { padding: 8px; min-width: 36px; justify-content: center; }

/* ─── Forms ────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 7px; }
.form-control {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 10px 14px;
  font-size: 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.form-control::placeholder { color: var(--text-muted); }
textarea.form-control { resize: vertical; min-height: 100px; font-family: inherit; }
select.form-control { cursor: pointer; }

.input-group { display: flex; gap: 10px; }
.input-group .form-control { flex: 1; }

/* ─── Table ────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: middle;
}
table tr:last-child td { border-bottom: none; }
table tr:hover td { background: var(--bg-card-hover); color: var(--text-primary); }
table td strong { color: var(--text-primary); font-weight: 600; }
.table-actions { display: flex; gap: 6px; }

/* ─── Badges / Pills ───────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.badge-success { background: var(--success-dim); color: var(--success); }
.badge-danger  { background: var(--danger-dim);  color: var(--danger); }
.badge-warning { background: var(--warning-dim); color: var(--warning); }
.badge-info    { background: var(--info-dim);    color: var(--info); }
.badge-accent  { background: var(--accent-dim);  color: var(--accent-light); }
.badge-muted   { background: rgba(255,255,255,0.05); color: var(--text-muted); }

/* ─── Progress Bar ─────────────────────────────────── */
.progress-wrap { margin-bottom: 8px; }
.progress-info { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; }
.progress-bar-bg {
  height: 6px;
  background: var(--bg-input);
  border-radius: 99px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), var(--success));
  transition: width 0.3s ease;
}

/* ─── Console / Log Box ────────────────────────────── */
.log-box {
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  line-height: 1.8;
  max-height: 280px;
  overflow-y: auto;
  color: var(--text-secondary);
}
.log-entry { display: flex; gap: 10px; }
.log-entry .ts { color: var(--text-muted); flex-shrink: 0; }
.log-entry.success .msg { color: var(--success); }
.log-entry.error   .msg { color: var(--danger); }
.log-entry.warning .msg { color: var(--warning); }
.log-entry.info    .msg { color: var(--info); }

/* ─── Modal ────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity var(--transition);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: min(500px, 95vw);
  box-shadow: var(--shadow-lg);
  transform: scale(0.95) translateY(10px);
  transition: transform var(--transition);
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }
.modal-header {
  padding: 24px 24px 0;
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 16px; font-weight: 700; }
.modal-close {
  background: none; border: none; color: var(--text-muted);
  font-size: 20px; cursor: pointer;
  transition: color var(--transition);
}
.modal-close:hover { color: var(--text-primary); }
.modal-body { padding: 20px 24px; }
.modal-footer { padding: 0 24px 24px; display: flex; justify-content: flex-end; gap: 10px; }

/* ─── Alert / Toast ────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 999;
  display: flex; flex-direction: column; gap: 10px;
}
.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex; align-items: center; gap: 12px;
  min-width: 280px; max-width: 380px;
  box-shadow: var(--shadow-md);
  animation: toast-in 0.3s ease;
  font-size: 13px;
}
.toast.success { border-color: var(--success); }
.toast.error   { border-color: var(--danger); }
.toast.warning { border-color: var(--warning); }
@keyframes toast-in { from { transform: translateX(120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ─── Checkbox ─────────────────────────────────────── */
.checkbox-wrap {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer;
}
input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ─── Pagination ───────────────────────────────────── */
.pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 6px; margin-top: 20px;
}
.page-btn {
  width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
}
.page-btn:hover, .page-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ─── Upload Zone ──────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-muted);
}
.upload-zone:hover, .upload-zone.drag { border-color: var(--accent); background: var(--accent-dim); color: var(--accent); }
.upload-zone .upload-icon { font-size: 32px; margin-bottom: 10px; }
.upload-zone p { font-size: 13px; }
.upload-zone input[type="file"] { display: none; }

/* ─── Empty State ──────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 14px; opacity: 0.5; }
.empty-state p { font-size: 14px; }

/* ─── Login Screen ─────────────────────────────────── */
#login-screen {
  position: fixed; inset: 0;
  background: var(--bg-base);
  z-index: 500;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.login-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px;
  width: min(440px, 100%);
  text-align: center;
  box-shadow: var(--shadow-lg), 0 0 60px rgba(79,118,255,0.1);
}
.login-logo {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  margin: 0 auto 20px;
  box-shadow: var(--shadow-glow);
}
.login-box h2 { font-size: 22px; font-weight: 800; margin-bottom: 6px; }
.login-box p  { font-size: 13px; color: var(--text-secondary); margin-bottom: 28px; }
.otp-inputs { display: flex; gap: 10px; justify-content: center; margin-bottom: 20px; }
.otp-inputs input {
  width: 48px; height: 56px;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  outline: none;
}
.otp-inputs input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }

/* ─── Animations ───────────────────────────────────── */
@keyframes fadeIn    { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:translateY(0); } }
@keyframes spin      { to { transform: rotate(360deg); } }
@keyframes shimmer   {
  0%   { background-position: -1000px 0; }
  100% { background-position:  1000px 0; }
}
.animate-in   { animation: fadeIn 0.3s ease; }
.spin         { animation: spin 0.8s linear infinite; }
.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
  background-size: 1000px 100%;
  animation: shimmer 2s infinite;
  border-radius: 4px;
}

/* ─── Responsive ───────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .stats-grid { grid-template-columns: 1fr; }
  .page-content { padding: 16px; }
}
