/* Hórus Barbearia · CRM de retorno · views/fidelidade.css
   Programa de fidelidade: regra, KPIs, cartões dos clientes, etapas, movimentos e como funciona.
   Todo seletor sob .v-fidelidade.
   Larguras: a linha do cliente tem versão completa (selos desenhados + texto no botão de aviso)
   e compacta (só o anel + ícone). A completa entra onde a coluna da lista tem 750px ou mais. */

.v-fidelidade { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.v-fidelidade .card__head { align-items: center; }
/* o respiro abaixo do cabeçalho já vem do gap da coluna: sem isso somava 20+24 e a página
   começava mais baixo que as outras */
.v-fidelidade__head { margin-bottom: 0; }
.v-fidelidade__head-btn { flex: none; }
.v-fidelidade__sep { color: var(--text-3); }

/* ---------- regra ---------- */
.v-fidelidade__rule {
  flex-direction: row; align-items: stretch; gap: 24px; padding: 20px;
  background: linear-gradient(90deg, rgba(25,197,50,.10), rgba(25,197,50,0) 55%), var(--surface-1);
}
.v-fidelidade__rule-main { display: flex; align-items: flex-start; gap: 14px; flex: 1 1 auto; min-width: 0; }
.v-fidelidade__rule-icon { width: 44px; height: 44px; border-radius: 50%; background: var(--green-tint); color: var(--green-400); display: flex; align-items: center; justify-content: center; flex: none; }
.v-fidelidade__rule-text { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.v-fidelidade__rule-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.v-fidelidade__rule-title { font-size: 18px; font-weight: 700; line-height: 1.2; }
.v-fidelidade__rule-sub { color: var(--text-2); max-width: 64ch; margin-top: -4px; }
.v-fidelidade__cardviz { display: inline-flex; flex-wrap: wrap; gap: 6px; align-self: flex-start; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); max-width: 100%; }
.v-fidelidade__slot { width: 30px; height: 30px; border-radius: 50%; border: 1px dashed var(--line-strong); display: flex; align-items: center; justify-content: center; color: var(--text-3); font-size: 12px; flex: none; }
.v-fidelidade__slot.is-on { background: var(--green); border: 1px solid var(--green); color: var(--on-green); }
.v-fidelidade__slot.is-prize { border: 1px solid var(--green); background: var(--green-tint); color: var(--green-400); }
.v-fidelidade__rule-facts { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12px; color: var(--text-3); }
.v-fidelidade__fact { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.v-fidelidade__fact .ico { color: var(--green-400); }
.v-fidelidade__rule-form { flex: none; width: 280px; display: flex; flex-direction: column; gap: 16px; padding-left: 24px; border-left: 1px solid var(--line); }
.v-fidelidade__switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; min-width: 0; }
.v-fidelidade__switch-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.v-fidelidade__rule.is-off .v-fidelidade__rule-icon { background: var(--surface-3); color: var(--text-3); }
.v-fidelidade__rule.is-off .v-fidelidade__slot.is-prize { border-color: var(--line-strong); background: var(--surface-3); color: var(--text-3); }
.v-fidelidade__rule.is-off .v-fidelidade__fact .ico { color: var(--text-3); }
.v-fidelidade__rule.is-off { background: var(--surface-1); }

/* ---------- kpis ---------- */
.v-fidelidade__kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; min-width: 0; }

/* ---------- colunas ---------- */
.v-fidelidade__cols { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; min-width: 0; }
.v-fidelidade__col-main, .v-fidelidade__col-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

