/* ================================================================
   Lead Manager - Custom Styles
   ================================================================ */

:root {
  --sidebar-width: 260px;
  --sidebar-bg: #0B2A4A;
  --sidebar-hover: #123A63;
  --sidebar-active: #2FA866;
  --primary: #1B8A4B;
  --primary-light: #2FA866;
  --top-navbar-height: 56px;
}

/* ----------------------------------------------------------------
   Layout
   ---------------------------------------------------------------- */
body {
  background: #eeecf4;
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  margin: 0;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: #fff;
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: width 0.25s ease, transform 0.25s ease;
  overflow: hidden;
}

.sidebar.collapsed {
  width: 64px;
}

.sidebar.collapsed .sidebar-brand span,
.sidebar.collapsed .nav-link span,
.sidebar.collapsed .sidebar-footer small,
.sidebar.collapsed .sidebar-footer .btn span {
  display: none;
}

.sidebar-brand {
  padding: 1.25rem 1rem;
  font-size: 1.1rem;
  font-weight: 700;
  border-bottom: 1px solid rgba(255,255,255,.1);
  display: flex;
  align-items: center;
  white-space: nowrap;
  color: #ddd6fe;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: .5rem 0;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  padding: .65rem 1rem;
  color: rgba(255,255,255,.75);
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s, color .15s;
  border-left: 3px solid transparent;
}

.sidebar-nav .nav-link:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.sidebar-nav .nav-link.active {
  background: var(--sidebar-hover);
  color: #fff;
  border-left-color: var(--sidebar-active);
  font-weight: 600;
}

.sidebar-nav .nav-link i {
  width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid rgba(255,255,255,.1);
}

.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  transition: margin-left 0.25s ease;
}

.main-content.expanded {
  margin-left: 64px;
}

/* ----------------------------------------------------------------
   Top Navbar
   ---------------------------------------------------------------- */
.top-navbar {
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
  height: var(--top-navbar-height);
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 900;
  box-shadow: 0 2px 4px rgba(0,0,0,.06);
}

/* ----------------------------------------------------------------
   Page Header
   ---------------------------------------------------------------- */
.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #0B2A4A;
  margin: 0;
}

.page-header {
  border-bottom: 2px solid #E7F4EC;
  padding-bottom: .75rem;
}

/* ----------------------------------------------------------------
   Cards
   ---------------------------------------------------------------- */
.card {
  border: 1px solid #e8e8e8;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  border-radius: 10px;
}

.card-header {
  background: #fff;
  border-bottom: 1px solid #e8e8e8;
  font-weight: 600;
  border-radius: 10px 10px 0 0 !important;
}

/* ----------------------------------------------------------------
   Stats Cards
   ---------------------------------------------------------------- */
.stat-card {
  border-radius: 12px;
  border: none;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  transition: transform .2s, box-shadow .2s;
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,.12);
}

.stat-card .stat-icon {
  font-size: 2rem;
  opacity: .85;
}

.stat-card .stat-number {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
}

.stat-card .stat-label {
  font-size: .8rem;
  opacity: .85;
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* ----------------------------------------------------------------
   Tables
   ---------------------------------------------------------------- */
.table th {
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: #666;
  background: #f8f9fa;
  font-weight: 600;
}

.table-hover tbody tr:hover {
  background: #f7f4fd;
}

/* ----------------------------------------------------------------
   Badges
   ---------------------------------------------------------------- */
.badge {
  font-size: .75rem;
  font-weight: 500;
}

/* ----------------------------------------------------------------
   Forms
   ---------------------------------------------------------------- */
.form-label {
  font-weight: 500;
  font-size: .875rem;
  color: #444;
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 .2rem rgba(76,175,80,.2);
}

/* ----------------------------------------------------------------
   Buttons
   ---------------------------------------------------------------- */
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
}

.btn-primary:hover {
  background: #0B2A4A;
  border-color: #0B2A4A;
}

/* ----------------------------------------------------------------
   Rule Builder
   ---------------------------------------------------------------- */
.rule-card {
  border: 1px solid #CDEBD8;
  border-radius: 10px;
  background: #faf7ff;
  margin-bottom: 1rem;
}

