/* =========================================================
   Cyborg CRM — app.css
   Crisp flat design, Bootstrap 5 extended
   ========================================================= */

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

:root {
  --sidebar-w: 230px;
  --sidebar-collapsed-w: 56px;
  --topbar-h: 52px;

  --color-new:       #198754;
  --color-review:    #fd7e14;
  --color-approved:  #0d6efd;
  --color-declined:  #dc3545;
  --color-forwarded: #0dcaf0;
  --color-hold:      #6c757d;

  --transition: .18s ease;
}

body {
  font-family: 'DM Sans', sans-serif;
  font-size: .9rem;
}

code, .mono { font-family: 'DM Mono', monospace; }

/* ── Layout ──────────────────────────────────────────────── */
#crm-wrapper { height: 100vh; overflow: hidden; }

#sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--bs-body-bg);
  border-right: 1px solid var(--bs-border-color);
  transition: width var(--transition);
  overflow: hidden;
  flex-shrink: 0;
}

#sidebar.collapsed { width: var(--sidebar-collapsed-w); }
#sidebar.collapsed .sidebar-full-text,
#sidebar.collapsed .avatar-circle + div { display: none !important; }
#sidebar.collapsed .nav-link { justify-content: center; padding-inline: .5rem; }

.sidebar-brand { font-size: .9rem; white-space: nowrap; }

#page-content { min-width: 0; }

.topbar {
  height: var(--topbar-h);
  min-height: var(--topbar-h);
  border-bottom: 1px solid var(--bs-border-color);
  background: var(--bs-body-bg);
}

.page-body { min-height: 0; }

/* ── Sidebar nav ─────────────────────────────────────────── */
#sidebar .nav-link {
  color: var(--bs-body-color);
  border-radius: 8px;
  font-weight: 500;
  font-size: .87rem;
  display: flex;
  align-items: center;
  white-space: nowrap;
  padding: .45rem .75rem;
  transition: background var(--transition), color var(--transition);
}
#sidebar .nav-link:hover { background: var(--bs-tertiary-bg); }
#sidebar .nav-link.active {
  background: var(--bs-primary-bg-subtle);
  color: var(--bs-primary);
}
#sidebar .nav-link i { font-size: 1rem; min-width: 1.1rem; }

/* ── Avatar ──────────────────────────────────────────────── */
.avatar-circle {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--bs-primary-bg-subtle);
  color: var(--bs-primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .8rem;
  flex-shrink: 0;
}

/* ── Cards ───────────────────────────────────────────────── */
.card { border-radius: 12px; border: 1px solid var(--bs-border-color); box-shadow: 0 1px 4px rgba(0,0,0,.04); }
.card-header { background: transparent; border-bottom: 1px solid var(--bs-border-color); font-weight: 600; }

/* ── Stat cards ──────────────────────────────────────────── */
.stat-card { border-radius: 12px; padding: 1.25rem 1.5rem; position: relative; overflow: hidden; }
.stat-card .stat-icon { font-size: 2rem; opacity: .15; position: absolute; right: 1rem; top: 50%; transform: translateY(-50%); }
.stat-card .stat-value { font-size: 1.8rem; font-weight: 700; line-height: 1; }
.stat-card .stat-label { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; opacity: .7; margin-top: .25rem; }