/* ---------- lista de cartões ---------- */
.v-fidelidade__list-card .card__head { flex-wrap: wrap; }
.v-fidelidade__notify-all { flex: none; }
.v-fidelidade__paused { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 14px; border: 1px solid rgba(245,185,66,.35); background: rgba(245,185,66,.08); border-radius: var(--radius-sm); color: var(--text-2); font-size: 13px; min-width: 0; }
.v-fidelidade__paused .ico { color: var(--st-risco); flex: none; }
.v-fidelidade__paused-text { flex: 1 1 auto; min-width: 0; }
.v-fidelidade__paused-text strong { color: var(--text); }
.v-fidelidade__paused .btn { flex: none; }
.v-fidelidade__toolbar { display: flex; align-items: center; gap: 10px 12px; flex-wrap: wrap; margin-bottom: 14px; min-width: 0; }
.v-fidelidade__search { flex: 1 1 200px; max-width: 300px; }
.v-fidelidade__search .input { height: 36px; }
.v-fidelidade__rows { display: flex; flex-direction: column; min-width: 0; }
.v-fidelidade__row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 12px 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.v-fidelidade__row:first-child { padding-top: 0; }
.v-fidelidade__row:last-child { border-bottom: 0; padding-bottom: 0; }
.v-fidelidade__main { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.v-fidelidade__name-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.v-fidelidade__name { flex: 0 1 auto; font-weight: 600; font-size: 14px; color: var(--text); transition: color var(--t) var(--ease); }
.v-fidelidade__name:hover { color: var(--green-400); }
.v-fidelidade__name-row .tag { flex: none; }
.v-fidelidade__meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; font-size: 12px; color: var(--text-3); min-width: 0; }
.v-fidelidade__meta .badge { height: 22px; font-size: 11px; }
.v-fidelidade__meta .barber-chip { font-size: 12px; }
.v-fidelidade__info-m { font-size: 13px; font-weight: 600; color: var(--text-2); margin-top: 2px; }
.v-fidelidade__row.is-complete .v-fidelidade__info-m { color: var(--green-400); }
.v-fidelidade__info-m .muted-3 { font-weight: 400; }
.v-fidelidade__progress { display: flex; align-items: center; gap: 12px; width: 216px; min-width: 0; }
.v-fidelidade__progress .ring { flex: none; }
.v-fidelidade__info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.v-fidelidade__info-title { font-size: 13px; font-weight: 600; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v-fidelidade__row.is-complete .v-fidelidade__info-title { color: var(--green-400); }
.v-fidelidade__info-sub { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v-fidelidade__dots { display: none; gap: 4px; }
.v-fidelidade__dot { width: 12px; height: 12px; border-radius: 50%; border: 1px solid var(--line-strong); flex: none; }
.v-fidelidade__dot.is-prize { border: 1px dashed var(--green-600); }
.v-fidelidade__dot.is-on { background: var(--green); border: 1px solid var(--green); }
.v-fidelidade__dot.is-on.is-prize { background: var(--green-400); border-color: var(--green-400); }
.v-fidelidade__actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex: none; }
.v-fidelidade__notify-more { display: none; }
.v-fidelidade__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 4px; padding-top: 14px; border-top: 1px solid var(--line); }
.v-fidelidade__note { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }

/* ---------- etapas do cartão (gráfico) ---------- */
.v-fidelidade__bars { min-width: 0; }
.v-fidelidade__bars .bars__bar { transition: stroke var(--t) var(--ease); }
.v-fidelidade__bars .bars__bar:hover { stroke: var(--green-400); }
.v-fidelidade__ticks { display: grid; grid-template-columns: repeat(var(--n, 11), minmax(0, 1fr)); gap: 2px; margin-top: 6px; }
.v-fidelidade__ticks span { font-family: var(--mono); font-size: 11px; color: var(--text-3); text-align: center; overflow: hidden; white-space: nowrap; min-width: 0; }
.v-fidelidade__ticks span.is-last { color: var(--green-400); font-weight: 500; }
.v-fidelidade__read { font-size: 13px; color: var(--text-2); margin-top: 12px; }

/* ---------- movimentos do cartão ---------- */
.v-fidelidade__hist { display: flex; flex-direction: column; }
.v-fidelidade__hist-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.v-fidelidade__hist-item:first-child { padding-top: 0; }
.v-fidelidade__hist-item:last-child { border-bottom: 0; padding-bottom: 0; }
.v-fidelidade__hist-item.is-link { cursor: pointer; }
.v-fidelidade__hist-item.is-link:hover .v-fidelidade__hist-text { color: var(--green-400); }
.v-fidelidade__hist-ico { width: 32px; height: 32px; border-radius: 50%; background: var(--surface-3); color: var(--st-risco); display: flex; align-items: center; justify-content: center; flex: none; }
.v-fidelidade__hist-main { flex: 1 1 auto; min-width: 0; }
.v-fidelidade__hist-text { font-size: 13px; line-height: 1.4; color: var(--text); transition: color var(--t) var(--ease); overflow-wrap: anywhere; }
.v-fidelidade__hist-when { flex: none; font-size: 12px; color: var(--text-3); }

/* ---------- como funciona ---------- */
.v-fidelidade__steps { display: flex; flex-direction: column; gap: 14px; }
.v-fidelidade__step { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }
.v-fidelidade__step-num { width: 28px; height: 28px; border-radius: 50%; background: var(--green-tint); color: var(--green-400); font-size: 12px; font-weight: 500; display: flex; align-items: center; justify-content: center; flex: none; }
.v-fidelidade__step-title { font-size: 13px; font-weight: 600; margin-top: 4px; }
.v-fidelidade__step-text { font-size: 13px; color: var(--text-2); line-height: 1.45; margin-top: 2px; }