.rule-card .rule-header {
  background: #E7F4EC;
  border-radius: 10px 10px 0 0;
  padding: .75rem 1rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.condition-row {
  display: flex;
  gap: .5rem;
  align-items: center;
  padding: .5rem .75rem;
  border-bottom: 1px solid #E7F4EC;
  flex-wrap: wrap;
}

.condition-row:last-child {
  border-bottom: none;
}

.condition-row select, .condition-row input {
  font-size: .875rem;
}

/* ----------------------------------------------------------------
   Login Page
   ---------------------------------------------------------------- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0B2A4A 0%, #1B8A4B 100%);
}

.login-card {
  width: 100%;
  max-width: 420px;
  border: none;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}

.login-card .card-header {
  background: linear-gradient(135deg, #0B2A4A, #1B8A4B);
  color: #fff;
  text-align: center;
  padding: 2rem 1.5rem;
  border-radius: 16px 16px 0 0;
}

/* ----------------------------------------------------------------
   Charts
   ---------------------------------------------------------------- */
.chart-container {
  position: relative;
  height: 310px;
}

/* ----------------------------------------------------------------
   DataTables overrides
   ---------------------------------------------------------------- */
.dataTables_wrapper .dataTables_filter input {
  border-radius: 6px;
  border: 1px solid #ced4da;
  padding: .35rem .75rem;
}

.dataTables_wrapper .dataTables_length select {
  border-radius: 6px;
}

/* ----------------------------------------------------------------
   Allocation timeline
   ---------------------------------------------------------------- */
.allocation-badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  background: #E7F4EC;
  color: #0B2A4A;
  border: 1px solid #CDEBD8;
  border-radius: 6px;
  padding: .2rem .6rem;
  font-size: .78rem;
  margin: .1rem;
}

/* ----------------------------------------------------------------
   Responsive
   ---------------------------------------------------------------- */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width) !important;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0 !important;
  }

  .stat-card .stat-number {
    font-size: 1.5rem;
  }
}

/* ----------------------------------------------------------------
   Misc
   ---------------------------------------------------------------- */
