/* ============================================
   Digital Hook CRM — Styles
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&display=swap');

:root {
  --bg: #0a0a0f;
  --surface: #12121a;
  --surface-hover: #1a1a26;
  --card: #16161f;
  --border: #1e1e2e;
  --border-light: #2a2a3a;
  --text: #e4e4ed;
  --text-muted: #8888a0;
  --text-dim: #55556a;
  --accent: #6366f1;
  --accent-glow: rgba(99,102,241,0.15);
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --pink: #ec4899;
  --font: 'DM Sans', 'Segoe UI', system-ui, sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

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

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-brand { display: flex; align-items: center; gap: 10px; }
.topbar-logo {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--pink));
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 800; color: #fff;
}
.topbar-name { font-size: 15px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.topbar-sub { font-size: 10px; color: var(--text-dim); letter-spacing: 0.08em; text-transform: uppercase; }

.search-box {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg); border-radius: 10px; padding: 4px 12px;
  border: 1px solid var(--border); flex: 0 1 320px;
}
.search-box input {
  background: none; border: none; outline: none; color: var(--text);
  font-size: 13px; width: 100%; padding: 6px 0; font-family: var(--font);
}
.search-icon { color: var(--text-dim); font-size: 14px; }

.topbar-actions { display: flex; align-items: center; gap: 8px; }

.main-layout { display: flex; flex: 1; min-height: 0; }

/* ─── Sidebar ─── */
.sidebar {
  width: 200px; background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 12px 8px; display: flex; flex-direction: column; gap: 2px;
  position: sticky; top: 57px; height: calc(100vh - 57px); overflow-y: auto;
}

