/* ================================================================
   LeadHub - Custom Styles
   Paletă „grafit & chihlimbar", distinctă de celelalte platforme:
   vreaucontabilitate = violet, vreaupanourisolare = verde, medorder = albastru.
   ================================================================ */

:root {
  --sidebar-width: 260px;
  --sidebar-bg: #23272b;
  --sidebar-hover: #34393f;
  --sidebar-active: #f59e0b;
  --primary: #b45309;
  --primary-light: #f59e0b;
  --ink: #3a2a12;
  --surface: #f7f4ee;
  --amber-soft: #fdf2e0;
  --amber-border: #f3ddb6;
  --top-navbar-height: 56px;
}

/* ----------------------------------------------------------------
   Layout
   ---------------------------------------------------------------- */
body {
  background: var(--surface);
  font-family: 'Segoe UI', system-ui, sans-serif;
  margin: 0;
  overflow-x: hidden;
}

.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: #fcd34d;
}

.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: var(--ink);
  margin: 0;
}

.page-header {
  border-bottom: 2px solid var(--amber-soft);
  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: #4c1d95;
  border-color: #4c1d95;
}

/* ----------------------------------------------------------------
   Rule Builder
   ---------------------------------------------------------------- */
.rule-card {
  border: 1px solid var(--amber-border);
  border-radius: 10px;
  background: #fffdf8;
  margin-bottom: 1rem;
}

.rule-card .rule-header {
  background: var(--amber-soft);
  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 var(--amber-soft);
  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, #23272b 0%, #6b3d0a 55%, #b45309 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, #23272b, #b45309);
  color: #fff;
  text-align: center;
  padding: 2rem 1.5rem;
  border-radius: 16px 16px 0 0;
}

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

/* ----------------------------------------------------------------
   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: var(--amber-soft);
  color: #7c4a11;
  border: 1px solid var(--amber-border);
  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: var(--amber-soft); }
.border-green { border-color: var(--amber-border) !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 var(--primary-light); }

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