/* =========================================================================
   AzambujaMais — componente: Rede Credenciada (compartilhado)
   Barra de busca + cards de credenciados. Usado pela página pública
   (/pages/public/rede/) e pela Área do Cliente (seção "Rede"). Depende dos
   tokens de base.css. O posicionamento específico (hero, sobreposição) fica
   na CSS de cada página.
   ========================================================================= */

/* ------- Barra de busca ------- */
.rede-busca {
  display: grid;
  grid-template-columns: 1fr 1.4fr auto;
  gap: 0.85rem;
  align-items: end;
  background: #fff;
  border: 1px solid #e8edf5;
  border-radius: var(--radius);
  box-shadow: 0 18px 44px rgba(15, 40, 90, 0.16);
  padding: 1.25rem;
}
.busca-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
}
.busca-field label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding-left: 0.15rem;
}
.select-wrap {
  position: relative;
}
.rede-select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  border: 1.5px solid #dbe3ef;
  border-radius: var(--radius-sm);
  background: #f8fafd;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 500;
  padding: 0.85rem 2.6rem 0.85rem 1rem;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}
.rede-select:hover {
  border-color: var(--brand-100);
}
.rede-select:focus {
  outline: none;
  background: #fff;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(14, 95, 192, 0.16);
}
.select-chevron {
  position: absolute;
  right: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: var(--brand);
  pointer-events: none;
}
.busca-actions {
  display: flex;
  gap: 0.6rem;
}
.busca-btn,
.busca-limpar {
  height: 52px;
  white-space: nowrap;
}
/* No branco da barra, o outline padrão some; dá um fundo sutil e borda visível. */
.busca-limpar {
  background: #f8fafd;
}
.busca-limpar:hover {
  background: #fff;
  border-color: var(--brand);
}
.cred-btn-ico {
  display: inline-flex;
  align-items: center;
}
.cred-btn-ico svg {
  width: 16px;
  height: 16px;
}

/* ------- Resultados ------- */
.rede-count {
  margin-bottom: 1.75rem;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--muted);
}
.rede-count b {
  color: var(--ink);
  font-weight: 700;
}
/* Estado de carregando (enquanto busca os credenciados no banco) */
.rede-loading {
  display: flex;
  justify-content: center;
  padding: 3rem 0;
}
.rede-loading img {
  height: 46px;
  width: auto;
  animation: redeLogoPulse 1.15s ease-in-out infinite;
}
@keyframes redeLogoPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(0.94); }
}
/* Flex centralizado: no máximo 2 cards por fileira no desktop. Poucos cards (ou
   o card sozinho da última fileira) ficam centralizados no meio da página. */
.rede-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.75rem;
}

/* ------- Card do credenciado ------- */
.cred-card {
  position: relative;
  display: flex;
  flex-direction: column;
  /* 2 cards por fileira no desktop: a base de 460px impede que um 3º caiba na
     fileira (container útil ~1400px). Cresce até 500px e centraliza quando há poucos. */
  flex: 1 1 460px;
  max-width: 500px;
  min-width: 0;
  background: #fff;
  border: 1px solid rgba(14, 95, 192, 0.12);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.6rem 1.6rem 1.5rem;
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
/* Barra de marca no topo do card. */
.cred-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--brand) 0%, var(--brand-light) 55%, var(--accent) 100%);
}
.cred-card:hover {
  transform: translateY(-4px);
  border-color: rgba(14, 95, 192, 0.24);
  box-shadow: var(--shadow-lg);
}
@media (prefers-reduced-motion: reduce) {
  .cred-card {
    transition: none;
  }
  .cred-card:hover {
    transform: none;
  }
}

.cred-card-top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.1rem;
}
.cred-avatar {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff;
  box-shadow: 0 6px 16px rgba(14, 95, 192, 0.28);
}
.cred-avatar svg {
  width: 24px;
  height: 24px;
}
.cred-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.cred-badge {
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.cred-badge--esp {
  background: var(--brand-50);
  color: var(--brand);
}
.cred-badge--cidade {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: #fff3e2;
  color: var(--accent-dark);
}
.cred-badge--cidade svg {
  width: 13px;
  height: 13px;
}

.cred-nome {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--brand-dark);
}
.cred-resp {
  margin: 0.35rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}
.cred-resp b {
  color: var(--ink);
  font-weight: 600;
}

.cred-div {
  height: 1px;
  margin: 1.25rem 0;
  background: #eef2f8;
}

.cred-info {
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
  display: grid;
  gap: 0.85rem;
}
.cred-info li {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  font-size: 0.92rem;
  line-height: 1.45;
  color: #3f4d61;
}
.cred-ico {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--brand-50);
  color: var(--brand);
}
.cred-ico svg {
  width: 16px;
  height: 16px;
}
.cred-info a {
  color: #3f4d61;
  transition: color 0.15s;
}
.cred-info a:hover {
  color: var(--brand);
}

/* Ações */
.cred-actions {
  display: flex;
  gap: 0.65rem;
  margin-top: auto;
}
.cred-actions .btn {
  flex: 1;
  padding-left: 0.85rem;
  padding-right: 0.85rem;
  white-space: nowrap;
}
.btn-whats {
  background: #25d366;
  color: #fff;
}
.btn-whats:hover {
  background: #1eb658;
}

/* ------- Estado vazio / prompt ------- */
.rede-empty {
  max-width: 460px;
  margin: 1rem auto;
  text-align: center;
  padding: 2.5rem 1.5rem;
}
.rede-empty-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--brand-50);
  color: var(--brand);
  margin-bottom: 1.25rem;
}
.rede-empty-ico svg {
  width: 34px;
  height: 34px;
}
.rede-empty h3 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--ink);
}
.rede-empty p {
  margin: 0.6rem 0 1.5rem;
  color: var(--muted);
}

/* ------- Responsivo ------- */
@media (max-width: 760px) {
  .rede-busca {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .busca-actions .btn {
    flex: 1;
  }
  .cred-card {
    flex-basis: 100%;
    max-width: 480px;
  }
}

@media (max-width: 420px) {
  .cred-actions {
    flex-direction: column;
  }
}
