/* ============================================================
   Leads — Refined Glass Design
   ============================================================ */

/* ---------- Filter Bar ---------- */
.leads-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  padding: 0.85rem 1.15rem;
  border: 1px solid var(--border, #E1E5EF);
  border-radius: 14px;
  background: var(--bg-card, #fff);
  box-shadow: 0 1px 4px rgba(22, 34, 56, 0.03);
  animation: appFadeUp 0.5s 0.08s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

.leads-filter-bar .form-select {
  width: auto;
  min-width: 140px;
  border-radius: 8px;
  font-size: 0.82rem;
  border-color: rgba(var(--primary-rgb, 215, 25, 32), 0.12);
  transition: all 0.2s ease;
}

.leads-filter-bar .form-select:focus {
  border-color: var(--color-primary, #D71920);
  box-shadow: 0 0 0 3px rgba(215, 25, 32, 0.12);
}

.leads-filter-bar .btn {
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.8rem;
}

/* ---------- Table ---------- */
.leads-table {
  font-size: 0.84rem;
}

.leads-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
}

.leads-table th {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted, #6B7280);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  padding: 0.65rem 0.6rem;
  border-bottom: 2px solid rgba(var(--primary-rgb, 215, 25, 32), 0.10);
  background: var(--bg-body, #F6F7FB);
}

.leads-table td {
  vertical-align: middle;
  padding: 0.6rem;
  border-bottom: 1px solid rgba(var(--primary-rgb, 215, 25, 32), 0.04);
}

.leads-table tbody tr {
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.leads-table tbody tr:hover {
  background: rgba(var(--primary-rgb, 215, 25, 32), 0.04);
  transform: scale(1.002);
}

.leads-table tbody tr:active {
  transform: scale(0.998);
}

/* Table wrapper card */
#leadsTableWrap {
  animation: appFadeUp 0.5s 0.15s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

#leadsTableWrap .table-responsive {
  border: 1px solid var(--border, #E1E5EF);
  border-radius: 14px;
  overflow: hidden;
  background: var(--bg-card, #fff);
  box-shadow: 0 1px 4px rgba(22, 34, 56, 0.03);
}

/* ---------- Score Bar (enhanced) ---------- */
.score-bar-wrap {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.score-bar {
  width: 56px;
  height: 7px;
  background: rgba(var(--primary-rgb, 215, 25, 32), 0.06);
  border-radius: 999px;
  overflow: hidden;
}

.score-bar__fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.6s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.score-bar__fill--high {
  background: linear-gradient(90deg, var(--color-success, #2D8F6F), #3da882);
}
.score-bar__fill--mid {
  background: linear-gradient(90deg, var(--color-warning, #B7791F), #e8be6e);
}
.score-bar__fill--low {
  background: linear-gradient(90deg, var(--color-danger, #D2555A), #df7174);
}

.score-label {
  font-weight: 700;
  font-size: 0.8rem;
  min-width: 28px;
  text-align: right;
  letter-spacing: -0.02em;
}

.score-label--high { color: var(--color-success, #2D8F6F); }
.score-label--mid { color: var(--color-warning, #B7791F); }
.score-label--low { color: var(--color-danger, #D2555A); }

/* ---------- Service Tags ---------- */
.service-tag {
  display: inline-block;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  background: rgba(var(--primary-rgb, 215, 25, 32), 0.06);
  color: var(--color-primary, #D71920);
  font-size: 0.7rem;
  font-weight: 600;
  margin-right: 0.2rem;
  margin-bottom: 0.15rem;
  border: 1px solid rgba(var(--primary-rgb, 215, 25, 32), 0.08);
  transition: all 0.15s ease;
}

.service-tag:hover {
  background: rgba(var(--primary-rgb, 215, 25, 32), 0.10);
}

/* ---------- Pagination ---------- */
#paginationNav {
  padding: 0.75rem 0;
}

.pagination .page-link {
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 500;
  margin: 0 0.1rem;
  border-color: rgba(var(--primary-rgb, 215, 25, 32), 0.10);
  color: var(--text-sub, #4B5565);
  transition: all 0.2s ease;
}

.pagination .page-link:hover {
  background: rgba(var(--primary-rgb, 215, 25, 32), 0.06);
  color: var(--color-primary, #D71920);
  transform: translateY(-1px);
}

.pagination .page-item.active .page-link {
  background: linear-gradient(135deg, var(--color-primary, #D71920), var(--color-primary-dark, #A80F15));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 2px 8px rgba(215, 25, 32, 0.2);
}

/* ---------- Stage History Timeline (Drawer) ---------- */
.offcanvas {
  border-left: 1px solid var(--border, #E1E5EF);
  box-shadow: -8px 0 32px rgba(22, 34, 56, 0.08);
}

.offcanvas-header {
  border-bottom: 1px solid rgba(var(--primary-rgb, 215, 25, 32), 0.08);
  padding: 1.15rem 1.35rem;
}

.offcanvas-title {
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.01em;
}

.stage-timeline {
  position: relative;
  padding-left: 1.75rem;
}

.stage-timeline::before {
  content: '';
  position: absolute;
  left: 0.55rem;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: linear-gradient(to bottom, rgba(var(--primary-rgb, 215, 25, 32), 0.15), rgba(var(--accent-rgb, 255, 201, 40), 0.16));
  border-radius: 2px;
}

.stage-timeline-item {
  position: relative;
  padding-bottom: 1.35rem;
  animation: appSlideRight 0.4s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

.stage-timeline-item:nth-child(1) { animation-delay: 0.05s; }
.stage-timeline-item:nth-child(2) { animation-delay: 0.10s; }
.stage-timeline-item:nth-child(3) { animation-delay: 0.15s; }
.stage-timeline-item:nth-child(4) { animation-delay: 0.20s; }
.stage-timeline-item:nth-child(5) { animation-delay: 0.25s; }

.stage-timeline-item:last-child {
  padding-bottom: 0;
}

.stage-timeline-dot {
  position: absolute;
  left: -1.45rem;
  top: 0.2rem;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2.5px solid var(--bg-card, #fff);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.05);
}

.stage-timeline-dot--inquiry { background: var(--color-primary, #D71920); }
.stage-timeline-dot--consideration { background: var(--color-info, #B7791F); }
.stage-timeline-dot--appointment { background: var(--color-warning, #B7791F); }
.stage-timeline-dot--closed { background: var(--color-success, #2D8F6F); }
.stage-timeline-dot--lost { background: var(--color-danger, #D2555A); }

.stage-timeline-title {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text-main, #1E2430);
  letter-spacing: -0.01em;
}

.stage-timeline-reason {
  font-size: 0.82rem;
  color: var(--text-sub, #4B5565);
  margin-top: 0.1rem;
  line-height: 1.4;
}

.stage-timeline-date {
  font-size: 0.72rem;
  color: var(--text-muted, #6B7280);
  margin-top: 0.15rem;
}

/* ---------- Drawer Lead Info ---------- */
.drawer-lead-info {
  padding: 0.85rem 1.1rem;
  background: rgba(var(--primary-rgb, 215, 25, 32), 0.03);
  border: 1px solid rgba(var(--primary-rgb, 215, 25, 32), 0.06);
  border-radius: 12px;
  margin-bottom: 1.25rem;
}

.drawer-lead-info dt {
  font-size: 0.72rem;
  color: var(--text-muted, #6B7280);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.1rem;
}

.drawer-lead-info dd {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main, #1E2430);
  margin-bottom: 0.65rem;
}

.drawer-lead-info dd:last-child {
  margin-bottom: 0;
}

/* ---------- Responsive ---------- */
@media (max-width: 767.98px) {
  .leads-filter-bar .form-select {
    min-width: 0;
    flex: 1;
  }
  #leadsTableWrap .table-responsive {
    border-radius: 10px;
  }
}
