/**
 * LMS Pro — Premium Dark Theme
 * Bootstrap 5.3 + Custom
 */

/* ── Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── Variables ── */
:root {
  --bs-body-font-family: 'Inter', sans-serif;
  --app-bg:        #0f1117;
  --app-surface:   #1a1d27;
  --app-surface2:  #1f2233;
  --app-border:    rgba(255,255,255,.07);
  --app-text:      #c9cdd9;
  --app-muted:     #6b7280;
  --app-primary:   #4361ee;
  --app-secondary: #3a86ff;
  --app-accent:    #7c3aed;
  --app-success:   #2dc653;
  --app-danger:    #ef4444;
  --app-warning:   #f59e0b;
  --app-info:      #06b6d4;
  --sidebar-w:     260px;
  --navbar-h:      64px;
  --radius:        12px;
  --radius-sm:     8px;
  --shadow:        0 4px 24px rgba(0,0,0,.35);
  --shadow-sm:     0 2px 8px rgba(0,0,0,.2);
  --transition:    .2s ease;
}

/* ── Reset / Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
html, body {
  margin-top: 0 !important;
  padding-top: 0 !important;
}
body {
  background: var(--app-bg);
  color: var(--app-text);
  font-family: var(--bs-body-font-family);
  font-size: .9rem;
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: var(--app-primary); text-decoration: none; }
a:hover { color: var(--app-secondary); }

/* ── Layout ── */
.app-navbar {
  height: var(--navbar-h);
  background: var(--app-surface) !important;
  border-bottom: 1px solid var(--app-border);
  backdrop-filter: blur(12px);
  z-index: 1050; /* Higher than sidebar */
  padding: 0 1.5rem;
  box-shadow: var(--shadow-sm);
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  transform: none !important;
}
.app-navbar .navbar-brand { font-weight: 700; font-size: 1.1rem; color: #fff; }
.brand-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--app-primary), var(--app-accent));
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
}

.app-sidebar {
  width: var(--sidebar-w);
  background: var(--app-surface);
  border-right: 1px solid var(--app-border);
  height: calc(100vh - var(--navbar-h));
  position: fixed;
  top: var(--navbar-h);
  left: 0;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 1030;
  transition: transform var(--transition);
}
.app-sidebar::-webkit-scrollbar { width: 4px; }
.app-sidebar::-webkit-scrollbar-thumb { background: var(--app-border); border-radius: 2px; }

.content-wrapper {
  margin-left: var(--sidebar-w);
  margin-top: var(--navbar-h);
  min-height: calc(100vh - var(--navbar-h));
  padding: 1.75rem;
  background: var(--app-bg);
}

@media (max-width: 991.98px) {
  .app-sidebar { transform: translateX(-100%); }
  .app-sidebar.show { transform: translateX(0); }
  .content-wrapper { margin-left: 0; }
}

/* ── Sidebar Nav ── */
.sidebar-section {
  padding: .25rem .75rem;
  margin: .75rem 0 .25rem;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--app-muted);
}
.sidebar-nav .nav-link {
  display: flex; align-items: center; gap: .6rem;
  padding: .6rem 1rem;
  border-radius: var(--radius-sm);
  color: var(--app-muted);
  font-weight: 500;
  font-size: .875rem;
  margin: .1rem .5rem;
  transition: background var(--transition), color var(--transition);
}
.sidebar-nav .nav-link i { font-size: 1rem; width: 20px; text-align: center; }
.sidebar-nav .nav-link:hover { background: rgba(67,97,238,.12); color: #fff; }
.sidebar-nav .nav-link.active {
  background: linear-gradient(135deg, rgba(67,97,238,.3), rgba(124,58,237,.2));
  color: #fff;
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--app-primary);
}
.sidebar-badge {
  margin-left: auto;
  font-size: .65rem; padding: .2rem .45rem;
  border-radius: 10px; background: var(--app-danger); color: #fff;
}

/* ── Cards ── */
.card {
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  color: var(--app-text);
}
.card-header {
  background: transparent;
  border-bottom: 1px solid var(--app-border);
  padding: 1rem 1.25rem;
  font-weight: 600;
}

