/* Link publico de agendamento — Modulo Servicos.
   Superficie de cliente final: identidade da empresa no topo, uma decisao por
   vez, area de toque confortavel e contraste AA nas duas variacoes de fundo. */

:root {
  --ap-brand: #001359;
  --ap-accent: #FF6D07;
  --ap-accent-strong: #E85F00;
  --ap-canvas: #F4F7FC;
  --ap-surface: #FFFFFF;
  --ap-surface-soft: #F6F8FC;
  --ap-text: #14202E;
  --ap-text-muted: #5A6A7D;
  --ap-text-dim: #8695A6;
  --ap-border: #DCE3ED;
  --ap-border-strong: #C3CEDC;
  --ap-danger: #C62828;
  --ap-ok: #1B7A4B;
  --ap-radius: 14px;
  --ap-radius-sm: 10px;
  --ap-shadow: 0 18px 46px rgba(16, 32, 56, .12);
  --ap-font: 'Sora', system-ui, -apple-system, Segoe UI, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background: var(--ap-canvas);
  color: var(--ap-text);
  font-family: var(--ap-font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.ap-root {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 16px 40px;
}

/* ── Carregamento inicial ─────────────────────────────────────────────── */

.ap-boot {
  margin: auto;
  display: flex;
  gap: 8px;
}

.ap-boot-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--ap-border-strong);
  animation: ap-pulse 1s infinite ease-in-out;
}

.ap-boot-dot:nth-child(2) { animation-delay: .15s; }
.ap-boot-dot:nth-child(3) { animation-delay: .3s; }

@keyframes ap-pulse {
  0%, 100% { opacity: .3; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-4px); }
}

/* ── Cabecalho da empresa ─────────────────────────────────────────────── */

.ap-shell {
  width: 100%;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ap-header {
  margin-top: 24px;
  background: var(--ap-brand);
  color: #FFFFFF;
  border-radius: var(--ap-radius);
  padding: 20px 20px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--ap-shadow);
}

/* A logo ocupa 40% do cabecalho; o texto fica com o restante. */
.ap-header-logo {
  flex: 0 0 40%;
  max-width: 40%;
  min-height: 68px;
  padding: 8px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.ap-header-logo img {
  width: 100%;
  max-height: 92px;
  object-fit: contain;
}

.ap-header-initials {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: .5px;
}

.ap-header-text { min-width: 0; flex: 1; }

.ap-header h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 600;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.ap-header p {
  margin: 4px 0 0;
  font-size: 13px;
  font-weight: 300;
  color: rgba(255, 255, 255, .78);
  overflow-wrap: anywhere;
}

/* ── Progresso ────────────────────────────────────────────────────────── */

.ap-steps {
  display: flex;
  gap: 6px;
  padding: 0 2px;
}

.ap-steps-item {
  flex: 1;
  height: 4px;
  border-radius: 999px;
  background: var(--ap-border);
}

.ap-steps-item.is-done { background: var(--ap-accent); }
.ap-steps-item.is-current { background: var(--ap-accent); opacity: .55; }

/* ── Cartoes ──────────────────────────────────────────────────────────── */

.ap-card {
  background: var(--ap-surface);
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-radius);
  padding: 18px;
}

.ap-card[data-locked="true"] {
  opacity: .5;
  pointer-events: none;
}

.ap-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.ap-card-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.ap-card-hint {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--ap-text-muted);
}

.ap-eyebrow {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--ap-text-dim);
}

/* ── Lista de opcoes (profissionais, servicos) ────────────────────────── */

.ap-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ap-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-radius-sm);
  background: var(--ap-surface);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .12s ease, background .12s ease;
}

.ap-option:hover { border-color: var(--ap-border-strong); background: var(--ap-surface-soft); }

.ap-option[aria-pressed="true"] {
  border-color: var(--ap-accent);
  background: color-mix(in srgb, var(--ap-accent) 8%, var(--ap-surface));
}

.ap-option-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: var(--ap-surface-soft);
  border: 1px solid var(--ap-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--ap-text-muted);
  overflow: hidden;
}

.ap-option-avatar img { width: 100%; height: 100%; object-fit: cover; }

.ap-option-body { flex: 1; min-width: 0; }

.ap-option-name {
  display: block;
  font-size: 14.5px;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.ap-option-meta {
  display: block;
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--ap-text-muted);
  overflow-wrap: anywhere;
}

.ap-option-price {
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
}

.ap-option-check {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 1px solid var(--ap-border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ap-option[aria-pressed="true"] .ap-option-check {
  border-color: var(--ap-accent);
  background: var(--ap-accent);
  color: #FFFFFF;
}

.ap-option-check svg { width: 12px; height: 12px; display: none; }
.ap-option[aria-pressed="true"] .ap-option-check svg { display: block; }

/* ── Dias e horarios ──────────────────────────────────────────────────── */

.ap-days {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 10px;
  scrollbar-width: thin;
}

.ap-days::-webkit-scrollbar { height: 5px; }
.ap-days::-webkit-scrollbar-thumb { background: var(--ap-border-strong); border-radius: 999px; }

.ap-day {
  flex: 0 0 auto;
  min-width: 62px;
  padding: 9px 10px;
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-radius-sm);
  background: var(--ap-surface);
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-align: center;
  line-height: 1.2;
}

.ap-day:hover { border-color: var(--ap-border-strong); }

.ap-day[aria-pressed="true"] {
  border-color: var(--ap-accent);
  background: var(--ap-accent);
  color: #FFFFFF;
}

.ap-day-dow {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--ap-text-dim);
}