.cursor-pointer { cursor: pointer; }
.text-green { color: var(--primary); }
.bg-green-soft { background: #E7F4EC; }
.border-green { border-color: #CDEBD8 !important; }

.flash-container .alert {
  border-radius: 10px;
}

/* Lead row highlight for unallocated */
.lead-unallocated { border-left: 3px solid #ff5722; }
.lead-partial { border-left: 3px solid #ff9800; }
.lead-allocated { border-left: 3px solid #2FA866; }

.tag-pill {
  display: inline-block;
  background: #e3f2fd;
  color: #1565c0;
  border-radius: 12px;
  padding: .15rem .6rem;
  font-size: .75rem;
  margin: .1rem;
}

/* ================================================================
   DASHBOARD — tablou de bord
   Paleta pleacă din violetul barei laterale (#1B8A4B) și se ține de
   patru accente, nu de zece: fiecare culoare din pagină trebuie să
   însemne ceva. Cardurile-KPI sunt albe, cu un singur accent colorat,
   în locul degradeurilor pline de dinainte.
   ================================================================ */
:root {
  --dash-ink:      #1e1b31;
  --dash-muted:    #6b7280;
  --dash-line:     #e2dfee;
  --dash-bg-soft:  #f8f7fc;
  --dash-violet:   #1B8A4B;
  --dash-indigo:   #2563eb;
  --dash-amber:    #d97706;
  --dash-emerald:  #059669;
  --dash-rose:     #e11d48;
}

/* ---------- antetul paginii ---------- */
.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 2.25rem;
}
.page-head h1 {
  font-size: 1.3rem; font-weight: 700; letter-spacing: -.02em;
  color: var(--dash-ink); margin: 0 0 .2rem;
}
.page-head .sub { font-size: .925rem; line-height: 1.6; color: var(--dash-muted); margin: 0; }

/* ---------- bara de context ---------- */
.context-bar {
  display: flex; flex-wrap: wrap; gap: .75rem 2.25rem; align-items: center;
  background: #fff; border: 1px solid var(--dash-line); border-radius: 14px;
  padding: 1rem 1.5rem; margin-bottom: 2.5rem; font-size: .875rem;
  box-shadow: 0 1px 2px rgba(30,27,49,.05), 0 6px 16px rgba(30,27,49,.05);
}
.context-bar .item { display: inline-flex; align-items: center; gap: .5rem; color: var(--dash-muted); }
.context-bar .item strong { color: var(--dash-ink); font-weight: 600; }
.context-bar .dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.context-bar .dot.on  { background: var(--dash-emerald); box-shadow: 0 0 0 3px rgba(5,150,105,.15); }
.context-bar .dot.off { background: #9aa1ac; box-shadow: 0 0 0 3px rgba(154,161,172,.15); }

/* ---------- casetele KPI ---------- */
.kpi {
  background: #fff; border: 1px solid var(--dash-line); border-radius: 16px;
  padding: 1.6rem 1.65rem; height: 100%;
  box-shadow: 0 1px 2px rgba(30,27,49,.05), 0 6px 16px rgba(30,27,49,.05);
  transition: border-color .18s, box-shadow .18s, transform .18s;
}
.kpi:hover { border-color: #cfc7e6; box-shadow: 0 2px 4px rgba(30,27,49,.06), 0 12px 28px rgba(30,27,49,.10); transform: translateY(-2px); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.3rem; }
.kpi-icon {
  width: 42px; height: 42px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center; font-size: 1rem;
}
.kpi-icon.violet  { background: #f1eafe; color: var(--dash-violet); }
.kpi-icon.indigo  { background: #e8f0fe; color: var(--dash-indigo); }
.kpi-icon.amber   { background: #fdf2e2; color: var(--dash-amber); }
.kpi-icon.emerald { background: #e6f6f0; color: var(--dash-emerald); }
.kpi-value {
  font-size: 1.6rem; font-weight: 700; line-height: 1.05;
  letter-spacing: -.03em; color: var(--dash-ink);
}
.kpi-value .unit { font-size: .95rem; font-weight: 600; color: var(--dash-muted); margin-left: .15rem; }
.kpi-label {
  font-size: .74rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  color: var(--dash-muted); margin-top: .5rem;
}
.kpi-meta { font-size: .82rem; color: var(--dash-muted); margin-top: .9rem; line-height: 1.6; }
.kpi-meta a { color: var(--dash-violet); text-decoration: none; font-weight: 600; }
.kpi-meta a:hover { text-decoration: underline; }
.kpi-pill {
  font-size: .72rem; font-weight: 700; padding: .2rem .55rem; border-radius: 99px;
  background: var(--dash-bg-soft); color: var(--dash-muted); white-space: nowrap;
}
.kpi-pill.good { background: #e6f6f0; color: var(--dash-emerald); }
.kpi-pill.warn { background: #fdf2e2; color: var(--dash-amber); }

/* ---------- carduri de panou ---------- */
.panel {
  background: #fff; border: 1px solid var(--dash-line); border-radius: 16px; height: 100%;
  box-shadow: 0 1px 2px rgba(30,27,49,.05), 0 6px 16px rgba(30,27,49,.05);
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  flex-wrap: wrap; padding: 1.25rem 1.6rem; border-bottom: 1px solid var(--dash-line);
}
.panel-head h2 {
  font-size: .875rem; font-weight: 600; color: var(--dash-ink); margin: 0;
  display: inline-flex; align-items: center; gap: .55rem;
}
.panel-head h2 i { color: var(--dash-muted); font-size: .9rem; }
.panel-head .hint { font-size: .78rem; color: var(--dash-muted); font-weight: 400; }
.panel-body { padding: 1.6rem; }
.panel-body.flush { padding: 0; }
.panel-foot {
  padding: 1rem 1.6rem; border-top: 1px solid var(--dash-line);
  font-size: .78rem; color: var(--dash-muted); background: var(--dash-bg-soft);
  border-radius: 0 0 16px 16px;
}
.panel .table { margin-bottom: 0; }
.panel .table > thead > tr > th {
  font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--dash-muted); background: var(--dash-bg-soft);
  border-bottom: 1px solid var(--dash-line); padding: .85rem 1.6rem; white-space: nowrap;
}
.panel .table > tbody > tr > td { padding: 1rem 1.6rem; vertical-align: middle; border-color: #f3f2f8; }
.panel .table > tbody > tr:last-child > td { border-bottom: 0; }
.panel .table > tfoot > tr > th {
  padding: .9rem 1.6rem; font-size: .82rem; background: var(--dash-bg-soft); border-top: 1px solid var(--dash-line);
}

/* rang, în tabelele de top */
.rank {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 7px; font-size: .75rem; font-weight: 700;
  background: var(--dash-bg-soft); color: var(--dash-muted);
}
.rank.top { background: #f1eafe; color: var(--dash-violet); }

/* file de perioadă */
.seg { display: inline-flex; background: var(--dash-bg-soft); border: 1px solid var(--dash-line); border-radius: 10px; padding: 3px; gap: 2px; }
.seg .nav-link {
  border: 0; border-radius: 8px; padding: .4rem .85rem; font-size: .8rem; font-weight: 600;
  color: var(--dash-muted); background: transparent; line-height: 1.3;
}
.seg .nav-link:hover { color: var(--dash-ink); }
.seg .nav-link.active { background: #fff; color: var(--dash-violet); box-shadow: 0 1px 3px rgba(30,27,49,.1); }
.seg .nav-link .amt { display: block; font-size: .7rem; font-weight: 500; opacity: .75; }

/* stare goală */
.empty { text-align: center; padding: 4rem 1.5rem; color: var(--dash-muted); }
.empty i { font-size: 1.75rem; opacity: .35; display: block; margin-bottom: .6rem; }
.empty p { margin: 0 0 1.1rem; font-size: .9rem; line-height: 1.6; }

.chart-container.sm { height: 270px; }

@media (max-width: 575.98px) {
  .kpi-value { font-size: 1.35rem; }
  .page-head h1 { font-size: 1.15rem; }
}

/* Distanță între carduri mai mare decât g-4 (1,5rem): pe un fundal deschis,
   cardurile albe au nevoie de aer ca să se citească drept obiecte separate. */
.row-dash { --bs-gutter-x: 1.75rem; --bs-gutter-y: 1.75rem; }
.section-gap { margin-bottom: 1.75rem; }
@media (min-width: 1200px) {
  .row-dash { --bs-gutter-x: 2rem; --bs-gutter-y: 2rem; }
  .section-gap { margin-bottom: 2rem; }
}
