/* ===========================================================================
   Catálogo interativo — folha de estilo compartilhada
   =========================================================================== */

:root {
  --brand: #f4791f;
  --brand-dark: #d35f0c;
  --brand-soft: #fff2e6;
  --ink: #1d1a17;
  --ink-2: #4d463f;
  --ink-3: #857c72;
  --line: #e7e0d8;
  --bg: #faf7f3;
  --card: #ffffff;
  --ok: #157f4b;
  --warn: #a8620a;
  --danger: #c0392b;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(29, 26, 23, .06), 0 8px 24px rgba(29, 26, 23, .07);
  --shadow-lg: 0 12px 48px rgba(29, 26, 23, .18);
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-text-size-adjust: 100%;
}

body { min-height: 100vh; }

a { color: var(--brand-dark); }

h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.2; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
p { line-height: 1.55; margin: 0 0 1em; }

.muted { color: var(--ink-3); }
.small { font-size: .82rem; }
.strong { font-weight: 700; }
.center { text-align: center; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.hidden { display: none !important; }
/* regras de layout como .stack/.row vencem o [hidden] do navegador se não forçarmos */
[hidden] { display: none !important; }
/*
 * min-width: 0 en los hijos: sin eso, un item de grid no encoge por debajo de
 * su contenido, así que una tabla ancha estiraba la tarjeta y con ella la
 * página entera — y el overflow de la tabla no llegaba a actuar nunca.
 */
.stack { display: grid; gap: 14px; }
.stack > * { min-width: 0; }

/* --------------------------------- botões --------------------------------- */

.btn {
  appearance: none;
  border: 1px solid transparent;
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  line-height: 1.1;
  transition: filter .15s ease, transform .05s ease, background .15s ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--ink-2); border-color: var(--line); }
.btn.ghost:hover { background: #fff; }
.btn.soft { background: var(--brand-soft); color: var(--brand-dark); }
.btn.dark { background: var(--ink); }
.btn.danger { background: var(--danger); }
.btn.sm { padding: 6px 12px; font-size: .85rem; }
.btn.block { width: 100%; }
.btn.icon { padding: 8px; width: 38px; height: 38px; border-radius: 50%; }

/* -------------------------------- formulários ------------------------------ */

label { display: block; font-size: .82rem; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }

input[type="text"], input[type="password"], input[type="number"], input[type="url"], input[type="email"], input[type="tel"],
input[type="search"], input[type="color"], input[type="date"], select, textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(244, 121, 31, .18);
}
input[type="color"] { padding: 3px; height: 40px; }
textarea { resize: vertical; min-height: 70px; }
.field { margin-bottom: 12px; }
.field .hint { font-size: .76rem; color: var(--ink-3); margin-top: 4px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.switch { display: flex; align-items: center; gap: 8px; font-size: .88rem; font-weight: 600; color: var(--ink-2); }
.switch input { width: auto; }

/* el ojito vive dentro del campo de la contraseña, sobre el borde derecho
   (en el login y en el del catálogo de revendedoras) */
.con-ojo { position: relative; }
.con-ojo input { padding-right: 44px; }
.ojo {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border: 0;
  background: none;
  color: var(--ink-3);
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
}
.ojo:hover { background: var(--brand-soft); color: var(--brand-dark); }
.ojo:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }

