/* ============================================================
   MELQUIADES LAW — Prospecção: estilos da view Captação
   Namespace: .prosp-*
   Não vaza para views da Gestão.
   ============================================================ */

/* ── Layout 3 colunas ──────────────────────────────────────── */
.prosp-layout {
  display: grid;
  grid-template-columns: 30% 40% 30%;
  height: calc(100vh - var(--topbar-h) - 48px - 40px); /* 48px nav + 40px rodapé */
  min-height: 500px;
  overflow: hidden;
}

.prosp-col {
  border-right: 1px solid var(--border-base);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.prosp-col:last-child { border-right: none; }

/* ── Rodapé métricas ─────────────────────────────────────── */
.prosp-rodape {
  height: 40px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  border-top: 1px solid var(--border-base);
  background: var(--bg-secondary);
  font-size: 12px;
  color: var(--text-secondary);
  flex-shrink: 0;
}
.prosp-metric b { color: var(--gold); font-weight: 600; }
.prosp-metric-sep { color: var(--text-muted); }
.prosp-rodape-skeleton { color: var(--text-muted); font-style: italic; }

/* ── Coluna 1: Fila ──────────────────────────────────────── */
.prosp-col--fila { background: var(--bg-primary); }

.prosp-fila-header {
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border-base);
  flex-shrink: 0;
}

.prosp-fila-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.prosp-fila-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.prosp-contador {
  background: var(--gold);
  color: #000;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
  padding: 1px 7px;
  border-radius: var(--r-full);
  line-height: 18px;
}

.prosp-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.prosp-chip {
  padding: 3px 10px;
  border-radius: var(--r-full);
  border: 1px solid var(--border-base);
  background: transparent;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: color var(--dur-fast), border-color var(--dur-fast), background var(--dur-fast);
}
.prosp-chip:hover {
  border-color: var(--gold-border);
  color: var(--gold);
}
.prosp-chip--active {
  background: var(--gold-glow);
  border-color: var(--gold-border);
  color: var(--gold);
}

/* ── Busca na fila ───────────────────────────────────────── */
.prosp-search-wrap {
  position: relative;
  margin-top: 8px;
}
.prosp-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 13px;
  height: 13px;
  color: var(--text-muted);
  pointer-events: none;
  flex-shrink: 0;
}
.prosp-search-input {
  width: 100%;
  box-sizing: border-box;
  padding: 6px 10px 6px 30px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-base);
  border-radius: var(--r-md);
  font-size: 12px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  appearance: none;
  -webkit-appearance: none;
}
.prosp-search-input::placeholder { color: var(--text-muted); }
.prosp-search-input:focus {
  outline: none;
  border-color: var(--gold-border);
  box-shadow: 0 0 0 2px var(--gold-glow);
}
/* Esconde o ícone "X" nativo dos navegadores no campo search */
.prosp-search-input::-webkit-search-cancel-button { display: none; }

.prosp-fila-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 6px 8px;
}
.prosp-fila-scroll::-webkit-scrollbar { width: 4px; }
.prosp-fila-scroll::-webkit-scrollbar-track { background: transparent; }
.prosp-fila-scroll::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

/* ── Cards de Lead ──────────────────────────────────────── */
.prosp-card {
  padding: 10px 12px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  cursor: pointer;
  margin-bottom: 4px;
  transition: background var(--dur-fast), border-color var(--dur-fast), box-shadow var(--dur-fast);
  background: var(--bg-card);
  outline: none;
}
.prosp-card:hover {
  background: var(--bg-card-hover);
  box-shadow: var(--shadow-xs);
}
.prosp-card--active {
  border-color: var(--gold-border);
  background: var(--bg-card-hover);
  box-shadow: 0 0 0 1px rgba(201,168,76,0.15);
}
.prosp-card--flash {
  animation: prosp-card-flash 600ms ease-out forwards;
}
@keyframes prosp-card-flash {
  0%   { box-shadow: 0 0 0 2px rgba(201,168,76,0.5); border-color: var(--gold); }
  100% { box-shadow: none; border-color: var(--gold-border); }
}
@media (prefers-reduced-motion: reduce) {
  .prosp-card--flash { animation: none; }
}

