:root {
  --afb-primary: #b0606f;
  --afb-primary-dark: #8f4a58;
  --afb-primary-soft: #f6e6e9;
  --afb-gold: #c9a66b;
  --afb-ink: #3d2b2f;
  --afb-muted: #8a7a7d;
  --afb-bg: #fbf5f2;
  --afb-card: #ffffff;
  --afb-radius: 1.25rem;
  --bs-primary: var(--afb-primary);
  --bs-primary-rgb: 176, 96, 111;
  --bs-body-color: var(--afb-ink);
  --bs-body-bg: var(--afb-bg);
  --bs-link-color: var(--afb-primary);
}

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

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background:
    radial-gradient(circle at 12% 8%, #f6e6e9 0, transparent 38%),
    radial-gradient(circle at 92% 92%, #f3e8d6 0, transparent 34%),
    var(--afb-bg);
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, .brand-title { font-family: Georgia, "Times New Roman", serif; }

.btn-afb {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--afb-primary);
  --bs-btn-border-color: var(--afb-primary);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--afb-primary-dark);
  --bs-btn-hover-border-color: var(--afb-primary-dark);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--afb-primary-dark);
  --bs-btn-active-border-color: var(--afb-primary-dark);
  --bs-btn-focus-shadow-rgb: 176, 96, 111;
  --bs-btn-disabled-bg: var(--afb-primary);
  --bs-btn-disabled-border-color: var(--afb-primary);
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: .02em;
}

/* ---------- Tela de acesso ---------- */

.page-center {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(1rem, env(safe-area-inset-top)) 1rem max(1rem, env(safe-area-inset-bottom));
}

.access-card {
  width: 100%;
  max-width: 940px;
  background: var(--afb-card);
  border-radius: 1.75rem;
  box-shadow: 0 20px 60px rgba(176, 96, 111, .18);
  display: flex;
  align-items: center;
  gap: 2.5rem;
  padding: 3rem;
}

.access-brand { flex: 0 0 38%; text-align: center; }
.access-brand img { width: 100%; max-width: 280px; height: auto; }
.access-brand p { color: var(--afb-muted); margin: 1rem 0 0; }

.access-divider {
  align-self: stretch;
  width: 1px;
  background: linear-gradient(to bottom, transparent, var(--afb-gold), transparent);
}

.access-form { flex: 1 1 auto; min-width: 0; }
.access-form h1 { font-size: 1.6rem; margin-bottom: .25rem; }
.access-form .lead-text { color: var(--afb-muted); margin-bottom: 1.5rem; font-size: .95rem; }

.form-floating > .form-control {
  border-radius: 1rem;
  border: 1.5px solid #eadcdf;
  background: #fffdfd;
  min-height: 3.6rem;
  font-size: 1rem; /* >=16px evita zoom automatico no iOS */
}
.form-floating > label { color: var(--afb-muted); }
.form-control:focus {
  border-color: var(--afb-primary);
  box-shadow: 0 0 0 .25rem rgba(176, 96, 111, .18);
}
.invalid-feedback { padding-left: .5rem; }

@media (max-width: 767.98px) {
  .page-center { align-items: flex-start; }
  .access-card {
    flex-direction: column;
    gap: 1.25rem;
    padding: 1.75rem 1.25rem 1.5rem;
    border-radius: 1.5rem;
    margin: auto 0;
  }
  .access-brand { flex-basis: auto; }
  .access-brand img { max-width: 130px; }
  .access-brand p { display: none; }
  .access-divider {
    align-self: auto;
    width: 100%;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--afb-gold), transparent);
  }
  .access-form { width: 100%; }
  .access-form h1 { font-size: 1.35rem; text-align: center; }
  .access-form .lead-text { text-align: center; margin-bottom: 1.1rem; }
  .btn-lg-mobile { padding: .9rem 1rem; font-size: 1.05rem; width: 100%; }
}

/* ---------- Catalogo ---------- */

.catalog-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(251, 245, 242, .92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid #efe1e4;
  padding: max(.6rem, env(safe-area-inset-top)) 1rem .6rem;
}
.catalog-header img { height: 44px; width: auto; }
.catalog-header h1 { font-size: 1.1rem; margin: 0; }
.catalog-header small { color: var(--afb-muted); }

.catalog-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem .75rem calc(7.5rem + env(safe-area-inset-bottom));
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .6rem;
}
@media (min-width: 576px) { .catalog-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .9rem; } }
@media (min-width: 992px) { .catalog-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.1rem; } }

.catalog-item {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  aspect-ratio: 1 / 1;
  border: 3px solid transparent;
  border-radius: var(--afb-radius);
  background: #efe4e6;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(61, 43, 47, .08);
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
  touch-action: manipulation;
}
.catalog-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
  transition: transform .25s ease;
}
.catalog-item::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(176, 96, 111, 0);
  transition: background .15s ease;
  pointer-events: none;
}
.catalog-item .check {
  position: absolute;
  top: .5rem;
  right: .5rem;
  z-index: 2;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--afb-primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
  transform: scale(0);
  transition: transform .18s cubic-bezier(.3, 1.6, .5, 1);
}
.catalog-item:focus-visible { outline: 3px solid var(--afb-gold); outline-offset: 2px; }
@media (hover: hover) { .catalog-item:hover img { transform: scale(1.04); } }

.catalog-item[aria-pressed="true"] {
  border-color: var(--afb-primary);
  box-shadow: 0 0 0 3px rgba(176, 96, 111, .35), 0 8px 22px rgba(176, 96, 111, .35);
  transform: scale(.97);
}
.catalog-item[aria-pressed="true"]::after { background: rgba(176, 96, 111, .28); }
.catalog-item[aria-pressed="true"] .check { transform: scale(1); }

.catalog-item.shake { animation: shake .35s; }
@keyframes shake {
  20%, 60% { transform: translateX(-5px); }
  40%, 80% { transform: translateX(5px); }
}

.catalog-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid #efe1e4;
  box-shadow: 0 -8px 24px rgba(61, 43, 47, .08);
  padding: .75rem 1rem calc(.75rem + env(safe-area-inset-bottom));
}
.catalog-bar .inner { max-width: 1100px; margin: 0 auto; display: flex; align-items: center; gap: 1rem; }
.counter { flex: 0 0 auto; line-height: 1.1; }
.counter strong { font-size: 1.6rem; font-family: Georgia, serif; color: var(--afb-primary); }
.counter span { display: block; font-size: .75rem; color: var(--afb-muted); }
.catalog-bar .btn { flex: 1 1 auto; padding: .95rem 1rem; font-size: 1.15rem; }
.catalog-bar .btn.is-incomplete { opacity: .85; }

.toast-container { z-index: 1090; pointer-events: none; }
.toast-container .toast { pointer-events: auto; }

.empty-state { text-align: center; padding: 4rem 1rem; color: var(--afb-muted); }

.modal-content { border: 0; border-radius: 1.5rem; }
.modal-body { padding: 2rem 1.5rem 1rem; text-align: center; }
.modal-body .icon { font-size: 2.6rem; line-height: 1; margin-bottom: .75rem; }
.modal-footer { border: 0; justify-content: center; padding: 0 1.5rem 1.75rem; }
.modal-footer .btn { min-width: 8rem; }

.skeleton .catalog-item { background: linear-gradient(90deg, #f1e6e8, #f9f1f2, #f1e6e8); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
