/* =========================================================================
   GL Barbearia - estilo geral (cliente e admin)
   ========================================================================= */
:root {
  --preto: #0b0b0d;
  --carvao: #141418;
  --carvao-claro: #1c1c22;
  --linha: #2a2a33;
  --texto: #f2f2f5;
  --texto-fraco: #9a9aa8;
  --dourado: #d4af37;
  --dourado-claro: #f0d060;
  --vermelho: #d62839;
  --azul: #1e5ac8;
  --verde: #2fbf71;
  --laranja: #f0932b;
  --fundo-logo: #dad9d5;
  --raio: 14px;
  --sombra: 0 8px 24px rgba(0, 0, 0, .45);
  --topo-seguro: env(safe-area-inset-top, 0px);
  --base-segura: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--preto);
  color: var(--texto);
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
  font-size: 16px;
  overscroll-behavior-y: contain;
  max-width: 100%;
  overflow-x: hidden; /* nada empurra a tela de lado no celular */
}

body {
  min-height: 100vh;
  padding-top: var(--topo-seguro);
  padding-bottom: var(--base-segura);
}

h1, h2, h3 { margin: 0; font-weight: 800; letter-spacing: .3px; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--dourado); text-decoration: none; }

/* ------------------------------- cabecalho ------------------------------- */
/* A logo já traz o nome da barbearia, então ela ocupa o topo inteiro -
   nada de texto repetindo o que a arte diz. O fundo do cabeçalho é o mesmo
   cinza da arte, para a faixa parecer contínua de ponta a ponta. */
.topo {
  position: relative;
  display: block;
  padding: 0;
  padding-top: var(--topo-seguro);
  background: var(--fundo-logo);
}

/* Altura explícita em vez de aspect-ratio + max-height: os dois juntos
   fazem o navegador calcular uma caixa e depois cortá-la, e a arte aparecia
   pela metade. Com a altura fixa, o `contain` encaixa a logo inteira. */
