/* Módulo A: Agenda, Profissionais e Serviços. Usa as variáveis de app.css. */

/* ---------- agenda: topo e barra ---------- */
.ag-cabecalho { margin-bottom: 14px; }
.ag-sub::first-letter { text-transform: uppercase; }
.ag-barra { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; margin-bottom: 12px; }
.ag-nav { gap: 6px; }
.ag-data { width: auto; }
.ag-resumo { white-space: nowrap; }

.chips-prof { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-prof {
  display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--border-strong); background: var(--surface); border-radius: 99px;
  padding: 5px 12px; font-size: 13px; cursor: pointer; white-space: nowrap; color: var(--text-2); font-weight: 560; transition: opacity 0.12s, background 0.12s;
}
.chip-prof:hover { background: var(--surface-2); }
.chip-prof.ativo { border-color: var(--primary); background: var(--primary-50); color: var(--primary-700); }
.ag-filtro { margin-bottom: 12px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.ag-filtro::-webkit-scrollbar { display: none; }
.ag-filtro .chip-prof.ativo { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.ag-filtro .chip-prof:not(.ativo) { opacity: 0.55; }

.ag-pendentes { margin-bottom: 12px; }
.ag-pend-item { display: flex; align-items: center; gap: 10px; background: rgba(255, 255, 255, 0.65); padding: 8px 10px; border-radius: 10px; flex-wrap: wrap; color: var(--text); }

/* ---------- agenda: visão Dia ---------- */
.ag-dia { overflow: hidden; }
.ag-fechado { display: flex; gap: 6px; align-items: center; padding: 8px 14px; color: #7a4d04; background: var(--warning-50); }
.ag-wrap { max-height: calc(100vh - 250px); min-height: 440px; overflow: auto; overscroll-behavior: contain; }
.ag-grade { --colmin: 150px; min-width: calc(56px + var(--cols) * var(--colmin)); }
.ag-cab, .ag-corpo { display: grid; grid-template-columns: 56px repeat(var(--cols), minmax(var(--colmin), 1fr)); }
.ag-cab { position: sticky; top: 0; z-index: 8; background: var(--surface); border-bottom: 1px solid var(--border); }
.ag-canto { position: sticky; left: 0; z-index: 9; background: var(--surface); }
.ag-cab-prof { display: flex; gap: 8px; align-items: center; padding: 10px; border-left: 1px solid var(--border); min-width: 0; }
.ag-corpo { position: relative; }
.ag-horas { position: sticky; left: 0; z-index: 7; background: var(--surface); height: 100%; }
.ag-hora { position: absolute; right: 8px; transform: translateY(3px); font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.ag-col {
  position: relative; border-left: 1px solid var(--border); cursor: pointer;
  background-image: linear-gradient(to bottom, var(--border) 1px, transparent 1px), linear-gradient(to bottom, #f1f1f6 1px, transparent 1px);
  background-size: 100% 96px, 100% 48px;
}
.ag-fora {
  position: absolute; left: 0; right: 0; z-index: 0;
  background: repeating-linear-gradient(135deg, rgba(25, 25, 50, 0.035) 0 6px, transparent 6px 12px), rgba(240, 240, 245, 0.55);
}
.ag-hover {
  position: absolute; left: 3px; right: 3px; z-index: 1; border-radius: 8px; background: var(--primary-50); color: var(--primary-700);
  font-size: 11.5px; font-weight: 650; padding: 3px 8px; pointer-events: none; border: 1px dashed var(--primary-100);
}
.ag-bloqueio {
  position: absolute; left: 2px; right: 2px; z-index: 1; border-radius: 8px; border: 1px dashed var(--border-strong); cursor: pointer;
  background: repeating-linear-gradient(135deg, #ebebf1 0 6px, #f7f7fa 6px 12px); color: var(--text-2); font-size: 11.5px; font-weight: 560;
  padding: 3px 7px; display: flex; gap: 5px; align-items: flex-start; overflow: hidden;
}
.ag-bloco {
  position: absolute; z-index: 2; border-radius: 8px; padding: 4px 7px; font-size: 12px; line-height: 1.3; overflow: hidden; cursor: grab;
  background: #f1f1fb; background: color-mix(in srgb, var(--cor) 14%, white); border-left: 3px solid var(--cor);
  box-shadow: 0 1px 2px rgba(25, 25, 50, 0.08); user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  transition: box-shadow 0.12s, opacity 0.12s;
}
.ag-bloco:hover { box-shadow: 0 3px 12px rgba(25, 25, 50, 0.16); z-index: 4; }
.ag-bloco.curto { padding: 2px 6px; }
.ag-bloco-topo { display: flex; gap: 5px; align-items: center; white-space: nowrap; min-width: 0; }
.ag-bloco-topo .icone { color: var(--text-2); }
.ag-hora-bloco { font-variant-numeric: tabular-nums; color: var(--text-2); font-size: 11px; }
.ag-serv { color: var(--text-2); }
.ag-st { font-size: 10.5px; color: var(--text-3); margin-top: 2px; }
.ag-bloco.st-pendente { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--warning) 14%, white) 0 7px, #fff 7px 14px); border-left: 3px dashed var(--warning); }
.ag-bloco.st-confirmado .ag-st { color: var(--primary-700); }
.ag-bloco.st-chegou, .ag-bloco.st-em_atendimento { background: color-mix(in srgb, var(--cor) 28%, white); }
.ag-bloco.st-em_atendimento { box-shadow: inset 0 0 0 1.5px var(--cor); }
.ag-bloco.st-concluido { background: color-mix(in srgb, var(--cor) 7%, #f6f6f8); opacity: 0.85; }
.ag-bloco.st-faltou { opacity: 0.55; border-left-color: var(--danger); background: #f6f6f8; }
.ag-bloco.st-faltou .forte { text-decoration: line-through; }
.ag-bloco.origem { opacity: 0.3; }
.ag-fantasma { opacity: 0.95; z-index: 6; pointer-events: none; box-shadow: var(--shadow-lg); outline: 2px dashed var(--cor); cursor: grabbing; }
.ag-agora { position: absolute; left: 56px; right: 0; height: 0; border-top: 2px solid var(--danger); z-index: 6; pointer-events: none; }
.ag-agora span { position: absolute; left: -54px; top: -10px; background: var(--danger); color: #fff; font-size: 10.5px; padding: 1px 5px; border-radius: 6px; font-weight: 650; }
.ag-dica { padding: 8px 14px; border-top: 1px solid var(--border); }

/* ---------- agenda: visão Semana ---------- */
.ag-semana { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.ag-sem-dia { overflow: hidden; min-height: 180px; display: flex; flex-direction: column; }
.ag-sem-dia.hoje { border-color: var(--primary); }
.ag-sem-cab { display: flex; flex-direction: column; align-items: center; width: 100%; border: 0; background: var(--surface-2); padding: 8px 4px; cursor: pointer; gap: 1px; }
.ag-sem-cab:hover { background: var(--surface-3); }
.ag-sem-dia.hoje .ag-sem-cab { background: var(--primary-50); color: var(--primary-700); }
.ag-sem-num { font-size: 20px; font-weight: 720; line-height: 1.1; }
.ag-sem-lista { padding: 6px; display: flex; flex-direction: column; gap: 5px; }
.ag-sem-bl { display: flex; gap: 4px; align-items: center; color: var(--text-3); padding: 2px 4px; }
.ag-sem-item {
  display: flex; gap: 6px; text-align: left; border: 0; border-left: 3px solid var(--cor); border-radius: 7px; padding: 5px 7px; font-size: 12px;
  cursor: pointer; width: 100%; line-height: 1.3; min-width: 0; background: #f3f3fb; background: color-mix(in srgb, var(--cor) 11%, white);
}
.ag-sem-item:hover { filter: brightness(0.97); }
.ag-sem-item.st-faltou, .ag-sem-item.st-concluido { opacity: 0.6; }
.ag-sem-item.st-pendente { border-left-style: dashed; border-left-color: var(--warning); }
.ag-sem-hora { font-weight: 650; font-variant-numeric: tabular-nums; }

/* ---------- agenda: visão Lista ---------- */
.ag-li-hora { display: flex; flex-direction: column; width: 46px; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.ag-li-barra { width: 4px; align-self: stretch; border-radius: 4px; flex-shrink: 0; }
.ag-li.apagado { opacity: 0.55; }
.ag-li-preco { color: var(--text-2); font-size: 13px; white-space: nowrap; }
.ag-li-vazio { width: 0; }

/* ---------- agenda: detalhe e formulários ---------- */
.ag-det { display: flex; flex-direction: column; gap: 10px; background: var(--surface-2); border-radius: 12px; padding: 12px 14px; }
.ag-det-linha { display: flex; gap: 10px; align-items: flex-start; }
.ag-det-linha > .icone { color: var(--text-3); margin-top: 2px; }
.ag-whats { border-top: 1px solid var(--border); padding-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.slots { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; max-height: 152px; overflow-y: auto; }
.slot {
  border: 1px solid var(--border-strong); background: var(--surface); border-radius: 8px; padding: 5px 10px; font-size: 13px; cursor: pointer;
  font-variant-numeric: tabular-nums; font-weight: 560; color: var(--text);
}
.slot:hover { border-color: var(--primary); color: var(--primary-700); }
.slot.ativo { background: var(--primary); color: #fff; border-color: var(--primary); }
.ag-item-form { border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; background: #fbfbfd; display: flex; flex-direction: column; gap: 10px; }
.ag-data-campo, .ag-hora-campo { width: auto; min-width: 150px; }
.ag-repetir { gap: 8px; }
.ag-repetir .selecao { width: auto; }

/* ---------- serviços ---------- */
.sv-icone { width: 36px; height: 36px; border-radius: 10px; background: var(--primary-50); color: var(--primary); display: grid; place-items: center; flex-shrink: 0; }
.sv-profs { display: flex; align-items: center; padding-left: 6px; }
.sv-profs > span { margin-left: -6px; }
.sv-profs .avatar { box-shadow: 0 0 0 2px var(--surface); }
.sv-preco { min-width: 92px; }
.sv-alternar { min-height: 40px; display: flex; align-items: center; }

/* ---------- profissionais ---------- */
.pf-cartao { padding: 18px; display: flex; flex-direction: column; gap: 14px; position: relative; overflow: hidden; }
.pf-cartao.arquivado { opacity: 0.6; }
.pf-faixa { position: absolute; top: 0; left: 0; right: 0; height: 4px; }
.pf-nome { font-size: 15.5px; }
.pf-info { display: flex; flex-direction: column; gap: 6px; color: var(--text-2); font-size: 13.5px; }
.pf-info .icone { color: var(--text-3); }
.paleta { display: flex; flex-wrap: wrap; gap: 8px; }
.paleta .cor { width: 32px; height: 32px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center; color: #fff; }
.paleta .cor.ativa { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--text); }
.hor-resumo { display: flex; flex-direction: column; gap: 6px; background: var(--surface-2); border-radius: 12px; padding: 12px 14px; }
.hor-lista { display: flex; flex-direction: column; }
.hor-dia { display: grid; grid-template-columns: 140px 1fr auto; gap: 10px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--border); }
.hor-dia:last-child { border-bottom: 0; }
.hor-nome { padding-top: 6px; }
.hor-faixas { display: flex; flex-direction: column; gap: 6px; }
.hor-faixa { display: flex; align-items: center; gap: 6px; }
.hor-faixa .entrada { width: 112px; }
.hor-folga { padding-top: 8px; display: block; }
.hor-acoes { display: flex; gap: 2px; }
.sv-grupo { border: 1px solid var(--border); border-radius: 12px; padding: 4px 12px; }
.sv-grupo-cab { padding: 6px 0; border-bottom: 1px solid var(--border); }
.sv-linha { display: flex; align-items: center; gap: 10px; padding: 6px 0; min-height: 44px; }
.sv-pct { width: 104px; flex-shrink: 0; }
.sv-pct .entrada { border-radius: 10px 0 0 10px; }
.sv-pct span { border-left: 0; border-right: 1px solid var(--border-strong); border-radius: 0 10px 10px 0; }

/* ---------- celular ---------- */
@media (max-width: 1100px) {
  .ag-semana { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .ag-wrap { max-height: calc(100vh - 280px); }
}
@media (max-width: 640px) {
  .ag-grade { --colmin: 128px; }
  .ag-cab-prof { padding: 8px 6px; gap: 6px; }
  .ag-cab-prof .avatar { display: none; }
  .ag-wrap { max-height: calc(100vh - 300px); min-height: 380px; }
  .ag-semana { grid-template-columns: 1fr; }
  .ag-sem-dia { min-height: 0; flex-direction: row; }
  .ag-sem-cab { width: 64px; flex-shrink: 0; justify-content: flex-start; padding-top: 10px; }
  .ag-sem-lista { flex: 1; min-width: 0; }
  .ag-li-preco { display: none; }
  .ag-cabecalho .acoes { width: 100%; flex-wrap: nowrap; }
  .ag-cabecalho .acoes .btn { flex: 1 1 0; min-width: 0; padding: 0 10px; }
  .ag-resumo { width: 100%; }
  .sv-profs { display: none; }
  .hor-dia { grid-template-columns: 1fr auto; }
  .hor-faixas { grid-column: 1 / -1; grid-row: 2; }
  .hor-faixa .entrada { width: 100%; }
  .ag-dica { display: none; }
}