.prosp-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 3px;
}
.prosp-card-nome {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.prosp-card-badges { display: flex; gap: 4px; flex-shrink: 0; }
.prosp-card-sub {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
}
.prosp-card-area { font-size: 11px; color: var(--text-secondary); }
.prosp-card-loc  { font-size: 11px; color: var(--text-muted); }

/* ── Badges ─────────────────────────────────────────────── */
.prosp-badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .04em;
  padding: 2px 5px;
  border-radius: 3px;
  white-space: nowrap;
}
.prosp-badge--prioritario { background: rgba(201,168,76,0.2);  color: var(--gold);         }
.prosp-badge--critico     { background: rgba(239,68,68,0.18);  color: #ef4444;              }
.prosp-badge--vencido     { background: rgba(239,68,68,0.12);  color: #ef4444;              }
.prosp-badge--hoje        { background: rgba(245,158,11,0.15); color: var(--color-warning); }
.prosp-badge--novo        { background: rgba(59,130,246,0.15); color: var(--color-info);    }

.prosp-badge--pulse {
  animation: prosp-pulse 2s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
  .prosp-badge--pulse { animation: none; }
}
@keyframes prosp-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .5; }
}

/* ── Bolinhas de tentativas ──────────────────────────────── */
.prosp-dots { display: flex; gap: 4px; }
.prosp-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border2);
}
.prosp-dot--filled { background: var(--gold); }

/* ── Empty states ────────────────────────────────────────── */
.prosp-empty-sel,
.prosp-empty-queue {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 10px;
  color: var(--text-muted);
  text-align: center;
  padding: 32px;
}
.prosp-empty-icon {
  width: 40px;
  height: 40px;
  opacity: .35;
}
.prosp-empty-queue h3 { font-size: 15px; font-weight: 600; color: var(--text-secondary); }
.prosp-empty-queue p  { font-size: 13px; color: var(--text-muted); max-width: 220px; }

.prosp-btn-import {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--gold-glow);
  border: 1px solid var(--gold-border);
  border-radius: var(--r-sm);
  color: var(--gold);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--dur-fast);
}
.prosp-btn-import:hover { background: rgba(201,168,76,0.2); }
.prosp-btn-import i { width: 15px; height: 15px; }

.prosp-sentinel { height: 1px; }

/* ── Coluna 2: Detalhes ──────────────────────────────────── */
.prosp-col--detalhes {
  background: var(--bg-secondary);
  overflow-y: auto;
}
.prosp-col--detalhes::-webkit-scrollbar { width: 4px; }
.prosp-col--detalhes::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

.prosp-detalhes-inner { padding: 20px 20px 28px; }

.prosp-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--gold);
  color: #000;
  font-size: 22px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.prosp-detalhes-nome {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 3px;
}
.prosp-detalhes-sub {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.prosp-rating {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}
.prosp-star { font-size: 14px; }
.prosp-star--full  { color: var(--gold); }
.prosp-star--half  { color: var(--gold); opacity: .6; }
.prosp-star--empty { color: var(--text-muted); }
.prosp-rating-txt  { font-size: 12px; color: var(--text-secondary); }

.prosp-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.prosp-status-badge {
  padding: 2px 8px;
  border-radius: var(--r-full);
  background: var(--bg-card);
  border: 1px solid var(--border-base);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: capitalize;
}
.prosp-tentativa-label {
  font-size: 11px;
  color: var(--text-muted);
}

.prosp-fu-info {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 14px;
}
.prosp-fu-info--vencido {
  color: var(--color-danger);
  font-weight: 600;
}
.prosp-fu-info--hoje {
  color: var(--color-warning);
  font-weight: 600;
}

.prosp-section-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

/* Notas */
.prosp-notas-section { margin-bottom: 18px; }
.prosp-notas-wrap { position: relative; }
.prosp-nota-textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-base);
  border-radius: var(--r-sm);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 12.5px;
  padding: 8px 10px;
  resize: vertical;
  transition: border-color var(--dur-fast);
}
.prosp-nota-textarea:focus {
  outline: none;
  border-color: var(--gold-border);
}
.prosp-nota-saved {
  position: absolute;
  bottom: 6px;
  right: 8px;
  font-size: 10px;
  color: var(--color-success);
  opacity: 0;
  transition: opacity var(--dur-std);
  pointer-events: none;
}
.prosp-nota-saved--visible { opacity: 1; }

/* Timeline */
.prosp-timeline-section { margin-bottom: 18px; }
.prosp-timeline { display: flex; flex-direction: column; gap: 8px; }
.prosp-timeline-item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.prosp-timeline-icon { flex-shrink: 0; padding-top: 1px; }
.prosp-timeline-icon i { width: 14px; height: 14px; }
.prosp-timeline-body { display: flex; flex-direction: column; gap: 2px; }
.prosp-timeline-acao { font-size: 12px; color: var(--text-secondary); }
.prosp-timeline-data { font-size: 10px; color: var(--text-muted); }
.prosp-timeline-loading,
.prosp-timeline-empty  { font-size: 11px; color: var(--text-muted); font-style: italic; }