.topo img.banner-logo {
  display: block;
  width: 100%;
  max-width: 560px;
  height: min(68vw, 240px);
  margin: 0 auto;
  object-fit: contain;
  background: var(--fundo-logo);
}
.topo img.banner-logo.quadrada { height: min(30vw, 110px); background: #000; }

/* no painel do dono a logo é menor: ali o que importa é a agenda */
.topo.compacto img.banner-logo { height: min(32vw, 116px); }

.topo .direita {
  position: absolute;
  top: calc(10px + var(--topo-seguro));
  right: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.topo .direita .btn {
  background: rgba(11, 11, 13, .78);
  border-color: rgba(255, 255, 255, .18);
  color: var(--texto);
  backdrop-filter: blur(4px);
}

/* linha fina logo abaixo da faixa listrada */
.recado-topo {
  text-align: center;
  font-size: .8rem;
  color: var(--texto-fraco);
  padding: 9px 16px;
  background: var(--carvao);
  border-bottom: 1px solid var(--linha);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* faixa do poste de barbeiro */
.faixa-poste {
  height: 5px;
  background: repeating-linear-gradient(115deg,
      var(--vermelho) 0 12px, #fff 12px 24px, var(--azul) 24px 36px, #fff 36px 48px);
}

/* -------------------------------- estrutura ------------------------------ */
.conteudo { max-width: 720px; margin: 0 auto; padding: 16px 16px 140px; }
.secao { margin-bottom: 22px; }
.secao > h2 {
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--dourado);
  margin-bottom: 10px;
}

.cartao {
  background: var(--carvao);
  border: 1px solid var(--linha);
  border-radius: var(--raio);
  padding: 14px;
}

.linha-flex { display: flex; align-items: center; gap: 10px; }
.espaco { flex: 1; }
.aviso {
  background: rgba(212, 175, 55, .1);
  border: 1px solid rgba(212, 175, 55, .35);
  color: var(--dourado-claro);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: .86rem;
  line-height: 1.45;
}
.vazio { text-align: center; color: var(--texto-fraco); padding: 34px 16px; font-size: .92rem; }

/* -------------------------------- servicos ------------------------------- */
.lista-servicos { display: grid; gap: 10px; }

.servico {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--carvao);
  border: 1.5px solid var(--linha);
  border-radius: var(--raio);
  padding: 13px 14px;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .08s;
  user-select: none;
}
.servico:active { transform: scale(.99); }
.servico.marcado { border-color: var(--dourado); background: linear-gradient(180deg, #1d1a12 0%, #16161a 100%); }

.caixinha {
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  border: 2px solid #4a4a58;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 15px;
  color: var(--preto);
  font-weight: 900;
  background: transparent;
  transition: all .15s;
}
.servico.marcado .caixinha { background: var(--dourado); border-color: var(--dourado); }
.caixinha::after { content: '✓'; opacity: 0; }
.servico.marcado .caixinha::after { opacity: 1; }

.servico .info { min-width: 0; flex: 1; }
.servico .info b { display: block; font-size: 1rem; font-weight: 700; }
.servico .info small { color: var(--texto-fraco); font-size: .78rem; display: block; margin-top: 2px; }
.servico .preco { text-align: right; font-weight: 800; color: var(--dourado); white-space: nowrap; }
.servico .preco small { display: block; color: var(--texto-fraco); font-weight: 500; font-size: .72rem; }

/* --------------------------------- datas --------------------------------- */
.tira-datas {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px 10px;
  scrollbar-width: none;
}
.tira-datas::-webkit-scrollbar { display: none; }

.dia {
  flex: 0 0 62px;
  background: var(--carvao);
  border: 1.5px solid var(--linha);
  border-radius: 12px;
  padding: 9px 4px;
  text-align: center;
  cursor: pointer;
  transition: all .15s;
}
.dia small { display: block; font-size: .66rem; text-transform: uppercase; color: var(--texto-fraco); letter-spacing: .5px; }
.dia b { display: block; font-size: 1.25rem; line-height: 1.3; }
.dia .mes { font-size: .62rem; color: var(--texto-fraco); }
.dia.ativo { background: var(--dourado); border-color: var(--dourado); color: var(--preto); }
.dia.ativo small, .dia.ativo .mes { color: rgba(0, 0, 0, .7); }
.dia.fechado { opacity: .3; }

/* -------------------------------- horarios ------------------------------- */
.grade-horarios { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }

.hora {
  background: var(--carvao);
  border: 1.5px solid var(--linha);
  border-radius: 10px;
  padding: 12px 4px;
  text-align: center;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s;
}
.hora.ativo { background: var(--dourado); border-color: var(--dourado); color: var(--preto); }
.hora.ocupado { opacity: .28; cursor: not-allowed; text-decoration: line-through; }

/* --------------------------------- botoes -------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 12px;
  padding: 13px 18px;
  font-weight: 800;
  cursor: pointer;
  background: var(--carvao-claro);
  color: var(--texto);
  border: 1.5px solid var(--linha);
  transition: filter .15s, transform .08s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ouro { background: linear-gradient(180deg, var(--dourado-claro), var(--dourado)); color: #1a1509; border-color: var(--dourado); }
.btn.verde { background: var(--verde); color: #06210f; border-color: var(--verde); }
.btn.vermelho { background: transparent; color: var(--vermelho); border-color: rgba(214, 40, 57, .5); }
.btn.azul { background: var(--azul); color: #fff; border-color: var(--azul); }
.btn.largo { width: 100%; }
.btn.pequeno { padding: 8px 12px; font-size: .82rem; border-radius: 9px; }

/* ------------------------------ barra do total --------------------------- */
.barra-total {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  background: linear-gradient(180deg, rgba(14, 14, 17, .96), #0b0b0d);
  border-top: 1px solid var(--linha);
  padding: 12px 16px calc(12px + var(--base-segura));
  backdrop-filter: blur(8px);
}
.barra-total .interno { max-width: 720px; margin: 0 auto; display: flex; align-items: center; gap: 10px; }
.barra-total .valores { line-height: 1.25; min-width: 0; flex: 1 1 auto; }
.barra-total .valores small {
  display: block;
  color: var(--texto-fraco);
  font-size: .74rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.barra-total .valores b { font-size: 1.45rem; color: var(--dourado); }
.barra-total .btn {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 230px;
  margin-left: auto;
  padding: 13px 14px;
  white-space: nowrap;
}
@media (max-width: 400px) {
  .barra-total .btn { font-size: .9rem; padding: 12px; }
  .barra-total .valores b { font-size: 1.3rem; }
}

/* --------------------------------- campos -------------------------------- */
.campo { margin-bottom: 12px; }
.campo label { display: block; font-size: .78rem; color: var(--texto-fraco); margin-bottom: 5px; font-weight: 600; }
.campo input, .campo select, .campo textarea {
  width: 100%;
  background: var(--carvao-claro);
  border: 1.5px solid var(--linha);
  border-radius: 10px;
  padding: 12px;
  outline: none;
  transition: border-color .15s;
}
.campo input:focus, .campo select:focus, .campo textarea:focus { border-color: var(--dourado); }
.campo textarea { resize: vertical; min-height: 70px; }
.dupla { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* -------------------------------- etiquetas ------------------------------ */
.etiqueta {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .6px;
  padding: 4px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.etiqueta.agendado { background: rgba(30, 90, 200, .2); color: #7aa6ff; }
.etiqueta.em_atendimento { background: rgba(240, 147, 43, .2); color: var(--laranja); }
.etiqueta.concluido { background: rgba(47, 191, 113, .18); color: var(--verde); }
.etiqueta.cancelado { background: rgba(214, 40, 57, .18); color: #ff7b86; }
.etiqueta.faltou { background: rgba(154, 154, 168, .18); color: var(--texto-fraco); }
.etiqueta.proximo { background: var(--dourado); color: #1a1509; }

/* ------------------------------ agendamentos ----------------------------- */
.agendamento {
  background: var(--carvao);
  border: 1.5px solid var(--linha);
  border-left: 4px solid var(--linha);
  border-radius: var(--raio);
  padding: 13px 14px;
  margin-bottom: 10px;
}
.agendamento.destaque { border-left-color: var(--dourado); box-shadow: 0 0 0 1px rgba(212, 175, 55, .25); }
.agendamento.atendendo { border-left-color: var(--laranja); background: linear-gradient(180deg, #1e1a12, #16161a); }
.agendamento .cabeca { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.agendamento .horario { font-size: 1.35rem; font-weight: 900; color: var(--dourado); line-height: 1; }
.agendamento .nome { font-weight: 700; }
.agendamento .detalhe { font-size: .82rem; color: var(--texto-fraco); line-height: 1.5; }
.agendamento .acoes { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 11px; }

/* --------------------------------- abas ---------------------------------- */
.abas { display: flex; gap: 6px; background: var(--carvao); padding: 5px; border-radius: 12px; margin-bottom: 18px; }
.abas button {
  flex: 1;
  background: transparent;
  border: none;
  padding: 10px 6px;
  border-radius: 9px;
  font-weight: 700;
  font-size: .88rem;
  color: var(--texto-fraco);
  cursor: pointer;
}
.abas button.ativo { background: var(--dourado); color: var(--preto); }

/* menu inferior do admin */
.menu-baixo {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 50;
  display: flex;
  background: #101014;
  border-top: 1px solid var(--linha);
  padding-bottom: var(--base-segura);
}
.menu-baixo button {
  flex: 1;
  background: none;
  border: none;
  color: var(--texto-fraco);
  padding: 9px 2px 11px;
  font-size: .66rem;
  font-weight: 700;
  cursor: pointer;
  display: grid;
  gap: 3px;
  justify-items: center;
}
.menu-baixo button span { font-size: 1.25rem; line-height: 1; }
.menu-baixo button.ativo { color: var(--dourado); }

/* --------------------------------- numeros ------------------------------- */
.numeros { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.numero { background: var(--carvao); border: 1px solid var(--linha); border-radius: 12px; padding: 12px; }
.numero small { display: block; font-size: .72rem; color: var(--texto-fraco); text-transform: uppercase; letter-spacing: .6px; }
.numero b { font-size: 1.5rem; color: var(--dourado); }

/* --------------------------------- modal --------------------------------- */
.fundo-modal {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(0, 0, 0, .72);
  display: none;
  align-items: flex-end;
  justify-content: center;
  backdrop-filter: blur(3px);
}
.fundo-modal.aberto { display: flex; }
.modal {
  background: var(--carvao);
  border: 1px solid var(--linha);
  border-radius: 18px 18px 0 0;
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 18px 16px calc(20px + var(--base-segura));
  animation: subir .22s ease;
}
@keyframes subir { from { transform: translateY(30px); opacity: .4; } to { transform: none; opacity: 1; } }
.modal h3 { margin-bottom: 14px; font-size: 1.1rem; }
@media (min-width: 600px) {
  .fundo-modal { align-items: center; }
  .modal { border-radius: 18px; }
}

/* --------------------------------- toast --------------------------------- */
#toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + var(--base-segura));
  transform: translateX(-50%) translateY(20px);
  z-index: 120;
  background: #22222a;
  border: 1px solid var(--linha);
  border-left: 4px solid var(--dourado);
  color: var(--texto);
  padding: 12px 16px;
  border-radius: 10px;
  box-shadow: var(--sombra);
  max-width: min(92vw, 420px);
  font-size: .9rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}
#toast.mostra { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.erro { border-left-color: var(--vermelho); }
#toast.ok { border-left-color: var(--verde); }

/* ------------------------------ tela de sucesso -------------------------- */
.sucesso { text-align: center; padding: 26px 16px; }
.sucesso .selo {
  width: 84px; height: 84px; margin: 0 auto 16px;
  border-radius: 50%;
  background: rgba(47, 191, 113, .15);
  border: 2px solid var(--verde);
  display: grid; place-items: center;
  font-size: 40px;
}
.codigo {
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: 6px;
  color: var(--dourado);
  background: var(--carvao);
  border: 1.5px dashed var(--dourado);
  border-radius: 12px;
  padding: 14px;
  margin: 16px 0;
}

/* ------------------------------ tela de entrada -------------------------- */
.entrada {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.entrada .caixa { width: 100%; max-width: 360px; text-align: center; }
.entrada img.logo-entrada {
  width: 100%;
  max-width: 260px;
  height: auto;
  border-radius: 14px;
  background: #dad9d5;
  padding: 8px 12px;
  margin-bottom: 20px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .5);
}

.escondido { display: none !important; }

/* -------------------------- barra de progresso --------------------------- */
.passos { display: flex; gap: 6px; margin-bottom: 18px; }
.passos div { flex: 1; height: 4px; border-radius: 3px; background: var(--linha); transition: background .25s; }
.passos div.feito { background: var(--dourado); }

.carregando {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2.5px solid rgba(255, 255, 255, .25);
  border-top-color: var(--dourado);
  border-radius: 50%;
  animation: girar .7s linear infinite;
}
@keyframes girar { to { transform: rotate(360deg); } }
