/* ===========================================================================
   Confirmação de exclusão do painel (2026-09-09) — substitui o confirm() do
   navegador por um modal do próprio painel, com o botão de excluir em vidro
   3D que "engole" o próprio rótulo enquanto espera o servidor.
   Uso: js/gulp-delete.js (gulpConfirmDelete). Arquivo próprio de propósito —
   não mexe em regra compartilhada do styles.css.

   Duas armadilhas deste repositório já contornadas aqui, NÃO desfazer:

   1. SEM backdrop-filter no botão. O fundo do modal é cor sólida, então o
      blur não teria efeito visual nenhum e reproduziria o bug de texto
      borrado no Android — o mesmo motivo documentado em .auth-submit
      (css/styles.css) e em .almox-header-btn (css/almoxarifado.css).
   2. O ícone e o rótulo ficam em elementos com z-index acima do brilho. Texto
      solto dentro do botão some sob o ::after — bug que já voltou três vezes
      no botão dourado (ver .auth-submit span no styles.css). Aqui a varredura
      ainda roda na FACE, que fica atrás do <button>: dois cintos de segurança.
   =========================================================================== */

/* O nível do líquido. Registrado, então o motor interpola sozinho entre uma
   letra e a seguinte — nada de requestAnimationFrame no meio. */
@property --gulp-p{
  syntax: '<number>';
  inherits: true;
  initial-value: 0;
}

/* ---------------- modal ---------------- */
.gulp-modal{
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.gulp-modal[hidden]{ display: none; }
/* Fundo escuro liso: nada de backdrop-filter aqui — o .pf-modal-backdrop já
   borrou o texto de um botão sendo IRMÃO, não ancestral (ver nota no topo do
   styles.css). */
.gulp-modal-backdrop{
  position: absolute;
  inset: 0;
  background: rgba(8, 10, 14, 0.72);
  animation: gulp-modal-in 0.18s ease;
}
.gulp-modal-card{
  position: relative;
  width: min(440px, 100%);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  box-shadow: 0 30px 60px -24px rgba(0, 0, 0, 0.85);
  padding: 22px 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: gulp-card-in 0.22s cubic-bezier(.22,.61,.36,1);
}
@keyframes gulp-modal-in{ from{ opacity: 0; } }
@keyframes gulp-card-in{
  from{ opacity: 0; transform: translateY(10px) scale(0.98); }
}
.gulp-modal-title{
  margin: 0;
  font-family: 'Oswald', sans-serif;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
}
.gulp-modal-body{
  margin: 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-dim);
}
.gulp-modal-body b{ color: var(--text); font-weight: 600; }
/* A falha fica NA TELA, não num alert() que some no clique seguinte. */
.gulp-modal-erro{
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--bad);
  border-left: 2px solid var(--bad);
  padding-left: 10px;
}
.gulp-modal-erro[hidden]{ display: none; }
.gulp-modal-acoes{
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
  flex-wrap: wrap;
}
.gulp-modal-cancelar{
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text-dim);
  border-radius: 999px;
  padding: 10px 18px;
  font-family: 'Inter', sans-serif;
  font-size: 12.5px;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: color 0.16s, border-color 0.16s;
}
.gulp-modal-cancelar:hover{ color: var(--text); border-color: var(--text-faint); }
.gulp-modal-cancelar:focus-visible{ outline: 2px solid var(--accent); outline-offset: 2px; }
.gulp-modal-cancelar:disabled{ opacity: 0.45; cursor: default; }

/* Variante clara — para as telas do GPD que são claras (modal de Visitas,
   datepicker verde). O botão em si não muda: o vidro rubi funciona nos dois
   fundos. Mesma paleta do .gpd-visita-edit (css/gpd.css). */
