/* ============================================================
   components.css — Botões, inputs, badges, cards, modais
   ============================================================ */

/* ── Botões ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 10px 16px;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 13px;
  font-weight: var(--fw-medium);
  cursor: pointer;
  transition: background var(--transition), color var(--transition),
              border-color var(--transition), opacity var(--transition),
              transform var(--transition-fast);
  user-select: none;
  text-decoration: none;
}

.btn:hover  { background: var(--surface3); border-color: var(--surface3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 14px 22px; font-size: 14px; }

.btn-primary {
  background: var(--gold);
  color: #0f0e0c;
  border-color: var(--gold);
  font-weight: var(--fw-medium);
}
.btn-primary:hover { background: var(--gold-dim); border-color: var(--gold-dim); color: #0f0e0c; }

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-dim);
}
.btn-ghost:hover { color: var(--text); background: var(--surface2); border-color: var(--border); }

.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--etapa-desqualificado);
  border-color: rgba(239, 68, 68, 0.25);
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.18); }

.btn-success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--etapa-fechado);
  border-color: rgba(16, 185, 129, 0.25);
}
.btn-success:hover { background: rgba(16, 185, 129, 0.18); }

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-block { width: 100%; }

/* ── Inputs ── */
.input,
.select,
.textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 14px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color var(--transition), background var(--transition);
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--gold-dim);
  background: var(--surface);
}

.input::placeholder,
.textarea::placeholder { color: var(--text-muted); }

.select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' stroke='%238a8278' stroke-width='1.5' fill='none' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.textarea {
  min-height: 80px;
  resize: vertical;
  line-height: 1.45;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: var(--sp-4);
}

.field-label {
  font-size: var(--fs-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.field-help {
  font-size: 11px;
  color: var(--text-muted);
}

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: var(--surface2);
  color: var(--text-dim);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  font-weight: var(--fw-medium);
}

.badge-gold {
  background: var(--gold-soft);
  color: var(--gold);
  border-color: rgba(201, 168, 76, 0.25);
}

.badge-etapa {
  border-color: var(--etapa-cor, var(--border));
  color: var(--etapa-cor, var(--text));
  background: color-mix(in srgb, var(--etapa-cor, transparent) 14%, transparent);
}

.badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  display: inline-block;
  flex-shrink: 0;
}

/* ── Card genérico ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--sp-4);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: var(--sp-3);
}

.card-title {
  font-family: var(--font-serif);
  font-size: var(--fs-lg);
  font-weight: var(--fw-semi);
  color: var(--text);
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  padding: var(--sp-4);
  animation: fadeIn 0.18s ease;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-title {
  font-family: var(--font-serif);
  font-size: var(--fs-xl);
  font-weight: var(--fw-semi);
  color: var(--text);
  margin-bottom: var(--sp-2);
}

.modal-text {
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: var(--sp-5);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-2);
  margin-top: var(--sp-5);
}

/* ── Empty state ── */
.empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  gap: var(--sp-3);
  text-align: center;
  padding: var(--sp-7);
}

.empty-icon {
  font-size: 40px;
  opacity: 0.4;
}

.empty-title {
  font-family: var(--font-serif);
  font-size: var(--fs-lg);
  color: var(--text-dim);
}

.empty-sub {
  font-size: 13px;
  color: var(--text-muted);
}

/* ── Indicador colorido (vermelho/verde/cinza no card kanban) ── */
.indicator-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.4);
}

/* ── Filters bar ── */
.filters-bar {
  display: flex;
  gap: var(--sp-2);
  align-items: center;
  flex-wrap: wrap;
  padding: var(--sp-3) var(--sp-6);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.filters-bar .input,
.filters-bar .select {
  padding: 8px 12px;
  font-size: 13px;
  width: auto;
  min-width: 160px;
}

.filters-bar .search-input {
  flex: 1;
  min-width: 200px;
  max-width: 320px;
}

/* ── Avatar ── */
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gold-soft);
  color: var(--gold);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--fw-semi);
  font-size: 12px;
  border: 1px solid rgba(201, 168, 76, 0.25);
  flex-shrink: 0;
}

.avatar-sm { width: 24px; height: 24px; font-size: 10px; }
.avatar-lg { width: 56px; height: 56px; font-size: 18px; }

/* ── Linha do tempo (perfil do lead) ── */
.timeline {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  padding-left: var(--sp-5);
  position: relative;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -22px;
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--etapa-cor, var(--gold));
  box-shadow: 0 0 0 3px var(--surface);
}

.timeline-label {
  font-size: 13px;
  color: var(--text);
  font-weight: var(--fw-medium);
}

.timeline-date {
  font-size: 11px;
  color: var(--text-muted);
}

/* ── Tag inline (área / cidade / etc) ── */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-dim);
}

/* ── Divisor de seção ── */
.section-divider {
  height: 1px;
  background: var(--border);
  margin: var(--sp-4) 0;
}

/* ── Mini stats (cards numéricos do dashboard) ── */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 3px;
  background: var(--etapa-cor, var(--gold));
}

.stat-label {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.stat-value {
  font-family: var(--font-serif);
  font-size: var(--fs-2xl);
  font-weight: var(--fw-semi);
  color: var(--text);
}

.stat-hint {
  font-size: 11px;
  color: var(--text-muted);
}

/* ── Perfil do lead (slide-over) ── */
.lead-perfil {
  padding: var(--sp-4) var(--sp-5) var(--sp-6);
  overflow-y: auto;
  height: 100%;
}

.lead-section {
  padding: var(--sp-4) 0;
  border-bottom: 1px solid var(--border-soft);
}
.lead-section:last-child { border-bottom: none; }

.lead-section-title {
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: var(--fw-semi);
  color: var(--gold);
  margin-bottom: var(--sp-3);
  letter-spacing: 0.02em;
}

.field-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
}

.lead-section-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
}

.lead-etapa-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: color-mix(in srgb, var(--etapa-cor) 12%, var(--surface));
  color: var(--etapa-cor);
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid color-mix(in srgb, var(--etapa-cor) 35%, transparent);
  font-size: 12px;
  font-weight: var(--fw-medium);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.lead-resumo {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-3) var(--sp-4);
  color: var(--text);
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.lead-advogado-atual {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
}

.lead-advogado-info { flex: 1; min-width: 0; }
.lead-advogado-nome {
  font-size: 13px;
  font-weight: var(--fw-medium);
  color: var(--text);
}
.lead-advogado-area { font-size: 11px; color: var(--text-dim); }

.lead-etapas-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.lead-etapa-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--etapa-cor, var(--text-muted));
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  text-align: left;
  transition: background var(--transition), border-color var(--transition);
}
.lead-etapa-btn:hover:not(:disabled) { background: var(--surface3); }
.lead-etapa-btn.active {
  background: color-mix(in srgb, var(--etapa-cor) 12%, var(--surface));
  cursor: default;
}
.lead-etapa-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.lead-etapa-btn.auto::after {
  content: 'auto';
  margin-left: auto;
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.lead-actions {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
}
.lead-actions .btn { flex: 1; }

/* ── Perfil do advogado ── */
.perfil-container {
  padding: var(--sp-5) var(--sp-6);
  overflow-y: auto;
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
}

.perfil-card { padding: var(--sp-6); }

.perfil-header {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  margin-bottom: var(--sp-4);
}

.perfil-nome {
  font-family: var(--font-serif);
  font-size: var(--fs-xl);
  font-weight: var(--fw-semi);
  color: var(--text);
}

.perfil-sub {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gold);
}