/* ── Status badges ───────────────────────────────────────── */
.status-badge {
  display: inline-block;
  padding: .2em .65em;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .02em;
  white-space: nowrap;
}
.badge-new       { background: #d1fae5; color: #065f46; }
.badge-review    { background: #fef3c7; color: #92400e; }
.badge-approved  { background: #dbeafe; color: #1e40af; }
.badge-declined  { background: #fee2e2; color: #991b1b; }
.badge-forwarded { background: #cffafe; color: #155e75; }
.badge-hold      { background: #f3f4f6; color: #374151; }

[data-bs-theme="dark"] .badge-new       { background: #064e3b; color: #6ee7b7; }
[data-bs-theme="dark"] .badge-review    { background: #451a03; color: #fbbf24; }
[data-bs-theme="dark"] .badge-approved  { background: #1e3a8a; color: #93c5fd; }
[data-bs-theme="dark"] .badge-declined  { background: #7f1d1d; color: #fca5a5; }
[data-bs-theme="dark"] .badge-forwarded { background: #164e63; color: #67e8f9; }
[data-bs-theme="dark"] .badge-hold      { background: #1f2937; color: #9ca3af; }

/* ── Tables ──────────────────────────────────────────────── */
.table { font-size: .87rem; }
.table thead th { font-weight: 600; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; }
.table tbody tr { transition: background var(--transition); }
.table-hover tbody tr:hover { background: var(--bs-tertiary-bg); }

/* Virtual scroll container */
.leads-scroll-wrap { overflow-y: auto; max-height: calc(100vh - 280px); }

/* ── Forms ───────────────────────────────────────────────── */
.form-control, .form-select {
  border-radius: 8px;
  font-size: .88rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus, .form-select:focus {
  border-color: var(--bs-primary);
  box-shadow: 0 0 0 3px rgba(var(--bs-primary-rgb), .15);
}
.form-label { font-weight: 500; font-size: .82rem; margin-bottom: .3rem; }
.form-section-title {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--bs-secondary-color); border-bottom: 1px solid var(--bs-border-color);
  padding-bottom: .4rem; margin-bottom: 1rem; font-weight: 600;
}

/* BIN lookup pill */
.bin-status {
  display: inline-flex; align-items: center; gap: .35rem;
  background: var(--bs-primary-bg-subtle); color: var(--bs-primary);
  border-radius: 20px; padding: .2em .75em; font-size: .78rem; font-weight: 500;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn { border-radius: 8px; font-weight: 500; font-size: .87rem; }
.btn-sm { border-radius: 6px; font-size: .8rem; }

.btn-fab {
  position: fixed; bottom: 1.75rem; right: 1.75rem;
  width: 52px; height: 52px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; box-shadow: 0 4px 16px rgba(var(--bs-primary-rgb),.35);
  z-index: 1050; transition: transform .15s, box-shadow .15s;
}
.btn-fab:hover { transform: scale(1.08); box-shadow: 0 6px 20px rgba(var(--bs-primary-rgb),.45); }

/* ── Drag-drop upload ────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--bs-border-color);
  border-radius: 12px; padding: 2.5rem;
  text-align: center; cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}
.drop-zone.dragover { border-color: var(--bs-primary); background: var(--bs-primary-bg-subtle); }
.drop-zone i { font-size: 2.5rem; color: var(--bs-secondary-color); }

/* ── Progress ────────────────────────────────────────────── */
.progress { border-radius: 20px; height: 8px; }
.progress-bar { transition: width .3s ease; }

/* ── Login page ──────────────────────────────────────────── */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card { width: 100%; max-width: 400px; border-radius: 16px !important; }
.login-logo { font-size: 2rem; }

/* ── Modals ──────────────────────────────────────────────── */
.modal-content { border-radius: 14px; }
.modal-header { border-bottom: 1px solid var(--bs-border-color); }

/* ── Misc ────────────────────────────────────────────────── */
.page-header { margin-bottom: 1.5rem; }
.page-header h1 { font-size: 1.5rem; font-weight: 700; margin: 0; }

.filter-bar { background: var(--bs-tertiary-bg); border-radius: 10px; padding: 1rem; margin-bottom: 1.25rem; }

.sortable-handle { cursor: grab; color: var(--bs-secondary-color); }

.tag { display: inline-flex; align-items: center; gap: .3rem; background: var(--bs-secondary-bg);
       border-radius: 20px; padding: .15em .6em; font-size: .78rem; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  #sidebar {
    position: fixed; left: -100%; top: 0; height: 100%; z-index: 1055;
    transition: left var(--transition);
    box-shadow: 4px 0 20px rgba(0,0,0,.15);
  }
  #sidebar.mobile-open { left: 0; }
  .leads-scroll-wrap { max-height: calc(100vh - 320px); }
}

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