/* ---------- fila de avisos (modal) ---------- */
.v-fidelidade__queue { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.v-fidelidade__queue-intro { font-size: 13px; color: var(--text-2); }
.v-fidelidade__queue-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--text-2); }
.v-fidelidade__queue-top strong { color: var(--text); font-weight: 500; }
.v-fidelidade__queue-state { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: var(--st-hora); }
.v-fidelidade__queue-state.is-done { color: var(--green-400); }
.v-fidelidade__queue-list { max-height: 40vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.v-fidelidade__queue-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); min-width: 0; }
.v-fidelidade__queue-item:last-child { border-bottom: 0; }
.v-fidelidade__queue-main { flex: 1 1 auto; min-width: 0; }
.v-fidelidade__queue-name { font-size: 13px; font-weight: 600; }
.v-fidelidade__queue-msg { font-size: 12px; color: var(--text-3); }
.v-fidelidade__queue-status { flex: none; display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-3); min-width: 72px; justify-content: flex-end; }
.v-fidelidade__queue-item.is-sending .v-fidelidade__queue-status { color: var(--st-hora); }
.v-fidelidade__queue-item.is-sent .v-fidelidade__queue-status { color: var(--green-400); }
.v-fidelidade__queue-item.is-sent .v-fidelidade__queue-name { color: var(--text-2); }

/* ---------- linha completa: selos desenhados + "no WhatsApp" no botão de aviso ----------
   Precisa de uns 860px na coluna da lista: duas colunas só a partir de 1680 de viewport;
   coluna única entre 1130 e 1399 (sidebar cheia) e entre 1010 e 1100 (sidebar recolhida). */
@media (min-width: 1680px), (min-width: 1130px) and (max-width: 1399px), (min-width: 1010px) and (max-width: 1100px) {
  .v-fidelidade__dots { display: flex; }
  .v-fidelidade__progress { width: 224px; }
  .v-fidelidade__notify-more { display: inline; }
}

/* ---------- até 1399: coluna lateral desce para baixo da lista, em 2 colunas ---------- */
@media (max-width: 1399px) and (min-width: 769px) {
  .v-fidelidade__cols { grid-template-columns: minmax(0, 1fr); }
  .v-fidelidade__col-side { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .v-fidelidade__how { grid-column: 1 / -1; }
  .v-fidelidade__steps { flex-direction: row; gap: 20px; }
  .v-fidelidade__step { flex: 1 1 0; }
}

/* ---------- mobile ---------- */
@media (max-width: 768px) {
  /* alvo de toque de 40px no celular */
  .v-fidelidade__search .input { height: 40px; }
  .v-fidelidade { gap: 16px; }
  .v-fidelidade__head-btn { width: 100%; }
  .v-fidelidade__rule { flex-direction: column; gap: 16px; padding: 16px; }
  .v-fidelidade__rule-icon { display: none; }
  .v-fidelidade__rule-form { width: auto; padding-left: 0; border-left: 0; padding-top: 16px; border-top: 1px solid var(--line); }
  .v-fidelidade__rule-title { font-size: 16px; }
  .v-fidelidade__slot { width: 24px; height: 24px; font-size: 11px; }
  .v-fidelidade__cardviz { gap: 4px; padding: 8px 10px; }
  .v-fidelidade__kpis { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .v-fidelidade__kpis .kpi { flex-direction: row; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 12px; padding: 12px 16px; }
  .v-fidelidade__kpis .kpi__label { order: 0; flex: 1 1 auto; }
  .v-fidelidade__kpis .kpi__value { order: 1; font-size: 22px; }
  .v-fidelidade__kpis .kpi__hint { order: 2; flex-basis: 100%; }
  .v-fidelidade__cols { grid-template-columns: minmax(0, 1fr); }
  .v-fidelidade__list-card .card__head > div { flex: 1 1 100%; }
  .v-fidelidade__notify-all { width: 100%; }
  .v-fidelidade__search { flex-basis: 100%; max-width: none; }
  .v-fidelidade__paused { flex-wrap: wrap; }
  .v-fidelidade__paused .btn { flex: 1 1 100%; }
  .v-fidelidade__row { grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px 12px; }
  .v-fidelidade__progress { width: auto; }
  .v-fidelidade__actions { grid-column: 1 / -1; justify-content: stretch; }
  .v-fidelidade__actions .btn:not(.btn--icon) { flex: 1 1 auto; }
  .v-fidelidade__actions .btn--icon { flex: none; }
  .v-fidelidade__queue-list { max-height: 36vh; }
  .v-fidelidade__queue-status { min-width: 0; }
  .v-fidelidade__queue-status span { display: none; }
}
/* "Avisar no WhatsApp" por extenso só onde os três botões cabem na linha (a partir de 420 no mobile) */
@media (max-width: 768px) and (min-width: 420px) {
  .v-fidelidade__notify-more { display: inline; }
}
@media (max-width: 380px) {
  .v-fidelidade__slot { width: 22px; height: 22px; font-size: 11px; }
  .v-fidelidade__cardviz { gap: 3px; padding: 8px; }
}
