/* ─── Global Reset & Base ─────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: #FAF8F5;
  color: #111827;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

/* ─── Scrollbar thin ──────────────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #c8a882;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #b8926a;
}

/* ─── Category pills scroll (hide scrollbar) ──────────────────────────────── */
.scroll-x-hide {
  overflow-x: auto;
  scrollbar-width: none;
}

.scroll-x-hide::-webkit-scrollbar {
  display: none;
}

/* ─── Safe area helpers (iPhone notch / home bar) ─────────────────────────── */
.safe-top {
  padding-top: max(0px, env(safe-area-inset-top));
}

.safe-bottom {
  padding-bottom: max(16px, env(safe-area-inset-bottom));
}

/* ─── Toast container ─────────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  top: 72px;
  right: 12px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

/* ─── Screen transitions ──────────────────────────────────────────────────── */
.screen {
  display: none;
}

.screen.active {
  display: block;
}

/* ─── Card hover slider ───────────────────────────────────────────────────── */
.card-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  width: 0;
  background: #C9940A;
  border-radius: 0 2px 2px 0;
  pointer-events: none;
  z-index: 10;
  box-shadow: 0 0 6px rgba(201,148,10,.7);
}

.card-progress.active {
  animation: cardProgressFill linear forwards;
  /* duration set dynamically via JS style.animationDuration */
}

@keyframes cardProgressFill {
  from { width: 0; }
  to   { width: 100%; }
}

@keyframes cardSlideIn {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}

.card-main-img.slide-in {
  animation: cardSlideIn 200ms cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

/* ─── Product card hover ──────────────────────────────────────────────────── */
.product-card {
  transition: box-shadow .2s, transform .2s;
  width: 256px;
  border: 1px solid rgba(0, 0, 0, 0.055);
  will-change: transform;
}

.product-card:active {
  transform: scale(.97);
}

/* ─── Spinner overlay (sem backdrop-filter para evitar bug de blur pós-login) */
#global-spinner {
  position: fixed;
  inset: 0;
  background: rgba(250, 248, 245, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 8000;
}

/* ─── Chat bubble links ───────────────────────────────────────────────────── */
.chat-bubble a {
  text-decoration: underline;
}

.chat-bubble .add-to-cart-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 6px 14px;
  background: #C41200;
  color: #fff;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background .2s;
}

.chat-bubble .add-to-cart-btn:hover {
  background: #a30f00;
}

/* ─── Bottom nav active indicator ────────────────────────────────────────── */
.nav-btn.active svg {
  stroke: #C41200;
}

.nav-btn.active span {
  color: #C41200;
}

/* ─── Bottom nav glass ────────────────────────────────────────────────────── */
.nav-glass {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

/* ─── Backdrop ────────────────────────────────────────────────────────────── */
.backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  /* Sem z-index explícito: o sheet que vem depois no DOM fica naturalmente
     acima dentro do stacking context do modal, evitando que o backdrop
     bloqueie a interação com o conteúdo. */
}

/* ─── Hero banner gradient ────────────────────────────────────────────────── */
.hero-gradient {
  background: linear-gradient(130deg, #1A0A02 0%, #8B0D00 45%, #C41200 72%, #C9940A 100%);
}

/* ─── Gold text ───────────────────────────────────────────────────────────── */
.text-gold {
  color: #C9940A;
}

/* ─── Price highlight ─────────────────────────────────────────────────────── */
.price-text {
  color: #1A0A02;
  font-weight: 900;
}

/* ─── Product image 1:1 container ────────────────────────────────────────── */
#produto-detail-content{
  display: grid;
  grid-template-columns: 512px 1fr;
  column-gap: 15px;
  row-gap: 15px;
}
#produto-detail-content > *:nth-child(n+3) {
  grid-column: 1 / -1;
}
.img-square {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #f5f0eb;
}

.img-square img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* ─── Skeleton pulse warm tones ──────────────────────────────────────────── */
.skeleton-card {
  background: #EDE8E2;
}

/* ─── Onboarding / modal smooth close ────────────────────────────────────── */
.modal-sheet {
  max-height: 92vh;
  overflow-y: auto;
}

/* ─── Diff view (order adjustment) ───────────────────────────────────────── */
.diff-removed   { background: #fee2e2; }
.diff-changed   { background: #fef9c3; }
.diff-added     { background: #dcfce7; }
.diff-unchanged { background: transparent; }

/* ─── Mobile layout fixes ─────────────────────────────────────────────────── */
img {
  max-width: 100%;
}

.product-card {
  min-width: 0;
  max-width: 100%;
}

#produto-detail-content,
#modal-produto-content {
  overflow-wrap: break-word;
  word-break: break-word;
}

/* ─── Recommended card shimmer ───────────────────────────────────────────── */
@keyframes recGlow {
  0%, 100% { box-shadow: 0 0 0 1.5px rgba(201,148,10,.5), 0 0 10px rgba(201,148,10,.2); }
  50%       { box-shadow: 0 0 0 2px   rgba(201,148,10,.9), 0 0 18px rgba(201,148,10,.45); }
}
@keyframes recShimmer {
  0%   { background-position: 200% 50%; }
  100% { background-position: -200% 50%; }
}
.card-recommended {
  animation: recGlow 2.4s ease-in-out infinite;
  position: relative;
}
.card-recommended::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(105deg,
    transparent 40%,
    rgba(201,148,10,.12) 50%,
    transparent 60%
  );
  background-size: 200% 100%;
  animation: recShimmer 3s linear infinite;
  pointer-events: none;
}

/* ─── Gamification overlay ───────────────────────────────────────────────── */
@keyframes gamiSlideUp {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
@keyframes gamiShimmer {
  0%   { transform: translateX(-100%) skewX(-15deg); }
  100% { transform: translateX(300%)  skewX(-15deg); }
}
@keyframes gamiBarGrow {
  from { width: 0; }
  to   { width: var(--bar-pct, 0%); }
}

.gami-card {
  animation: gamiSlideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.gami-shimmer {
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,.15) 50%, transparent 60%);
  animation: gamiShimmer 2.5s ease-in-out infinite;
  pointer-events: none;
}

.gami-bar-fill {
  animation: gamiBarGrow 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.3s both;
}

/* ─── Desktop responsive ─────────────────────────────────────────────────── */
@media (min-width: 1024px) {
  #toast-container {
    top: 80px;
    right: 24px;
  }

  .product-card:hover {
    box-shadow: 0 8px 28px rgba(0, 0, 0, .1), 0 2px 8px rgba(26, 10, 2, .06);
    transform: translateY(-2px);
    border-color: rgba(0, 0, 0, 0.09);
  }

  /* Bottom sheets → centered dialogs on desktop */
  .modal-root {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
  }

  .modal-panel {
    position: relative !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    border-radius: 20px !important;
    max-width: 640px;
    width: 100%;
    animation: fadeIn .2s ease !important;
  }

  #modal-seps .modal-panel {
    max-width: 480px;
  }

  #modal-calc .modal-panel {
    max-width: 720px;
  }

  /* FAB above content (no bottom nav on desktop) */
  #btn-seps {
    bottom: 24px !important;
  }
}