/* --------------------------------- cartões -------------------------------- */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.card.tight { padding: 14px; }
.card-title { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-title h2, .card-title h3 { margin: 0; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-dark);
}
.tag.ok { background: #e4f4ea; color: var(--ok); }
.tag.off { background: #f0ece7; color: var(--ink-3); }
.tag.erro { background: #fbe9e7; color: var(--danger); }

.alert {
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-size: .88rem;
  border: 1px solid;
  margin-bottom: 14px;
}
.alert.error { background: #fdecea; border-color: #f5c6c0; color: #96261a; }
.alert.ok { background: #e7f5ec; border-color: #bfe3cd; color: #10633a; }
.alert.info { background: var(--brand-soft); border-color: #f7d7b8; color: var(--warn); }

/* ---------------------------------- topo ---------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-mark {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--ink);
  text-decoration: none;
}
.brand-dot {
  width: 26px; height: 26px;
  border-radius: 9px;
  background: linear-gradient(140deg, var(--brand), #ffb347);
  display: grid; place-items: center;
  color: #fff; font-size: .8rem; font-weight: 800;
}

.wrap { max-width: 1180px; margin: 0 auto; padding: 22px 16px 60px; }
.wrap.narrow { max-width: 460px; }

.tabs { display: flex; gap: 6px; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.tab {
  border: 0; background: none; font: inherit; font-weight: 600; color: var(--ink-3);
  padding: 11px 14px; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap;
}
.tab[aria-selected="true"] { color: var(--brand-dark); border-bottom-color: var(--brand); }

table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); }
.table-scroll { overflow-x: auto; }

/* --------------------------------- balões --------------------------------- */

.page-frame { position: relative; display: block; background: #efe9e2; border-radius: 4px; overflow: hidden; }
.page-frame img { display: block; width: 100%; height: auto; }

.balloon {
  position: absolute;
  transform: translate(-50%, -50%);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: .38em .8em;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
  /* --bw = largura atual da página em px, medida no JS: os balões acompanham o zoom */
  font-size: clamp(9px, calc(var(--bw, 380px) * .034), 21px);
  line-height: 1.15;
  white-space: nowrap;
  border: 2px solid #fff;
  box-shadow: 0 3px 10px rgba(0, 0, 0, .3);
  cursor: pointer;
  z-index: 2;
  transition: transform .12s ease;
}
.balloon:hover { transform: translate(-50%, -50%) scale(1.06); }
.balloon .from { font-size: .72em; font-weight: 600; opacity: .85; text-decoration: line-through; }
.balloon.size-sm { font-size: clamp(8px, calc(var(--bw, 380px) * .026), 16px); }
.balloon.size-lg { font-size: clamp(11px, calc(var(--bw, 380px) * .046), 27px); }
.balloon.color-dark { background: var(--ink); }
.balloon.color-green { background: var(--ok); }
.balloon.color-pink { background: #d6336c; }
.balloon.color-purple { background: #6b3fa0; }
.balloon.color-blue { background: #1e6bb8; }
.balloon.color-white { background: #fff; color: var(--ink); border-color: var(--ink); }
/* Balão "remendo": retângulo opaco de cantos retos que cobre o preço em reais.
   A largura e a altura vêm em % da página, e o texto encolhe para caber. */
.balloon.boxed {
  padding: 0;
  border: 0;
  box-shadow: none;
  overflow: hidden;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  border-radius: var(--bradius, 0px);
  background: var(--bbg, #fff);
  color: var(--bfg, #1d1a17);
  font-size: var(--bfs, 12px);
  font-weight: var(--bweight, 800);
  line-height: 1;
  letter-spacing: -.01em;
}
.balloon.boxed:hover { transform: translate(-50%, -50%); }

.balloon.in-cart::after {
  content: "✓";
  position: absolute;
  top: -7px; right: -7px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--ok);
  color: #fff;
  font-size: .62rem;
  display: grid; place-items: center;
  border: 2px solid #fff;
}

/* --------------------------------- diálogo -------------------------------- */

dialog {
  border: 0;
  border-radius: var(--radius);
  padding: 0;
  max-width: 460px;
  width: calc(100% - 32px);
  box-shadow: var(--shadow-lg);
  color: var(--ink);
}
dialog::backdrop { background: rgba(29, 26, 23, .55); backdrop-filter: blur(2px); }
.dialog-body { padding: 20px; }
.dialog-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 14px; }
.dialog-head h3 { margin: 0; flex: 1; }
.dialog-foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }

.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255, 255, 255, .4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-screen { display: grid; place-items: center; min-height: 60vh; gap: 12px; color: var(--ink-3); }
.loading-screen .spinner { border-color: var(--line); border-top-color: var(--brand); }

@media (max-width: 640px) {
  h1 { font-size: 1.35rem; }
  .wrap { padding: 16px 12px 80px; }
  .card { padding: 14px; }
}
