/* ============================================================
   COCAR SAGRADO — Estilos do Sistema de Agendamento
   ============================================================ */

/* ---- Variáveis ---- */
:root {
  --primary:   #6366f1;
  --secondary: #10b981;
  --accent:    #fbbf24;
  --bg:        #f9fafb;
  --surface:   #ffffff;
  --text:      #1f2937;
  --text-muted:#6b7280;
  --border:    #e5e7eb;
  --danger:    #ef4444;
  --radius:    12px;
  --shadow:    0 2px 8px rgba(0,0,0,.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.12);
}

/* ---- Reset base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }

/* ---- Layout ---- */
.ag-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 16px 60px;
}

/* ---- Seção de passo ---- */
.ag-section { display: none; }
.ag-section.active { display: block; }

.ag-section-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--text);
}

/* ---- Formulário ---- */
.ag-form { display: flex; flex-direction: column; gap: 16px; }
.ag-form-group { display: flex; flex-direction: column; gap: 6px; }
.ag-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

label { font-size: .875rem; font-weight: 600; }

input, textarea, select {
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: .95rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color .2s;
  width: 100%;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
}
input.error, textarea.error, select.error { border-color: var(--danger); }

.ag-error-msg { font-size: .8rem; color: var(--danger); }

.ag-phone-row { display: flex; gap: 8px; }
.ag-ddi-select { width: auto; min-width: 108px; flex-shrink: 0; padding-right: 8px; }
.ag-phone-row input { flex: 1; }

textarea { resize: vertical; min-height: 90px; }

