/* ============================================================
   ZYRA CRM — Módulo de Leads
   ============================================================ */

/* ── Score badges ── */
.badge-score-a { background: #d1f5ea; color: #0d6b4a; }
.badge-score-b { background: #fef3c7; color: #92400e; }
.badge-score-c { background: #f3f4f6; color: #4b5563; }

/* ── Status badges leads ── */
.badge-blue      { background: #dbeafe; color: #1d4ed8; }
.badge-yellow    { background: #fef3c7; color: #92400e; }
.badge-red       { background: #fee2e2; color: #991b1b; }
.badge-green-dark{ background: #dcfce7; color: #14532d; }

/* ── Condición tag ── */
.cond-tag {
  display: inline-block;
  padding: .15em .55em;
  border-radius: 6px;
  font-size: .8rem;
  font-weight: 500;
}

/* ── Toolbar ── */
.leads-wrap { position: relative; }

.leads-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem;
  margin-bottom: 1rem;
}

.leads-toolbar-actions {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}

.leads-toolbar-search {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}

.leads-toolbar-search input {
  padding: .45rem .85rem;
  font-size: .9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  background: var(--surface);
  width: 260px;
}

.leads-counter {
  font-size: .85rem;
  color: var(--muted);
  white-space: nowrap;
}

/* ── Filter bar ── */
.leads-filters {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
  padding: .85rem 1rem;
  margin-bottom: 1rem;
}

.leads-filters select {
  padding: .4rem .7rem;
  font-size: .85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  background: var(--surface);
  max-width: 180px;
}

/* ── Table ── */
.table-scroll { overflow-x: auto; }

.lead-phone { font-size: .8rem; color: var(--muted); }

.fuente-cell { font-size: .85rem; white-space: nowrap; }

.agent-cell { max-width: 120px; }

.acciones-cell { white-space: nowrap; }

.btn-accion {
  background: none;
  border: none;
  cursor: pointer;
  padding: .25rem .35rem;
  border-radius: 4px;
  font-size: 1rem;
  transition: background .12s;
}
.btn-accion:hover { background: var(--bg); }

/* ── Bulk bar (fija en bottom) ── */
.leads-bulk-bar {
  position: fixed;
  bottom: 0;
  left: 220px;
  right: 0;
  background: var(--sidebar);
  color: #fff;
  padding: .85rem 2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  z-index: 400;
  box-shadow: 0 -2px 12px rgba(0,0,0,.18);
}

.leads-bulk-bar select {
  padding: .35rem .65rem;
  font-size: .85rem;
  border: 1px solid rgba(255,255,255,.3);
  border-radius: var(--radius);
  font-family: inherit;
  background: rgba(255,255,255,.12);
  color: #fff;
}
.leads-bulk-bar select option { color: var(--text); background: #fff; }

.bulk-actions {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  align-items: center;
}

/* ── Pagination ── */
.leads-paginacion { margin-top: 1rem; padding-bottom: 4rem; }

.paginacion {
  display: flex;
  gap: .35rem;
  justify-content: center;
  flex-wrap: wrap;
}

.pg-btn {
  padding: .4rem .8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-family: inherit;
  font-size: .85rem;
  cursor: pointer;
  transition: background .12s;
}
.pg-btn:hover  { background: var(--bg); }
.pg-btn.active { background: var(--sidebar); color: #fff; border-color: var(--sidebar); }

/* ── Modals leads ── */
.modal-leads   { max-width: 580px; }
.modal-importar{ max-width: 640px; }
.modal-detalle { max-width: 640px; }

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
  margin-bottom: .75rem;
}
@media (max-width: 520px) {
  .form-grid-2 { grid-template-columns: 1fr; }
}

.phone-field {
  display: flex;
  gap: .4rem;
}
.phone-field select { width: 90px; flex-shrink: 0; padding: .75rem .5rem; }
.phone-field input  { flex: 1; }

/* ── Import modal ── */
.import-instrucciones {
  background: var(--bg);
  border-radius: var(--radius);
  padding: .85rem 1rem;
  margin-bottom: 1rem;
  font-size: .88rem;
}
.import-instrucciones code {
  display: block;
  margin-top: .35rem;
  font-size: .82rem;
  color: var(--sidebar);
  word-break: break-all;
}

.csv-dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  margin-bottom: 1rem;
}
.csv-dropzone:hover, .csv-dropzone.dragover {
  border-color: var(--accent);
  background: #f0fdf9;
}

.dropzone-icon { font-size: 2rem; margin-bottom: .5rem; }
.dropzone-link { color: var(--accent); cursor: pointer; text-decoration: underline; }

.import-defaults {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
  margin-bottom: .75rem;
}
@media (max-width: 520px) {
  .import-defaults { grid-template-columns: 1fr; }
}

.import-success {
  background: #d1f5ea;
  border-radius: var(--radius);
  padding: .85rem 1rem;
  margin-top: .75rem;
}

/* ── Preview table ── */
.preview-table { font-size: .78rem; }
.preview-table th { font-size: .72rem; }
.preview-table td { max-width: 100px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Detail modal ── */
.modal-detalle-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: 1rem;
}

.tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1rem;
  gap: .1rem;
}

.tab-btn {
  padding: .6rem 1.2rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  font-family: inherit;
  font-size: .9rem;
  font-weight: 500;
  color: var(--muted);
  transition: color .12s;
}
.tab-btn.active { border-bottom-color: var(--accent); color: var(--text); }
.tab-btn:hover  { color: var(--text); }

.tab-content { min-height: 200px; }

/* ── Historial ── */
.hist-list { display: flex; flex-direction: column; gap: .5rem; }

.hist-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem .85rem;
  background: var(--bg);
  border-radius: var(--radius);
  font-size: .88rem;
  flex-wrap: wrap;
}

/* ── Notas ── */
.notas-list { display: flex; flex-direction: column; gap: .75rem; }

.nota-item {
  background: var(--bg);
  border-radius: var(--radius);
  padding: .75rem 1rem;
  border-left: 3px solid var(--accent);
}

.nota-meta { font-size: .78rem; color: var(--muted); margin-bottom: .35rem; }
.nota-content { font-size: .9rem; line-height: 1.5; }

/* ── Dropdown asignación ── */
.assign-dropdown .assign-option:hover { background: #f3f4f6; }

/* ── Botón secundario ── */
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg); }

/* ── Mobile ── */
@media (max-width: 680px) {
  .leads-bulk-bar { left: 0; padding: .75rem 1rem; }
  .leads-toolbar  { flex-direction: column; align-items: flex-start; }
  .leads-toolbar-search input { width: 100%; }
  .leads-paginacion { padding-bottom: 6rem; }
}