/* Preview mensagem */
.prosp-preview-section { margin-top: 4px; }
.prosp-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.prosp-msg-dropdown {
  background: var(--bg-input);
  border: 1px solid var(--border-base);
  border-radius: var(--r-sm);
  color: var(--text-secondary);
  font-size: 11px;
  padding: 3px 6px;
  max-width: 180px;
  cursor: pointer;
}
.prosp-msg-dropdown:focus { outline: none; border-color: var(--gold-border); }
.prosp-preview-textarea {
  width: 100%;
  min-height: 120px;
  background: var(--bg-input);
  border: 1px solid var(--border-base);
  border-radius: var(--r-sm);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 12.5px;
  line-height: 1.5;
  padding: 10px;
  resize: vertical;
  transition: border-color var(--dur-fast);
}
.prosp-preview-textarea:focus { outline: none; border-color: var(--gold-border); }
.prosp-char-count {
  display: block;
  text-align: right;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Aviso arquivamento */
.prosp-arquivamento-aviso {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--r-sm);
  background: rgba(239,68,68,0.07);
  border: 1px solid rgba(239,68,68,0.2);
  color: #ef4444;
  font-size: 12.5px;
  font-weight: 500;
  margin-top: 8px;
}
.prosp-arquivamento-aviso i { width: 16px; height: 16px; flex-shrink: 0; }

/* ── Coluna 3: Ações ─────────────────────────────────────── */
.prosp-col--acoes {
  background: var(--bg-primary);
  overflow-y: auto;
}
.prosp-col--acoes::-webkit-scrollbar { width: 4px; }
.prosp-col--acoes::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

.prosp-acoes-inner {
  padding: 20px 16px 28px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Botões de ação */
.prosp-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  border: none;
  border-radius: var(--r-sm);
  font-family: var(--font-sans);
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--dur-fast), transform 60ms, background var(--dur-fast);
}
.prosp-btn:active:not(:disabled) { transform: scale(0.98); }
.prosp-btn:disabled { opacity: .45; cursor: not-allowed; }
.prosp-btn i { width: 16px; height: 16px; flex-shrink: 0; }

.prosp-btn--whatsapp {
  min-height: 56px;
  font-size: 15px;
  background: #25D366;
  color: #000;
}
.prosp-btn--whatsapp:hover:not(:disabled) { background: #1fbc5a; }

.prosp-btn--instagram {
  min-height: 48px;
  font-size: 14px;
  background: #8B5CF6;
  color: #fff;
}
.prosp-btn--instagram:hover:not(:disabled) { background: #7c3aed; }
.prosp-btn--disabled { opacity: .35; }

.prosp-btn--respondeu {
  min-height: 48px;
  font-size: 13.5px;
  background: var(--color-info);
  color: #fff;
}
.prosp-btn--respondeu:hover:not(:disabled) { background: #2563eb; }

.prosp-btn--arquivar {
  min-height: 44px;
  font-size: 13px;
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.25);
  color: #ef4444;
}
.prosp-btn--arquivar:hover:not(:disabled) { background: rgba(239,68,68,0.18); }

.prosp-btn--pular {
  min-height: 36px;
  font-size: 12.5px;
  background: transparent;
  border: 1px solid var(--border-base);
  color: var(--text-muted);
}
.prosp-btn--pular:hover:not(:disabled) { color: var(--text-secondary); border-color: var(--border2); }

/* Dropdown de arquivamento */
.prosp-arquivar-wrap { position: relative; }
.prosp-arquivar-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border2);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-md);
  z-index: 50;
  overflow: hidden;
}
.prosp-arquivar-opt {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border-base);
  color: var(--text-secondary);
  font-size: 12.5px;
  cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast);
}
.prosp-arquivar-opt:last-child { border-bottom: none; }
.prosp-arquivar-opt:hover { background: var(--bg-card-hover); color: var(--text-primary); }