/* ── Stat Cards ── */
.stat-card {
  border-radius: var(--radius);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--app-border);
  transition: transform var(--transition), box-shadow var(--transition);
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.stat-card .stat-icon {
  width: 52px; height: 52px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; margin-bottom: 1rem;
}
.stat-card .stat-value { font-size: 2rem; font-weight: 800; color: #fff; }
.stat-card .stat-label { font-size: .8rem; color: var(--app-muted); font-weight: 500; text-transform: uppercase; letter-spacing: .5px; }
.stat-card .stat-trend { font-size: .8rem; margin-top: .5rem; }
.stat-card-primary { background: linear-gradient(135deg, rgba(67,97,238,.15), rgba(67,97,238,.05)); border-color: rgba(67,97,238,.2); }
.stat-card-success { background: linear-gradient(135deg, rgba(45,198,83,.15), rgba(45,198,83,.05)); border-color: rgba(45,198,83,.2); }
.stat-card-warning { background: linear-gradient(135deg, rgba(245,158,11,.15), rgba(245,158,11,.05)); border-color: rgba(245,158,11,.2); }
.stat-card-danger  { background: linear-gradient(135deg, rgba(239,68,68,.15), rgba(239,68,68,.05)); border-color: rgba(239,68,68,.2); }
.stat-card-info    { background: linear-gradient(135deg, rgba(6,182,212,.15), rgba(6,182,212,.05)); border-color: rgba(6,182,212,.2); }
.stat-card-accent  { background: linear-gradient(135deg, rgba(124,58,237,.15), rgba(124,58,237,.05)); border-color: rgba(124,58,237,.2); }

/* ── Tables / DataTables ── */
.table { color: var(--app-text); border-color: var(--app-border); }
.table thead th { background: var(--app-surface2); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .5px; color: var(--app-muted); border-color: var(--app-border); padding: .85rem 1rem; }
.table tbody tr { border-color: var(--app-border); transition: background var(--transition); }
.table tbody tr:hover { background: rgba(255,255,255,.03); }
.table td { padding: .85rem 1rem; vertical-align: middle; border-color: var(--app-border); }
table.dataTable { color: var(--app-text) !important; }
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
  background: var(--app-surface2); border: 1px solid var(--app-border);
  color: var(--app-text); border-radius: var(--radius-sm); padding: .3rem .6rem;
}
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate { color: var(--app-muted); margin-top: .75rem; }
.dataTables_wrapper .dataTables_paginate .paginate_button {
  background: var(--app-surface2) !important;
  border: 1px solid var(--app-border) !important;
  color: var(--app-text) !important;
  border-radius: var(--radius-sm) !important;
  margin: 0 2px;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: var(--app-primary) !important; color: #fff !important;
  border-color: var(--app-primary) !important;
}