.gulp-modal--light .gulp-modal-backdrop{ background: rgba(24, 30, 40, 0.42); }
.gulp-modal--light .gulp-modal-card{
  border-color: #DCE2EC;
  background: linear-gradient(180deg, #FFFFFF, #F4F7FB);
  box-shadow: 0 30px 60px -26px rgba(27, 34, 51, 0.4);
}
.gulp-modal--light .gulp-modal-title{ color: #1B2233; }
.gulp-modal--light .gulp-modal-body{ color: #5A6270; }
.gulp-modal--light .gulp-modal-body b{ color: #1B2233; }
.gulp-modal--light .gulp-modal-erro{ color: #B23434; border-left-color: #B23434; }
.gulp-modal--light .gulp-modal-cancelar{
  border-color: #D9DEE7;
  background: #FFFFFF;
  color: #5A6270;
}
.gulp-modal--light .gulp-modal-cancelar:hover{ color: #1B2233; border-color: #B9C2CE; }

/* ---------------- o botão ---------------- */
.gulp{
  --k: 1;                                   /* fator de velocidade */
  --t-fly:  calc(560ms * var(--k));
  --t-furl: calc(440ms * var(--k));
  --fx: 0px;                                /* recorte lateral: pílula → disco */
  --rr: 999px;
  --gulp-p: 0;

  /* rubi: aqui excluir é a decisão da tela, não uma ação secundária */
  --face-1: #F08A8B;
  --face-2: var(--bad);
  --face-3: #8E2C2E;
  --edge:   rgba(255, 196, 196, 0.5);
  --glow:   rgba(225, 89, 90, 0.3);
  --ink:    #2A0A0A;
  --liq:    #6E1A1C;
  --liq-lit:#48090B;

  position: relative;
  display: inline-block;
  transition: --gulp-p calc(420ms * var(--k)) cubic-bezier(.22,.61,.36,1);
}
/* Variante grafite, para quando o modal tiver outra ação em destaque. */
.gulp.gulp--graphite{
  --face-1: #2B333F;
  --face-2: #212832;
  --face-3: #171C24;
  --edge:   rgba(255, 255, 255, 0.1);
  --glow:   rgba(0, 0, 0, 0);
  /* Tinta CLARA fixa sobre o grafite (30/09/2026, print do GPD "Gravar
     faturamento"): var(--text) é escuro no tema claro e o texto sumia. */
  --ink:    #E9EEF4;
  --liq:    var(--bad);
  --liq-lit:#FF9295;
}

.gulp__body{
  position: relative;
  display: block;
  width: 192px;
  height: 48px;
}

/* UMA face, UM recorte: pílula ou disco, nunca os dois. */
.gulp__face{
  position: absolute;
  inset: 0;
  overflow: hidden;
  border: 1px solid var(--edge);
  background: linear-gradient(180deg, var(--face-1) 0%, var(--face-2) 58%, var(--face-3) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.42),
    inset 0 -10px 14px -6px rgba(0, 0, 0, 0.45),
    0 0 30px var(--glow),
    0 12px 22px -12px rgba(0, 0, 0, 0.6),
    0 2px 4px rgba(0, 0, 0, 0.35);
  clip-path: inset(0 var(--fx) round var(--rr));
  transition: clip-path var(--t-furl) cubic-bezier(.22,.61,.36,1), box-shadow 0.2s ease;
}
/* cúpula especular */
.gulp__face::before{
  content: "";
  position: absolute;
  left: 6%; right: 6%; top: 3px;
  height: 42%;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255,255,255,0.4), rgba(255,255,255,0));
  pointer-events: none;
}
/* varredura de brilho que atravessa no hover */
.gulp__face::after{
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  translate: -140% 0;
  background: linear-gradient(115deg,
    transparent 30%, rgba(255,255,255,0.18) 46%, rgba(255,255,255,0.34) 50%,
    rgba(255,255,255,0.18) 54%, transparent 70%);
}
.gulp[data-state="idle"] .gulp__body:has(.gulp__btn:hover) .gulp__face::after{
  animation: gulp-sweep 0.72s cubic-bezier(.22,.61,.36,1);
}
@keyframes gulp-sweep{ to{ translate: 140% 0; } }
.gulp[data-state="idle"] .gulp__body:has(.gulp__btn:active){
  scale: 0.985;
  transition: scale 0.1s cubic-bezier(.22,.61,.36,1);
}

.gulp__btn{
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  height: 100%;
  padding: 0 18px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  cursor: pointer;
  /* O MESMO recorte da face: o alvo de clique não tem como discordar da pintura. */
  clip-path: inset(0 var(--fx) round var(--rr));
  transition: clip-path var(--t-furl) cubic-bezier(.22,.61,.36,1);
}
.gulp__btn:focus-visible{ outline: 2px solid var(--accent); outline-offset: 4px; }
.gulp:not([data-state="idle"]):not([data-state="done"]) .gulp__btn{ cursor: default; }

/* ACIMA do brilho — ver armadilha 2 no topo do arquivo. */
.gulp__icon,
.gulp__label{ position: relative; z-index: 2; }

/* A lata: o interior é um clipPath, então a letra que cai é vista lá dentro. */
.gulp__icon{
  width: 22px;
  height: 24px;
  flex: none;
  overflow: visible;
  transition: opacity 0.16s;
}
.gulp__bin,
.gulp__lid rect,
.gulp__lid path{
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.gulp__lid{
  transform-box: fill-box;
  transform-origin: 86% 100%;
  transition: rotate calc(320ms * var(--k)) cubic-bezier(.34,1.36,.64,1);
}
.gulp[data-state="eat"] .gulp__lid,
.gulp[data-state="err"] .gulp__lid{ rotate: -24deg; }

/* O nível: um path ondulado e um translate. Nada anima altura. */
.gulp__liq{
  transform-box: fill-box;
  transform-origin: center;
  translate: 0 calc(30px - var(--gulp-p) * 27px);
}
.gulp__fill{
  fill: var(--liq-lit);
  animation: gulp-swell calc(2600ms * var(--k)) linear infinite;
}
.gulp__fill.deep{ fill: var(--liq); }
@keyframes gulp-swell{
  from{ translate: 0 0; }
  to  { translate: -14px 0; }
}
.gulp__liq.is-slosh{ animation: gulp-slosh calc(520ms * var(--k)) cubic-bezier(.22,.61,.36,1); }
@keyframes gulp-slosh{
  0%  { rotate: 0deg; }
  30% { rotate: -5deg; }
  62% { rotate: 3deg; }
  100%{ rotate: 0deg; }
}

/* Rótulo: cada letra é um corpo que cai. */
.gulp__label{ display: inline-flex; white-space: pre; }
.gulp__ch{ display: inline-block; will-change: translate, rotate, opacity; }

.gulp[data-state="eat"] .gulp__ch,
.gulp[data-state="furl"] .gulp__ch,
.gulp[data-state="done"] .gulp__ch{
  animation: gulp-fly var(--t-fly) cubic-bezier(.55,.06,.68,.19) forwards;
  animation-delay: calc(var(--i) * 52ms * var(--k));
}
@keyframes gulp-fly{
  0%  { translate: 0 0; rotate: 0deg; scale: 1; opacity: 1; }
  46% { translate: calc(var(--dx) * .5) calc(var(--dy) * .42 - 13px); rotate: -16deg; opacity: 1; }
  84% { translate: var(--dx) calc(var(--dy) - 1px); rotate: 12deg; scale: 0.9; opacity: 1; }
  100%{ translate: var(--dx) calc(var(--dy) + 5px); rotate: 18deg; scale: 0.6; opacity: 0; }
}
/* Devolver é a mesma queda ao contrário. */
.gulp[data-state="err"] .gulp__ch{
  animation: gulp-spit calc(420ms * var(--k)) cubic-bezier(.34,1.36,.64,1) forwards;
  animation-delay: calc(var(--i) * 34ms * var(--k));
}
@keyframes gulp-spit{
  from{ translate: var(--dx) calc(var(--dy) + 5px); rotate: 18deg; scale: 0.6; opacity: 0; }
  to  { translate: 0 0; rotate: 0deg; scale: 1; opacity: 1; }
}

/* Um arco gira enquanto espera, depois corre em volta e sela. */
.gulp__seal{
  position: absolute;
  top: 50%; left: 50%;
  width: 24px; height: 24px;
  margin: -12px 0 0 -12px;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}
.gulp__seal circle{
  fill: none;
  stroke: var(--ink);
  stroke-width: 2.4;
  stroke-linecap: round;
  transform-box: fill-box;
  transform-origin: center;
}
.gulp[data-state="eat"] .gulp__seal{
  opacity: 1;
  animation: gulp-spin calc(900ms * var(--k)) linear infinite;
}
.gulp[data-state="eat"] .gulp__seal circle{ stroke-dasharray: 20 100; }
.gulp[data-state="furl"] .gulp__seal,
.gulp[data-state="done"] .gulp__seal{
  opacity: 1;
  animation: gulp-seal var(--t-furl) cubic-bezier(.22,.61,.36,1) forwards;
}
.gulp[data-state="furl"] .gulp__seal circle,
.gulp[data-state="done"] .gulp__seal circle{
  animation: gulp-close var(--t-furl) cubic-bezier(.22,.61,.36,1) forwards;
}
@keyframes gulp-spin{ to{ rotate: 1turn; } }
@keyframes gulp-seal{ from{ scale: 1; rotate: 0deg; } to{ scale: 1.74; rotate: 0.75turn; } }
@keyframes gulp-close{ from{ stroke-dasharray: 20 100; } to{ stroke-dasharray: 76 100; } }

/* O disco selado guarda a marca. */
.gulp__mark{
  position: absolute;
  top: 50%; left: 50%;
  width: 19px; height: 19px;
  margin: -9.5px 0 0 -9.5px;
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  scale: 0.7;
  transition: opacity 0.18s, scale 0.3s cubic-bezier(.34,1.36,.64,1);
}
.gulp__mark path{
  fill: none;
  stroke: var(--ink);
  stroke-width: 2.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.gulp[data-state="done"] .gulp__mark{ opacity: 1; scale: 1; transition-delay: 0.14s; }
.gulp[data-state="done"] .gulp__icon,
.gulp[data-state="done"] .gulp__label{ opacity: 0; }

@media (max-width: 480px){
  .gulp__body{ width: 168px; height: 46px; }
  .gulp-modal-card{ padding: 18px 16px 16px; }
}

/* O gesto continua legível sem o voo. */
@media (prefers-reduced-motion: reduce){
  .gulp-modal-backdrop,
  .gulp-modal-card{ animation: none; }
  .gulp[data-state="eat"] .gulp__ch,
  .gulp[data-state="furl"] .gulp__ch,
  .gulp[data-state="done"] .gulp__ch{
    animation: gulp-fade calc(240ms * var(--k)) linear forwards;
    animation-delay: calc(var(--i) * 26ms * var(--k));
  }
  @keyframes gulp-fade{ to{ opacity: 0; } }
  .gulp__fill{ animation: none; }
  .gulp__face::after{ animation: none !important; }
  .gulp[data-state="eat"] .gulp__seal{ animation: none; }
  .gulp[data-state="furl"] .gulp__seal,
  .gulp[data-state="done"] .gulp__seal{ animation: none; scale: 1.6; }
}

/* Variante GRAVAR (17/09/2026): grafite parado, líquido VERDE enchendo
   durante a gravação, e o disco selado fecha em verde com a marca escura
   ("preencha com verde o processo de quando finalizar"). O rubi continua
   reservado pro excluir. */
.gulp.gulp--gravar{
  --face-1: #2B333F;
  --face-2: #212832;
  --face-3: #171C24;
  --edge:   rgba(255, 255, 255, 0.12);
  --glow:   rgba(79, 174, 124, 0.22);
  /* Tinta clara fixa (30/09/2026): no tema claro var(--text) é escuro e o
     "Gravar" ficava escuro sobre grafite, ilegível. */
  --ink:    #E9EEF4;
  --liq:    #1F6B45;
  --liq-lit:#3FA46E;
}
/* Enquanto come as letras e fecha, o botão já vai ficando verde. */
.gulp.gulp--gravar[data-state="eat"],
.gulp.gulp--gravar[data-state="furl"]{
  --face-1: #4FAE7C;
  --face-2: #2F8659;
  --face-3: #1F6B45;
  --edge:   rgba(205, 255, 226, 0.45);
  --glow:   rgba(79, 174, 124, 0.35);
}
.gulp.gulp--gravar[data-state="done"]{
  --face-1: #9BE7BE;
  --face-2: #4FAE7C;
  --face-3: #1F6B45;
  --edge:   rgba(205, 255, 226, 0.6);
  --glow:   rgba(79, 174, 124, 0.45);
  --ink:    #07261A;
}
/* Falha do gravar: começa verde (já estava enchendo) e TERMINA EM VERMELHO —
   pedido do usuário 17/09/2026. A volta pro grafite acontece junto com as
   letras retornando (reiniciarBotao em js/gulp-delete.js). */
.gulp.gulp--gravar .gulp__face{ transition: background 0.28s ease, box-shadow 0.28s ease, border-color 0.28s ease; }
.gulp.gulp--gravar[data-state="err"]{
  --face-1: #F08A8B;
  --face-2: #C43D3E;
  --face-3: #8E2C2E;
  --edge:   rgba(255, 196, 196, 0.5);
  --glow:   rgba(225, 89, 90, 0.42);
  --ink:    #2A0A0A;
  --liq:    #6E1A1C;
  --liq-lit:#48090B;
}