.ap-day[aria-pressed="true"] .ap-day-dow { color: rgba(255, 255, 255, .82); }

.ap-day-number { display: block; font-size: 17px; font-weight: 600; }

.ap-day-month {
  display: block;
  font-size: 10.5px;
  color: var(--ap-text-dim);
  text-transform: uppercase;
}

.ap-day[aria-pressed="true"] .ap-day-month { color: rgba(255, 255, 255, .82); }

.ap-shift + .ap-shift { margin-top: 14px; }

.ap-shift-title {
  margin: 0 0 8px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--ap-text-dim);
}

.ap-form { display: block; }

.ap-slots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 8px;
}

.ap-slot {
  padding: 11px 6px;
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-radius-sm);
  background: var(--ap-surface);
  color: inherit;
  font: inherit;
  font-size: 14.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
}

.ap-slot:hover { border-color: var(--ap-border-strong); background: var(--ap-surface-soft); }

.ap-slot[aria-pressed="true"] {
  border-color: var(--ap-accent);
  background: var(--ap-accent);
  color: #FFFFFF;
}

/* ── Formulario ───────────────────────────────────────────────────────── */

.ap-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }

.ap-field label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--ap-text-dim);
}

.ap-field input {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-radius-sm);
  background: var(--ap-surface);
  color: var(--ap-text);
  font: inherit;
  font-size: 16px; /* evita zoom automatico no iOS */
}

.ap-field input:focus {
  outline: none;
  border-color: var(--ap-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ap-accent) 22%, transparent);
}

.ap-field-error {
  font-size: 12.5px;
  color: var(--ap-danger);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
}

/* ── Convite de agenda ────────────────────────────────────────────────── */

.ap-invite {
  margin-top: 4px;
  padding: 14px;
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-radius-sm);
  background: var(--ap-surface-soft);
}

.ap-invite-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.ap-invite-hint {
  margin: 4px 0 12px;
  font-size: 12.5px;
  color: var(--ap-text-muted);
}

.ap-invite .ap-field { margin-bottom: 0; }

.ap-invite-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.ap-invite-actions .ap-button {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.ap-invite-sent {
  margin: 0 0 14px;
  font-size: 12.5px;
  color: var(--ap-text-muted);
}

/* ── Acoes ────────────────────────────────────────────────────────────── */

.ap-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.ap-button {
  flex: 1;
  padding: 13px 16px;
  border-radius: var(--ap-radius-sm);
  border: 1px solid transparent;
  background: var(--ap-accent);
  color: #FFFFFF;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  min-height: 46px;
}

.ap-button:hover:not(:disabled) { background: var(--ap-accent-strong); }

.ap-button:disabled { opacity: .55; cursor: not-allowed; }

.ap-button-ghost {
  flex: 0 0 auto;
  background: transparent;
  color: var(--ap-text-muted);
  border-color: var(--ap-border);
  font-weight: 500;
}

.ap-button-ghost:hover:not(:disabled) { background: var(--ap-surface-soft); color: var(--ap-text); }

/* ── Resumo e estados ─────────────────────────────────────────────────── */

.ap-summary {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border-radius: var(--ap-radius-sm);
  background: var(--ap-surface-soft);
  border: 1px solid var(--ap-border);
  margin-bottom: 16px;
}

.ap-summary-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13.5px;
}

.ap-summary-row span:first-child { color: var(--ap-text-muted); }
.ap-summary-row span:last-child { font-weight: 500; text-align: right; overflow-wrap: anywhere; }

.ap-empty, .ap-loading {
  padding: 22px 12px;
  text-align: center;
  font-size: 13.5px;
  color: var(--ap-text-muted);
}

.ap-alert {
  margin-bottom: 14px;
  padding: 11px 12px;
  border-radius: var(--ap-radius-sm);
  border: 1px solid color-mix(in srgb, var(--ap-danger) 35%, var(--ap-border));
  background: color-mix(in srgb, var(--ap-danger) 8%, var(--ap-surface));
  color: var(--ap-danger);
  font-size: 13.5px;
}

.ap-done {
  text-align: center;
  padding: 26px 18px;
}

.ap-done-mark {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--ap-ok) 12%, var(--ap-surface));
  color: var(--ap-ok);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ap-done h2 { margin: 0 0 6px; font-size: 18px; font-weight: 600; }
.ap-done p { margin: 0 0 16px; font-size: 14px; color: var(--ap-text-muted); }

.ap-footer {
  margin-top: 4px;
  text-align: center;
  font-size: 11.5px;
  color: var(--ap-text-dim);
}

.ap-notice {
  margin: auto;
  max-width: 420px;
  text-align: center;
  padding: 28px 18px;
}

.ap-notice h1 { font-size: 18px; font-weight: 600; margin: 0 0 8px; }
.ap-notice p { margin: 0; font-size: 14px; color: var(--ap-text-muted); }

/* ── Desktop ──────────────────────────────────────────────────────────── */

@media (min-width: 900px) {
  .ap-shell { max-width: 620px; }
  .ap-header { margin-top: 42px; padding: 24px; }
  .ap-header h1 { font-size: 21px; }
}

@media (prefers-reduced-motion: reduce) {
  .ap-boot-dot { animation: none; }
}