.prosp-arquivar-outro {
  padding: 8px;
  display: flex;
  gap: 6px;
  border-top: 1px solid var(--border-base);
}
.prosp-motivo-input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-base);
  border-radius: var(--r-xs);
  color: var(--text-primary);
  font-size: 12px;
  padding: 5px 8px;
}
.prosp-motivo-input:focus { outline: none; border-color: var(--gold-border); }
.prosp-btn-mini {
  padding: 5px 10px;
  background: var(--gold);
  border: none;
  border-radius: var(--r-xs);
  color: #000;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

/* Legenda atalhos */
.prosp-shortcuts {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border-base);
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 10.5px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  text-align: center;
}

/* ── Desktop: wrapper transparente para o grid ──────────── */
.prosp-detail-panel { display: contents; }

/* Botão voltar: oculto em desktop */
.prosp-back-btn { display: none; }

/* ── Mobile: layout de painel deslizante ────────────────── */
@media (max-width: 768px) {
  /* Cancela o padding do app-content só nesta view */
  #view-captacao { margin: -14px; }

  .prosp-layout {
    display: block;
    position: relative;
    /* topbar(52) + topnav(44) + rodapé(40) = 136; +14px margin cancelado acima */
    height: calc(100svh - 150px);
    height: calc(100dvh - 150px);
    min-height: 400px;
    overflow: hidden;
  }

  /* ── Painel A: Fila (ocupa a tela inteira por padrão) ── */
  .prosp-col--fila {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    border-right: none;
    border-bottom: none;
    max-height: none;
    background: var(--bg-primary);
    transition: transform 280ms cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
    will-change: transform;
  }
  .prosp-fila-scroll {
    flex: 1;
    max-height: none;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 6px 10px;
  }

  /* ── Painel B: Detalhe + Ações (entra pela direita) ──── */
  .prosp-detail-panel {
    display: flex;
    flex-direction: column;
    position: absolute;
    inset: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    background: var(--bg-secondary);
    transform: translateX(100%);
    transition: transform 280ms cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2;
    will-change: transform;
  }

  /* Estado: lead selecionado */
  .prosp-layout--detail-open .prosp-col--fila {
    transform: translateX(-100%);
  }
  .prosp-layout--detail-open .prosp-detail-panel {
    transform: translateX(0);
  }

  /* Colunas dentro do painel B: fluxo normal empilhado */
  .prosp-col--detalhes,
  .prosp-col--acoes {
    position: static;
    overflow: visible;
    border-right: none;
    flex-shrink: 0;
    height: auto;
    max-height: none;
  }
  .prosp-col--detalhes {
    border-bottom: 1px solid var(--border-base);
  }
  .prosp-col--acoes {
    background: var(--bg-primary);
    padding-bottom: env(safe-area-inset-bottom, 16px);
  }

  /* ── Botão Voltar ────────────────────────────────────── */
  .prosp-back-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 0 16px;
    min-height: 48px;
    background: var(--bg-primary);
    border: none;
    border-bottom: 1px solid var(--border-base);
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
    text-align: left;
    -webkit-tap-highlight-color: transparent;
  }
  .prosp-back-btn i { width: 16px; height: 16px; flex-shrink: 0; }
  .prosp-back-btn:active { background: var(--bg-card); color: var(--gold); }

  /* ── Campo de busca ─────────────────────────────────── */
  .prosp-search-input { font-size: 16px; /* evita zoom automático do iOS */ }

  /* ── Chips (scroll horizontal) ──────────────────────── */
  .prosp-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  .prosp-chips::-webkit-scrollbar { display: none; }
  .prosp-chip { white-space: nowrap; min-height: 36px; padding: 5px 12px; }

  /* ── Cards maiores para toque ───────────────────────── */
  .prosp-card { padding: 12px 14px; }

  /* ── Botões com área de toque mínima 44px ───────────── */
  .prosp-btn--whatsapp  { min-height: 56px; }
  .prosp-btn--instagram { min-height: 48px; }
  .prosp-btn--respondeu { min-height: 48px; }
  .prosp-btn--arquivar  { min-height: 48px; }
  .prosp-btn--pular     { min-height: 44px; }

  /* ── Rodapé compacto ────────────────────────────────── */
  .prosp-rodape {
    height: auto;
    flex-wrap: wrap;
    padding: 6px 12px;
    gap: 4px;
    font-size: 11px;
  }

  /* ── Atalhos de teclado: ocultos em mobile ──────────── */
  .prosp-shortcuts { display: none; }
}

/* ── Tablet landscape ───────────────────────────────────── */
@media (min-width: 769px) and (max-width: 1100px) {
  .prosp-layout { grid-template-columns: 32% 36% 32%; }
}