.nav-item {
  background: transparent; border: 1px solid transparent;
  border-radius: 8px; padding: 10px 12px; cursor: pointer;
  display: flex; align-items: center; gap: 10px; width: 100%;
  color: var(--text-muted); font-size: 13px; font-weight: 400;
  font-family: var(--font); transition: all 0.15s;
}
.nav-item:hover { background: var(--surface-hover); }
.nav-item.active {
  background: var(--accent-glow); border-color: rgba(99,102,241,0.2);
  color: var(--accent); font-weight: 600;
}
.nav-icon { font-size: 16px; width: 20px; text-align: center; }
.nav-label { flex: 1; text-align: left; }
.nav-count {
  font-size: 11px; border-radius: 10px; padding: 1px 7px; font-weight: 600;
  background: var(--border-light); color: var(--text-muted);
}
.nav-item.active .nav-count { background: var(--accent); color: #fff; }

.sidebar-footer {
  margin-top: auto; padding: 12px 8px; border-top: 1px solid var(--border);
}
.sidebar-footer button {
  background: none; border: none; color: var(--text-dim);
  font-size: 11px; cursor: pointer; font-family: var(--font); padding: 4px 0;
}

/* ─── Content ─── */
.content { flex: 1; overflow-y: auto; padding: 20px; }

/* ─── Cards & Stat Cards ─── */
.stat-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.stat-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 16px 18px; flex: 1 1 160px; min-width: 140px;
}
.stat-label {
  font-size: 11px; color: var(--text-dim); text-transform: uppercase;
  letter-spacing: 0.06em; margin-bottom: 6px;
}
.stat-value { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.stat-sub { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 16px; margin-bottom: 16px;
}

/* ─── Section Header ─── */
.section-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px;
}
.section-title { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.section-count {
  font-size: 12px; background: var(--border-light); color: var(--text-muted);
  border-radius: 10px; padding: 2px 8px; font-weight: 600; margin-left: 10px;
}

/* ─── Buttons ─── */
.btn {
  font-family: var(--font); font-size: 13px; font-weight: 600;
  border: none; border-radius: 8px; cursor: pointer;
  padding: 8px 16px; transition: all 0.15s;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-sm { font-size: 12px; padding: 5px 10px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #5558e6; }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface-hover); }
.btn-danger { background: rgba(239,68,68,0.1); color: var(--danger); border: 1px solid rgba(239,68,68,0.2); }
.btn-success { background: rgba(16,185,129,0.1); color: var(--success); border: 1px solid rgba(16,185,129,0.2); }

/* ─── Badges ─── */
.badge {
  font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 6px;
  white-space: nowrap; display: inline-block;
}

/* ─── List Items ─── */
.list-item {
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 16px; cursor: pointer; display: flex; align-items: center;
  gap: 12px; transition: all 0.15s; margin-bottom: 4px;
}
.list-item:hover { background: var(--surface-hover); }
.list-item-name { font-size: 13px; font-weight: 600; }
.list-item-sub { font-size: 11px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.avatar {
  width: 36px; height: 36px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700;
}

/* ─── Filters ─── */
.filter-bar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.filter-group {
  display: flex; gap: 4px; background: var(--card);
  border-radius: 8px; padding: 3px; border: 1px solid var(--border);
}
.filter-btn {
  font-size: 11px; font-weight: 500; padding: 4px 10px;
  border-radius: 6px; border: none; cursor: pointer;
  font-family: var(--font); background: transparent;
  color: var(--text-muted); transition: all 0.15s;
}
.filter-btn.active { background: var(--accent); color: #fff; }

/* ─── Forms ─── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.field { margin-bottom: 14px; }
.field-label {
  font-size: 11px; color: var(--text-dim); text-transform: uppercase;
  letter-spacing: 0.06em; display: block; margin-bottom: 4px;
}
.field-input, .field-select, .field-textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 12px; color: var(--text);
  font-size: 13px; font-family: var(--font); outline: none;
}
.field-input:focus, .field-select:focus, .field-textarea:focus {
  border-color: var(--accent);
}
.field-textarea { resize: vertical; min-height: 72px; }
.field-full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }

/* ─── Modal ─── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px); display: flex;
  align-items: center; justify-content: center;
  z-index: 1000; padding: 20px;
}
.modal-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; max-width: 540px; width: 100%;
  max-height: 85vh; overflow-y: auto; padding: 24px;
}
.modal-title { font-size: 16px; font-weight: 700; margin-bottom: 16px; }

/* ─── Empty State ─── */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-dim); }
.empty-icon { font-size: 40px; margin-bottom: 12px; }
.empty-title { font-size: 15px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.empty-sub { font-size: 12px; margin-bottom: 16px; }

/* ─── Login ─── */
.login-wrapper {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 20px;
}
.login-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 40px; max-width: 400px; width: 100%;
}
.login-logo { display: flex; justify-content: center; margin-bottom: 20px; }
.login-title { text-align: center; font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.login-sub { text-align: center; font-size: 13px; color: var(--text-muted); margin-bottom: 24px; }
.login-error { color: var(--danger); font-size: 12px; text-align: center; margin-bottom: 12px; }

/* ─── Pipeline mini bars ─── */
.pipeline-row { display: flex; gap: 4px; }
.pipeline-col { text-align: center; flex: 1; min-width: 32px; }
.pipeline-bar {
  height: 28px; border-radius: 6px; display: flex;
  align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
}
.pipeline-label { font-size: 9px; color: var(--text-dim); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.04em; }

/* ─── Detail View ─── */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; font-size: 12px; color: var(--text-muted); }
.detail-grid span { display: block; }
.detail-actions { display: flex; gap: 6px; margin-top: 16px; flex-wrap: wrap; }

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .topbar { padding: 10px 14px; }
  .search-box { flex: 1; }
  .content { padding: 14px; }
  .form-grid { grid-template-columns: 1fr; }
  .stat-card { min-width: 120px; }
  .detail-grid { grid-template-columns: 1fr; }

  /* Mobile nav */
  .mobile-nav {
    display: flex !important;
    position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--surface); border-top: 1px solid var(--border);
    padding: 6px 4px; z-index: 100; justify-content: space-around;
  }
  .mobile-nav-item {
    background: none; border: none; cursor: pointer;
    color: var(--text-dim); font-size: 10px; text-align: center;
    padding: 4px 8px; font-family: var(--font);
  }
  .mobile-nav-item.active { color: var(--accent); }
  .mobile-nav-icon { font-size: 18px; display: block; margin-bottom: 2px; }

  .content { padding-bottom: 70px; }
}

.mobile-nav { display: none; }

/* ─── Checkbox ─── */
input[type="checkbox"] { accent-color: var(--accent); cursor: pointer; }

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ─── Priority bar ─── */
.prio-bar { width: 4px; height: 24px; border-radius: 2px; flex-shrink: 0; }

/* ─── Animations ─── */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.content > * { animation: fadeIn 0.2s ease; }
.modal-box { animation: fadeIn 0.15s ease; }