/* ── Forms ── */
.form-control, .form-select {
  background: var(--app-surface2);
  border: 1px solid var(--app-border);
  color: var(--app-text);
  border-radius: var(--radius-sm);
  padding: .5rem .85rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus, .form-select:focus {
  background: var(--app-surface2);
  color: #fff;
  border-color: var(--app-primary);
  box-shadow: 0 0 0 3px rgba(67,97,238,.25);
}
.form-control::placeholder { color: var(--app-muted); }
.form-label { font-weight: 500; font-size: .85rem; margin-bottom: .35rem; }
.input-group-text {
  background: var(--app-surface2); border-color: var(--app-border); color: var(--app-muted);
}

/* ── Buttons ── */
.btn { border-radius: var(--radius-sm); font-weight: 500; font-size: .875rem; transition: all var(--transition); }
.btn-primary { background: var(--app-primary); border-color: var(--app-primary); }
.btn-primary:hover { background: #3451d1; border-color: #3451d1; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(67,97,238,.4); }
.btn-success { background: var(--app-success); border-color: var(--app-success); }
.btn-outline-primary { color: var(--app-primary); border-color: var(--app-primary); }
.btn-outline-primary:hover { background: var(--app-primary); color: #fff; }
.btn-sm { padding: .3rem .7rem; font-size: .8rem; }

/* ── Badges ── */
.badge { font-weight: 500; border-radius: 6px; }

/* ── Modals ── */
.modal-content { background: var(--app-surface); border: 1px solid var(--app-border); border-radius: var(--radius); }
.modal-header { border-bottom-color: var(--app-border); }
.modal-footer { border-top-color: var(--app-border); }
.modal-title { font-weight: 700; color: #fff; }

/* ── Pipeline / Kanban ── */
.kanban-board { display: flex; gap: 1rem; overflow-x: auto; padding-bottom: 1rem; min-height: 400px; }
.kanban-column {
  min-width: 260px; max-width: 280px; flex-shrink: 0;
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--radius);
  display: flex; flex-direction: column;
}
.kanban-col-header {
  padding: .85rem 1rem; border-radius: var(--radius) var(--radius) 0 0;
  display: flex; align-items: center; justify-content: space-between;
  font-weight: 700; font-size: .85rem; border-bottom: 1px solid var(--app-border);
}
.kanban-col-body { padding: .75rem; flex: 1; min-height: 80px; }
.kanban-card {
  background: var(--app-surface2);
  border: 1px solid var(--app-border);
  border-radius: var(--radius-sm);
  padding: .85rem;
  margin-bottom: .65rem;
  cursor: grab;
  transition: box-shadow var(--transition), transform var(--transition);
}
.kanban-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.kanban-card:active { cursor: grabbing; }
.kanban-card .lead-name { font-weight: 600; color: #fff; font-size: .85rem; }
.kanban-card .lead-meta { font-size: .75rem; color: var(--app-muted); }
.kanban-card.dragging { opacity: .5; border: 2px dashed var(--app-primary); }
.kanban-column.drag-over { border-color: var(--app-primary); background: rgba(67,97,238,.05); }

/* ── Score Pill ── */
.score-hot  { color: #ef4444; }
.score-warm { color: #f59e0b; }
.score-cold { color: #06b6d4; }

/* ── Page Header ── */
.page-header { margin-bottom: 1.5rem; }
.page-header h1 { font-size: 1.6rem; font-weight: 800; color: #fff; margin-bottom: .25rem; }
.page-header .breadcrumb { background: transparent; padding: 0; margin: 0; font-size: .8rem; }
.breadcrumb-item a { color: var(--app-muted); }
.breadcrumb-item.active { color: var(--app-text); }
.breadcrumb-item + .breadcrumb-item::before { color: var(--app-muted); }

/* ── Timeline ── */
.timeline { position: relative; padding-left: 2rem; }
.timeline::before { content:''; position:absolute; left:.6rem; top:0; bottom:0; width:2px; background: var(--app-border); }
.timeline-item { position: relative; padding-bottom: 1.25rem; }
.timeline-dot {
  position: absolute; left: -1.43rem; top: .25rem;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--app-primary); border: 2px solid var(--app-bg);
}
.timeline-time { font-size: .75rem; color: var(--app-muted); }

/* ── Lead Score Circle ── */
.score-circle {
  width: 70px; height: 70px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; font-weight: 800; border: 3px solid;
}

/* ── Toasts ── */
.toast-container { z-index: 9999; }
.toast { background: var(--app-surface); border: 1px solid var(--app-border); color: var(--app-text); border-radius: var(--radius-sm); }

/* ── Navbar user / notifications ── */
.notif-dot {
  width: 8px; height: 8px; background: var(--app-danger);
  border-radius: 50%; position: absolute; top: 0; right: 0;
}
.dropdown-menu {
  background: var(--app-surface); border: 1px solid var(--app-border);
  border-radius: var(--radius); box-shadow: var(--shadow); min-width: 200px;
}
.dropdown-item { color: var(--app-text); font-size: .875rem; padding: .5rem 1rem; transition: background var(--transition); }
.dropdown-item:hover { background: rgba(255,255,255,.05); color: #fff; }
.dropdown-divider { border-color: var(--app-border); }
.navbar-nav .nav-link { color: var(--app-muted) !important; }
.navbar-nav .nav-link:hover { color: #fff !important; }

/* ── Login page ── */
.login-page {
  min-height: 100vh;
  background: var(--app-bg);
  display: flex; align-items: center; justify-content: center;
  background-image: radial-gradient(ellipse at 20% 50%, rgba(67,97,238,.15) 0%, transparent 60%),
                    radial-gradient(ellipse at 80% 20%, rgba(124,58,237,.12) 0%, transparent 60%);
}
.login-card {
  width: 100%; max-width: 420px;
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--radius);
  padding: 2.5rem;
  box-shadow: 0 24px 64px rgba(0,0,0,.5);
}
.login-logo {
  width: 60px; height: 60px;
  background: linear-gradient(135deg, var(--app-primary), var(--app-accent));
  border-radius: 16px; margin: 0 auto 1.5rem;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.75rem;
}

/* ── Footer ── */
.app-footer {
  color: var(--app-muted); font-size: .78rem;
  border-top: 1px solid var(--app-border);
  padding: 1rem 1.75rem;
  margin-top: 2rem;
}

/* ── Utility ── */
.text-muted { color: var(--app-muted) !important; }
.border-subtle { border-color: var(--app-border) !important; }
.bg-surface { background: var(--app-surface) !important; }
.bg-surface2 { background: var(--app-surface2) !important; }
.fw-800 { font-weight: 800; }
.fs-xs { font-size: .75rem; }
.cursor-pointer { cursor: pointer; }

/* ── Animations ── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in-up { animation: fadeInUp .35s ease forwards; }

/* Chart container */
.chart-container { position: relative; height: 260px; }

/* Priority badges */
.priority-urgent { background: rgba(239,68,68,.15); color:#ef4444; border:1px solid rgba(239,68,68,.3); }
.priority-high   { background: rgba(245,158,11,.15); color:#f59e0b; border:1px solid rgba(245,158,11,.3); }
.priority-medium { background: rgba(6,182,212,.15);  color:#06b6d4; border:1px solid rgba(6,182,212,.3); }
.priority-low    { background: rgba(107,114,128,.15);color:#9ca3af; border:1px solid rgba(107,114,128,.3); }