/* ---- Resumo do pedido ---- */
.ag-resumo {
  background: linear-gradient(135deg, #eef2ff, #f0fdf4);
  border: 2px solid var(--primary);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}
.ag-resumo h3 { font-size: 1rem; font-weight: 700; margin-bottom: 14px; color: var(--primary); }
.ag-resumo-row {
  display: flex;
  justify-content: space-between;
  font-size: .9rem;
  padding: 5px 0;
  border-bottom: 1px solid rgba(99,102,241,.12);
}
.ag-resumo-row:last-child { border-bottom: none; }
.ag-resumo-row span:last-child { font-weight: 600; }
.ag-resumo-total {
  display: flex;
  justify-content: space-between;
  font-size: 1.05rem;
  font-weight: 700;
  padding-top: 12px;
  margin-top: 6px;
  color: var(--primary);
}

/* ---- Botões ---- */
.ag-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 28px;
  border: none;
  border-radius: 10px;
  font-size: .95rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .2s, transform .2s;
}
.ag-btn:hover { opacity: .9; transform: translateY(-1px); }
.ag-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.ag-btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  width: 100%;
}
.ag-btn-outline {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
}
.ag-btn-whatsapp { background: #25d366; color: #fff; }
.ag-btn-copy     { background: var(--accent); color: var(--text); }
.ag-btn-danger   { background: var(--danger); color: #fff; }
.ag-btn-sm { padding: 7px 14px; font-size: .8rem; }

/* ---- Loading ---- */
.ag-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--text-muted);
  gap: 10px;
}
.ag-spinner {
  width: 22px; height: 22px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.ag-empty {
  text-align: center;
  padding: 32px;
  color: var(--text-muted);
  font-size: .95rem;
}

/* ---- Mensagem de sucesso/erro ---- */
.ag-alert {
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 16px;
  font-size: .9rem;
  font-weight: 600;
}
.ag-alert-success { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.ag-alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.ag-alert-info    { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }

/* ============================================================
   PÁGINA DE PAGAMENTO
   ============================================================ */
.pag-container { max-width: 680px; margin: 0 auto; padding: 24px 16px 60px; }

.pag-chave-box {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  margin-bottom: 24px;
}
.pag-chave-label { font-size: .85rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 8px; }
.pag-chave-valor { font-size: clamp(1.1rem, 4vw, 1.6rem); font-weight: 900; color: var(--text); letter-spacing: .08em; margin-bottom: 14px; font-family: monospace; word-break: break-all; }
.pag-chave-copia { font-size: .8rem; color: var(--text-muted); margin-top: 6px; }

.pag-resumo-box {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 24px;
}
.pag-resumo-box h3 { font-size: .95rem; font-weight: 700; margin-bottom: 12px; }
.pag-resumo-linha {
  display: flex;
  justify-content: space-between;
  font-size: .875rem;
  padding: 5px 0;
  color: var(--text-muted);
}
.pag-resumo-linha strong { color: var(--text); }

/* Abas de pagamento */
.pag-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  background: var(--bg);
  padding: 4px;
  border-radius: var(--radius);
  border: 2px solid var(--border);
}
.pag-tab {
  flex: 1;
  padding: 10px 6px;
  text-align: center;
  cursor: pointer;
  border-radius: 9px;
  font-size: .85rem;
  font-weight: 600;
  transition: background .2s, color .2s;
  color: var(--text-muted);
}
.pag-tab.active { background: var(--primary); color: #fff; }

.pag-panel { display: none; }
.pag-panel.active { display: block; }

.pag-metodo-box {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.pag-metodo-box h3 { font-size: 1rem; font-weight: 700; margin-bottom: 16px; }

.pag-pix-chave {
  background: var(--bg);
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 14px;
  text-align: center;
  font-size: 1rem;
  font-weight: 700;
  font-family: monospace;
  color: var(--primary);
  margin-bottom: 12px;
  word-break: break-all;
}
.pag-instrucoes { list-style: none; display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.pag-instrucoes li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: .875rem;
}
.pag-instrucoes .step-num {
  min-width: 24px; height: 24px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem;
  font-weight: 700;
}
.pag-qrcode {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}
.pag-qrcode img,
.pag-qrcode canvas {
  border-radius: 8px;
  border: 6px solid #fff;
  box-shadow: 0 2px 12px rgba(0,0,0,0.12);
}

.pag-btns { display: flex; flex-direction: column; gap: 10px; }

/* ============================================================
   PAINEL ADMIN
   ============================================================ */
.adm-layout { display: flex; min-height: 100vh; }

.adm-sidebar {
  width: 220px;
  background: linear-gradient(180deg, var(--primary) 0%, #4f46e5 100%);
  color: #fff;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  flex-shrink: 0;
}
.adm-sidebar h2 { font-size: 1rem; font-weight: 800; letter-spacing: .05em; }
.adm-sidebar p  { font-size: .78rem; opacity: .7; margin-top: 2px; }
.adm-nav a {
  display: block;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: .875rem;
  font-weight: 600;
  color: rgba(255,255,255,.8);
  transition: background .2s;
  margin-bottom: 4px;
}
.adm-nav a:hover, .adm-nav a.active { background: rgba(255,255,255,.15); color: #fff; }

.adm-main { flex: 1; padding: 28px; overflow-y: auto; }
.adm-main-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 28px; flex-wrap: wrap; gap: 12px; }
.adm-main-header h1 { font-size: 1.3rem; font-weight: 800; }

/* Stats */
.adm-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; margin-bottom: 28px; }
.adm-stat-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.adm-stat-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px; height: 100%;
}
.adm-stat-card.hoje::after    { background: var(--primary); }
.adm-stat-card.pendente::after{ background: var(--accent); }
.adm-stat-card.pagos::after   { background: var(--secondary); }
.adm-stat-card.total::after   { background: #8b5cf6; }

.adm-stat-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin-bottom: 6px; }
.adm-stat-value { font-size: 1.8rem; font-weight: 800; }
.adm-stat-card.hoje .adm-stat-value    { color: var(--primary); }
.adm-stat-card.pendente .adm-stat-value{ color: #d97706; }
.adm-stat-card.pagos .adm-stat-value   { color: var(--secondary); }
.adm-stat-card.total .adm-stat-value   { color: #8b5cf6; }

/* Filtros */
.adm-filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  background: var(--surface);
  padding: 14px;
  border-radius: var(--radius);
  border: 2px solid var(--border);
}
.adm-filters select, .adm-filters input { max-width: 180px; }

/* Lista agendamentos */
.adm-list { display: flex; flex-direction: column; gap: 12px; }

.adm-item {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow .2s;
}
.adm-item:hover { box-shadow: var(--shadow); }

.adm-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  cursor: pointer;
  flex-wrap: wrap;
  gap: 10px;
}
.adm-item-info h4 { font-size: .95rem; font-weight: 700; }
.adm-item-info p  { font-size: .82rem; color: var(--text-muted); margin-top: 2px; }

.adm-item-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* Badges de status */
.adm-badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 99px;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.adm-badge-pendente   { background: #fef3c7; color: #92400e; }
.adm-badge-pago       { background: #d1fae5; color: #065f46; }
.adm-badge-confirmado { background: #dbeafe; color: #1e40af; }
.adm-badge-atendido   { background: #ede9fe; color: #5b21b6; }
.adm-badge-cancelado  { background: #fee2e2; color: #991b1b; }

.adm-item-details {
  display: none;
  padding: 0 18px 16px;
  border-top: 1px solid var(--border);
}
.adm-item-details.open { display: block; }

.adm-details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  padding: 14px 0;
}
.adm-detail-item label { font-size: .72rem; text-transform: uppercase; color: var(--text-muted); display: block; margin-bottom: 2px; }
.adm-detail-item span  { font-size: .875rem; font-weight: 600; }

.adm-item-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 4px; }

/* ============================================================
   RESPONSIVIDADE
   ============================================================ */
@media (max-width: 640px) {
  .ag-form-row { grid-template-columns: 1fr; }
  .adm-layout  { flex-direction: column; }
  .adm-sidebar { width: 100%; padding: 16px; }
  .adm-main    { padding: 16px; }
  .adm-stats   { grid-template-columns: 1fr 1fr; }
  .pag-tabs    { flex-direction: column; }
}

@media (max-width: 480px) {
  .ag-container   { padding: 16px 12px 48px; }
  .pag-container  { padding: 16px 12px 48px; }
  .pag-chave-box  { padding: 16px; }
  .pag-resumo-box { padding: 14px; }
  .pag-metodo-box { padding: 16px; }
  .seletor-card   { padding: 24px 14px 18px; max-width: 100%; }
  .seletor-nome   { font-size: 1.15rem; }
  .seletor-tier-opt { padding: 10px 14px; }
  .seletor-qty-wrap { gap: 16px; }
  .ag-btn         { padding: 12px 16px; font-size: .9rem; }
  .ag-resumo      { padding: 14px; }
  .pag-btns       { gap: 8px; }
}

@media (max-width: 400px) {
  .adm-stats { grid-template-columns: 1fr; }
  .pag-tabs  { flex-direction: column; }
}

/* ============================================================
   SELETOR DE QUANTIDADE / TIER
   ============================================================ */
.seletor-overlay {
  position: fixed;
  inset: 0;
  background: rgba(1, 20, 10, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.seletor-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.seletor-card {
  position: relative;
  background: #F8F5EE;
  border: 1.5px solid rgba(201, 168, 76, 0.4);
  border-radius: 20px;
  padding: 36px 28px 28px;
  max-width: 390px;
  width: 100%;
  box-shadow: 0 24px 64px rgba(1, 55, 24, 0.35);
  transform: translateY(24px) scale(0.96);
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-align: center;
}
.seletor-overlay.open .seletor-card {
  transform: translateY(0) scale(1);
}

.seletor-close {
  position: absolute;
  top: 10px; right: 10px;
  width: 44px; height: 44px;
  border: none;
  background: rgba(1, 55, 24, 0.08);
  border-radius: 50%;
  cursor: pointer;
  font-size: 13px;
  color: #013718;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  font-family: inherit;
}
.seletor-close:hover { background: rgba(1, 55, 24, 0.16); }

.seletor-icone { font-size: 2rem; margin-bottom: 8px; }

.seletor-nome {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: #013718;
  margin-bottom: 4px;
}

.seletor-pergunta {
  font-size: 0.78rem;
  color: #6b7280;
  margin-bottom: 22px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

/* Tier options */
.seletor-tiers {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}
.seletor-tier-opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border: 1.5px solid rgba(1, 55, 24, 0.15);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  background: transparent;
  text-align: left;
}
.seletor-tier-opt:hover {
  border-color: #C9A84C;
  background: rgba(201, 168, 76, 0.06);
}
.seletor-tier-opt.selected {
  border-color: #C9A84C;
  background: rgba(201, 168, 76, 0.1);
  box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.2);
}
.tier-label {
  font-weight: 600;
  color: #013718;
  font-size: 0.9rem;
}
.tier-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}
.tier-duracao { font-size: 0.72rem; color: #6b7280; }
.tier-preco   { font-size: 1rem; font-weight: 700; color: #B8902A; }

/* Quantity stepper */
.seletor-qty-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  margin-bottom: 16px;
}
.seletor-qty-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1.5px solid #C9A84C;
  background: transparent;
  color: #013718;
  font-size: 1.5rem;
  font-weight: 300;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
  line-height: 1;
  font-family: inherit;
}
.seletor-qty-btn:hover { background: #C9A84C; color: #022D13; }

.seletor-qty-num {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(1.8rem, 5vw, 2.4rem);
  font-weight: 700;
  color: #013718;
  min-width: 40px;
  text-align: center;
  line-height: 1;
}

/* Resumo */
.seletor-resumo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 20px;
  background: rgba(1, 55, 24, 0.06);
  border-radius: 10px;
  margin-bottom: 22px;
}
.seletor-resumo-preco { font-size: 1.15rem; font-weight: 700; color: #B8902A; }
.seletor-resumo-sep   { color: #9ca3af; }
.seletor-resumo-dur   { font-size: 0.85rem; color: #6b7280; font-weight: 500; }

/* Actions */
.seletor-actions { display: flex; gap: 10px; }

.seletor-btn-cancel {
  flex: 1;
  padding: 13px;
  border: 1.5px solid rgba(1, 55, 24, 0.2);
  border-radius: 10px;
  background: transparent;
  color: #6b7280;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s;
  font-family: inherit;
}
.seletor-btn-cancel:hover { border-color: rgba(1, 55, 24, 0.4); color: #013718; }

.seletor-btn-confirm {
  flex: 2;
  padding: 13px 20px;
  border: none;
  border-radius: 10px;
  background: #C9A84C;
  color: #022D13;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  font-family: inherit;
  letter-spacing: 0.03em;
}
.seletor-btn-confirm:hover    { background: #B8902A; }
.seletor-btn-confirm:disabled { opacity: 0.35; cursor: not-allowed; }

@media (max-width: 420px) {
  .seletor-card    { padding: 28px 18px 22px; }
  .seletor-nome    { font-size: 1.2rem; }
  .seletor-qty-num { font-size: 2rem; }
}

/* ============================================================
   VAGAS — Calendário lado cliente
   ============================================================ */
.ag-vagas-lista {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 0;
}

.ag-vagas-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #fff;
  border: 2px solid var(--border, #DDD5C8);
  border-radius: 14px;
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s, transform .15s;
  text-align: left;
  width: 100%;
  font-family: inherit;
}

.ag-vagas-card:hover {
  border-color: var(--secondary, #C9A84C);
  box-shadow: 0 4px 16px rgba(1,55,24,.10);
  transform: translateY(-1px);
}

.ag-vagas-card.selected {
  border-color: var(--primary, #013718);
  background: linear-gradient(135deg, #fff 80%, rgba(1,55,24,.04) 100%);
  box-shadow: 0 4px 18px rgba(1,55,24,.14);
}

.ag-vagas-data {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 52px;
}

.ag-vagas-dia-num {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2rem;
  font-weight: 600;
  line-height: 1;
  color: var(--primary, #013718);
}

.ag-vagas-dia-nome {
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted, #8C8478);
}

.ag-vagas-mes {
  font-size: .72rem;
  color: var(--text-muted, #8C8478);
  margin-top: 1px;
}

.ag-vagas-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ag-vagas-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .78rem;
  font-weight: 500;
  border-radius: 20px;
  padding: 3px 10px;
  align-self: flex-start;
}

.ag-vagas-info.vagas-ok .ag-vagas-badge {
  background: rgba(1,55,24,.08);
  color: var(--primary, #013718);
}

.ag-vagas-info.vagas-poucas .ag-vagas-badge {
  background: rgba(201,168,76,.15);
  color: #7a5c0a;
}

.ag-vagas-action {
  font-size: .8rem;
  color: var(--text-muted, #8C8478);
  white-space: nowrap;
}

.ag-vagas-card.selected .ag-vagas-action {
  color: var(--primary, #013718);
  font-weight: 600;
}

.ag-empty-vagas {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted, #8C8478);
  font-size: .9rem;
  line-height: 1.6;
}

@media (max-width: 420px) {
  .ag-vagas-card { gap: 12px; padding: 12px 14px; }
  .ag-vagas-dia-num { font-size: 1.7rem; }
}
