/* ═══════════════════════════════════════════════════════════════
   PHARMAGOLD — Pharmacy Blue Design System
   Light palette: Trust Blue + Clean White + Orange CTA
   Mobile-first responsive design
   ═══════════════════════════════════════════════════════════════ */

/* ── CSS Variables ── */
:root {
  --bg-body: #F8FAFC;
  --bg-card: #FFFFFF;
  --bg-elevated: #F1F5F9;
  --bg-input: #FFFFFF;
  --border: #E2E8F0;
  --border-hover: #CBD5E1;
  --text: #1E293B;
  --text-secondary: #475569;
  --text-muted: #94A3B8;
  --primary: #3B82F6;
  --primary-light: #60A5FA;
  --primary-dark: #2563EB;
  --primary-glow: rgba(59,130,246,.08);
  --cta: #F97316;
  --cta-light: #FB923C;
  --cta-dark: #EA580C;
  --green: #059669;
  --red: #DC2626;
  --gold: #9A7B12; /* darkened from #C9A227 for WCAG AA text contrast on white */
  --header-bg: #FFFFFF;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,.06), 0 2px 4px rgba(0,0,0,.04);
  --transition: all .2s ease;
  --font: 'Lexend', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  /* scales (additive — consumed by the new components) */
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 24px;
  --fs-xs: .7rem; --fs-sm: .8rem; --fs-md: .9rem; --fs-lg: 1.1rem;
  --dur-1: .15s; --dur-2: .25s; --dur-3: .4s;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.10);
}

/* ── Reset ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body.modal-open { overflow: hidden !important; }

/* ── Accessibility: visible keyboard focus ── */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}
.product-card:focus-visible,
.tab:focus-visible,
.icon-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }

/* ── Accessibility: respect the user's reduced-motion preference ── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}
body {
  font-family: var(--font);
  background: var(--bg-body);
  color: var(--text);
  line-height: 1.5;
  padding-bottom: 64px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
img { max-width: 100%; display: block; }

/* ═══════════════════════════════════════
   HEADER — Mobile-first
   ═══════════════════════════════════════ */
.header {
  position: sticky; top: 0; z-index: 100;
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  height: 56px;
  display: flex; align-items: center;
  padding: 0 12px;
  box-shadow: var(--shadow-sm);
}
.header-inner {
  max-width: 1200px; width: 100%; margin: 0 auto;
  display: flex; align-items: center; gap: 12px;
}

/* Logo — Pharmagold */
.logo {
  display: flex; align-items: center; gap: 8px;
  text-decoration: none !important; flex-shrink: 0;
}
.logo-icon {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, #1E40AF, #3B82F6);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  box-shadow: 0 2px 8px rgba(59,130,246,.25);
}
.logo-brand {
  font-size: 1.15rem; font-weight: 400;
  color: var(--text); letter-spacing: -.5px;
}
.logo-brand strong {
  font-weight: 700; color: var(--gold);
}

/* Search */
.search-bar {
  flex: 1; max-width: 420px; margin: 0 auto;
  display: none; /* Hidden on mobile by default */
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: 8px; overflow: hidden; height: 36px;
}
.search-bar input {
  flex: 1; border: none; padding: 0 12px; font-size: .85rem;
  outline: none; background: transparent; color: var(--text);
}
.search-bar input::placeholder { color: var(--text-muted); }
.search-btn {
  width: 40px; background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem; transition: var(--transition);
}
.search-btn:hover { background: var(--primary-dark); }

/* Header Actions */
.header-actions { display: flex; gap: 6px; flex-shrink: 0; margin-left: auto; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--bg-elevated); color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem; transition: var(--transition);
}
.icon-btn:hover { background: var(--primary-glow); color: var(--primary); }
#search-toggle-btn { display: flex; }
.cart-btn { position: relative; }
.cart-count {
  position: absolute; top: -3px; right: -3px;
  background: var(--cta); color: #fff; font-size: .6rem; font-weight: 700;
  width: 16px; height: 16px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

/* ═══════════════════════════════════════
   STORE HERO BANNER
   ═══════════════════════════════════════ */
.store-hero {
  background: linear-gradient(135deg, #1E40AF 0%, #3B82F6 50%, #60A5FA 100%);
  padding: 24px 16px 20px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.store-hero::before {
  content: '';
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}
.store-hero-inner { position: relative; z-index: 1; max-width: 600px; margin: 0 auto; }
.store-hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.15); backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,0.2);
  padding: 5px 14px; border-radius: 20px;
  font-size: .7rem; font-weight: 600; color: #fff;
  margin-bottom: 10px; letter-spacing: .3px;
}
.store-hero-badge i { color: #34D399; font-size: .7rem; }
.store-hero-title {
  font-size: 1.25rem; font-weight: 700; color: #fff;
  margin-bottom: 4px; line-height: 1.3;
  text-shadow: 0 1px 3px rgba(0,0,0,.1);
}
.store-hero-sub {
  font-size: .8rem; color: rgba(255,255,255,0.8);
  font-weight: 400;
}

/* ═══════════════════════════════════════
   CATEGORY TABS — Horizontal scroll
   ═══════════════════════════════════════ */
.category-tabs-wrapper {
  position: sticky; top: 56px; z-index: 90;
  background: var(--bg-body);
  border-bottom: 1px solid var(--border);
}
.category-tabs {
  display: flex; overflow-x: auto; gap: 0;
  scrollbar-width: none; padding: 0 8px;
  -webkit-overflow-scrolling: touch;
}
.category-tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 10px 16px; white-space: nowrap; font-size: .75rem;
  color: var(--text-muted); font-weight: 500;
  border-bottom: 2px solid transparent;
  transition: var(--transition); flex-shrink: 0;
  background: transparent;
}
.tab:hover { color: var(--text); }
.tab.active {
  color: var(--primary); border-bottom-color: var(--primary);
  font-weight: 600;
}
.scroll-indicator {
  height: 2px; background: linear-gradient(to right, var(--primary), var(--primary-dark));
  width: 30%; transition: transform .3s;
}

/* ═══════════════════════════════════════
   MAIN CONTENT
   ═══════════════════════════════════════ */
.main-content {
  max-width: 1200px; margin: 0 auto;
  padding: 12px;
}
.category-section { margin-bottom: 28px; }
.category-title {
  font-size: 1rem; font-weight: 700; color: var(--text);
  margin-bottom: 12px; padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}

/* ═══════════════════════════════════════
   PRODUCT GRID — Mobile: 2 cols
   ═══════════════════════════════════════ */
.product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.product-card {
  background: var(--bg-card); border-radius: var(--radius);
  overflow: hidden; border: 1px solid var(--border);
  transition: var(--transition); cursor: pointer;
  position: relative; display: flex; flex-direction: column;
}
.product-card:hover {
  border-color: var(--primary-light);
  box-shadow: 0 4px 16px rgba(59,130,246,.08);
  transform: translateY(-2px);
}
.product-card-inner {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; padding: 10px; gap: 6px; flex: 1;
}
.product-thumb {
  width: 100%; aspect-ratio: 1 / 1; max-height: 150px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-elevated); border-radius: var(--radius-sm);
  overflow: hidden;
}
.product-thumb img { width: 100%; height: 100%; object-fit: contain; }
.product-info {
  flex: 1; display: flex; flex-direction: column;
  min-width: 0; width: 100%;
}
.product-name {
  font-size: .75rem; font-weight: 600; color: var(--text);
  margin-bottom: 2px; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.product-desc {
  font-size: .65rem; color: var(--text-muted); line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
  margin-bottom: auto;
}
.product-price {
  font-size: 1rem; font-weight: 800; color: var(--primary-dark);
  padding: 8px 10px; border-top: 1px solid var(--border);
}
.product-card:active { transform: scale(.98); }
.product-card.is-oos .product-thumb img { filter: grayscale(.6); opacity: .7; }
.badge-sem-estoque {
  position: absolute; top: 6px; right: 6px;
  background: var(--red); color: #fff; font-size: .55rem;
  font-weight: 700; padding: 2px 6px; border-radius: 4px;
  text-transform: uppercase; letter-spacing: .5px;
}

/* ═══════════════════════════════════════
   GLOBAL BOTTOM NAV (all pages)
   ═══════════════════════════════════════ */
.global-bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  background: var(--header-bg);
  border-top: 1px solid var(--border);
  display: none; height: 56px;
  padding-bottom: env(safe-area-inset-bottom);
  backdrop-filter: blur(12px);
  box-shadow: 0 -2px 8px rgba(0,0,0,.04);
}
@media (max-width: 768px) {
  .global-bottom-nav { display: flex; }
  body { padding-bottom: 72px; }
}

.gnav-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px;
  color: var(--text-muted); font-size: .6rem; font-weight: 500;
  transition: color .2s; cursor: pointer;
  background: none; border: none; text-decoration: none;
  position: relative; min-height: 44px;
  font-family: 'Lexend', 'Inter', sans-serif;
  -webkit-tap-highlight-color: transparent;
}
.gnav-item i { font-size: 1.1rem; }
.gnav-item:hover,
.gnav-item:active,
.gnav-item.active { color: var(--primary); }

/* Cart badge */
.gnav-cart { position: relative; }
.gnav-badge {
  position: absolute; top: 4px; right: calc(50% - 16px);
  background: #EF4444; color: #fff; font-size: 9px; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px; line-height: 1;
}

/* ═══════════════════════════════════════
   MODALS
   ═══════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(15,23,42,.5); backdrop-filter: blur(4px);
  display: none; align-items: flex-end; justify-content: center;
  padding: 0; opacity: 0; transition: opacity .25s;
}
.modal-overlay.show { display: flex; opacity: 1; }
.modal {
  background: var(--bg-card); border-radius: 16px 16px 0 0;
  width: 100%; max-height: 85vh; overflow-y: auto;
  padding: 24px 16px; padding-bottom: calc(24px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 32px rgba(0,0,0,.08);
  transform: translateY(20px); transition: transform .3s;
  position: relative; border: 1px solid var(--border);
  border-bottom: none;
}
.modal-overlay.show .modal { transform: translateY(0); }
.modal::before {
  content: ''; display: block; width: 36px; height: 4px;
  background: var(--border); border-radius: 2px;
  margin: 0 auto 16px;
}
.modal-close {
  position: absolute; top: 16px; right: 16px;
  font-size: 1.4rem; color: var(--text-muted);
  background: var(--bg-elevated); width: 32px; height: 32px;
  border-radius: 50%; display: flex; align-items: center;
  justify-content: center; transition: var(--transition); line-height: 1;
}
.modal-close:hover { color: var(--text); background: var(--border); }
.modal h2 { font-size: 1.1rem; color: var(--text); margin-bottom: 12px; padding-right: 40px; }
.modal p { font-size: .82rem; color: var(--text-secondary); line-height: 1.6; margin-bottom: 10px; }
.telegram-link {
  display: inline-block; color: #0088cc; font-weight: 600;
  margin-bottom: 16px; word-break: break-all; font-size: .8rem;
}
.modal-btn-primary {
  display: block; width: 100%; padding: 14px;
  background: var(--cta); color: #fff; border-radius: 8px;
  font-size: .9rem; font-weight: 700; transition: var(--transition);
  margin-top: 8px; letter-spacing: .5px;
}
.modal-btn-primary:hover { background: var(--cta-dark); }

/* Payment Modal */
.pgtos-body hr { margin: 10px 0; border: none; border-top: 1px solid var(--border); }
.frete-table { margin-top: 8px; }
.frete-row {
  display: flex; justify-content: space-between;
  padding: 6px 0; font-size: .8rem; border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}
.frete-row span:last-child { font-weight: 600; color: var(--primary); }

/* ═══════════════════════════════════════
   CART SIDEBAR — Bottom-sheet on mobile, side drawer on desktop
   ═══════════════════════════════════════ */
.cart-overlay {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(15,23,42,.5); backdrop-filter: blur(4px);
  display: none; opacity: 0;
  transition: opacity .25s;
}
.cart-overlay.show { display: block; opacity: 1; }
.cart-sidebar {
  position: fixed; z-index: 95;
  background: var(--bg-card); display: flex; flex-direction: column;
  box-shadow: 0 -8px 32px rgba(0,0,0,.12);
  /* Mobile: bottom-sheet */
  bottom: calc(56px + env(safe-area-inset-bottom));
  left: 0; right: 0;
  max-height: 75vh;
  border-radius: 16px 16px 0 0;
  transform: translateY(100%);
  transition: transform .3s ease;
}
.cart-sidebar.open { transform: translateY(0); }

/* Mobile: overlay stops above bottom nav */
@media (max-width: 768px) {
  .cart-overlay { bottom: calc(56px + env(safe-area-inset-bottom)); }
}

.cart-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  position: relative; cursor: grab; touch-action: pan-y;
  -webkit-user-select: none; user-select: none;
}
.cart-header:active { cursor: grabbing; }
.cart-header::before {
  content: ''; position: absolute; top: 6px; left: 50%;
  transform: translateX(-50%);
  width: 36px; height: 4px; background: var(--border);
  border-radius: 2px;
}
.cart-header h2 { font-size: 1rem; color: var(--text); }
.cart-header h2 i { color: var(--primary); }
.cart-items { flex: 1; overflow-y: auto; padding: 12px; }
.cart-empty {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 32px 0; color: var(--text-muted);
}
.cart-empty i { font-size: 2.5rem; margin-bottom: 10px; color: var(--primary-light); }
.cart-item {
  display: flex; gap: 10px; padding: 10px 0;
  border-bottom: 1px solid var(--border); align-items: center;
}
.cart-item-img {
  width: 50px; height: 50px; border-radius: var(--radius-sm);
  overflow: hidden; background: var(--bg-elevated); flex-shrink: 0;
}
.cart-item-img img { width: 100%; height: 100%; object-fit: contain; }
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name { font-size: .75rem; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.cart-item-price { font-size: .8rem; font-weight: 700; color: var(--primary-dark); }
.cart-item-qty { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.cart-item-qty button {
  width: 24px; height: 24px; border-radius: 4px;
  background: var(--bg-elevated); color: var(--text);
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700;
}
.cart-item-qty span { font-size: .75rem; font-weight: 600; }
.cart-item-remove { color: var(--red); font-size: .8rem; padding: 4px; }
.cart-footer {
  padding: 14px 16px; border-top: 1px solid var(--border);
  background: var(--bg-card);
}
.cart-total {
  display: flex; justify-content: space-between;
  font-size: 1rem; font-weight: 700; color: var(--text); margin-bottom: 10px;
}
.cart-total span:last-child { color: var(--primary-dark); }
.cart-checkout-btn {
  width: 100%; padding: 14px; background: var(--cta); color: #fff;
  border-radius: 8px; font-size: .9rem; font-weight: 700;
  transition: var(--transition); letter-spacing: .5px;
}
.cart-checkout-btn:hover { background: var(--cta-dark); }

/* ═══════════════════════════════════════
   PRODUCT MODAL
   ═══════════════════════════════════════ */
.product-modal-content { max-width: 480px; }
.product-modal-body { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.product-modal-image {
  width: 160px; height: 160px; flex-shrink: 0;
  background: var(--bg-elevated); border-radius: var(--radius);
  overflow: hidden; display: flex; align-items: center; justify-content: center;
}
.product-modal-image img { max-width: 100%; max-height: 100%; object-fit: contain; }
.product-modal-info { flex: 1; width: 100%; text-align: center; }
.product-modal-info h2 { font-size: 1rem; padding-right: 0; text-align: center; }
.product-modal-desc { font-size: .78rem; color: var(--text-muted); margin-bottom: 12px; }
.product-modal-price { font-size: 1.3rem; font-weight: 800; color: var(--primary-dark); margin-bottom: 12px !important; }
.product-modal-qty {
  display: flex; align-items: center; justify-content: center;
  gap: 16px; margin-bottom: 12px;
}
.qty-btn {
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  font-size: 1.1rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  color: var(--text); transition: var(--transition);
}
.qty-btn:hover { background: var(--primary-glow); border-color: var(--primary); color: var(--primary); }
#qty-value { font-size: 1rem; font-weight: 700; min-width: 20px; text-align: center; }
.add-to-cart-btn { margin-top: 0; }
.add-to-cart-btn i { margin-right: 6px; }

/* ═══════════════════════════════════════
   RESPONSIVE — Desktop (768px+)
   ═══════════════════════════════════════ */
@media (min-width: 768px) {
  .header { padding: 0 24px; }
  .search-bar { display: flex; }
  #search-toggle-btn { display: none; }
  .main-content { padding: 20px; }
  .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
  }
  .product-card-inner {
    flex-direction: row; text-align: left;
    padding: 12px; gap: 10px;
  }
  .product-thumb { width: 90px; height: 90px; aspect-ratio: auto; }
  .product-name { font-size: .82rem; }
  .product-desc { font-size: .72rem; -webkit-line-clamp: 3; }
  .category-title { font-size: 1.15rem; }
  .tab { font-size: .8rem; padding: 10px 18px; }

  /* Modal — centered on desktop */
  .modal-overlay { align-items: center; padding: 20px; }
  .modal {
    border-radius: 16px; max-width: 560px;
    border-bottom: 1px solid var(--border);
  }
  .modal::before { display: none; }

  /* Cart drawer on desktop — right side */
  .cart-sidebar {
    width: 380px; left: auto; right: 0;
    top: 0; bottom: 0; max-height: 100vh;
    border-radius: 0;
    transform: translateX(100%);
  }
  .cart-sidebar.open { transform: translateX(0); }
  .cart-header::before { display: none; }
  .cart-overlay { bottom: 0; }

  /* Product modal on desktop */
  .product-modal-body { flex-direction: row; text-align: left; }
  .product-modal-info { text-align: left; }
  .product-modal-info h2 { text-align: left; }
  .product-modal-qty { justify-content: flex-start; }
  .product-modal-image { width: 180px; height: 180px; }
}

@media (min-width: 1024px) {
  .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
  }
}

/* ═══════════════════════════════════════
   SEARCH OPEN STATE (mobile)
   ═══════════════════════════════════════ */
.header.search-open .search-bar {
  display: flex; position: absolute;
  left: 12px; right: 12px; top: 10px;
  max-width: none; z-index: 10;
}

/* ═══════════════════════════════════════════════════════════════
   UX MODERNIZATION v5 — skeletons, toasts, states, micro-interactions
   ═══════════════════════════════════════════════════════════════ */

/* ── Skeleton loading (shimmer) ── */
.skeleton-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; padding-bottom: var(--space-2);
}
.sk { position: relative; overflow: hidden; background: var(--bg-elevated); border-radius: var(--radius-sm); }
.sk::after {
  content: ''; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.6), transparent);
  animation: sk-shimmer 1.2s infinite;
}
@keyframes sk-shimmer { 100% { transform: translateX(100%); } }
.skeleton-card .sk-thumb { aspect-ratio: 1; width: 72%; margin: 10px auto 8px; }
.sk-line { height: 10px; margin: 6px 10px; }
.sk-line.short { width: 50%; }
.sk-price { height: 14px; width: 40%; margin: 10px; }
.sk-tab { width: 76px; height: 18px; border-radius: 10px; margin: 12px 8px; flex-shrink: 0; }

/* ── Empty / error / no-results states ── */
.state-block { grid-column: 1 / -1; text-align: center; padding: 40px 16px; color: var(--text-muted); }
.state-block i { display: block; font-size: 2rem; color: var(--primary-light); margin-bottom: 10px; }
.state-block p { font-size: var(--fs-sm); margin-bottom: 14px; }
.state-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 10px 20px;
  background: var(--primary); color: #fff; border: none; border-radius: 8px;
  font-size: var(--fs-sm); font-weight: 600; font-family: inherit; cursor: pointer;
  transition: var(--transition); min-height: 44px; text-decoration: none;
}
.state-btn:hover { background: var(--primary-dark); }

/* ── Storefront toast (above the bottom nav) ── */
.toast-container {
  position: fixed; left: 12px; right: 12px;
  bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  z-index: 300; display: flex; flex-direction: column; gap: 8px;
  pointer-events: none; align-items: center;
}
.toast-msg {
  background: var(--text); color: #fff; border-radius: 10px; padding: 12px 16px;
  font-size: var(--fs-sm); font-weight: 500; display: flex; align-items: center; gap: 8px;
  width: min(360px, 100%); box-shadow: var(--shadow-lg);
  animation: toast-up var(--dur-2) var(--ease-out); pointer-events: auto; cursor: pointer;
}
.toast-msg i { flex-shrink: 0; }
.toast-msg.success i { color: #34D399; }
.toast-msg.error i { color: #F87171; }
.toast-msg.hide { opacity: 0; transform: translateY(8px); transition: opacity var(--dur-2), transform var(--dur-2); }
@keyframes toast-up { from { opacity: 0; transform: translateY(12px); } }
@media (min-width: 769px) { .toast-container { left: auto; right: 20px; bottom: 20px; align-items: flex-end; } }

/* ── Cart badge pop ── */
@keyframes badge-pop { 0% { transform: scale(1); } 40% { transform: scale(1.45); } 100% { transform: scale(1); } }
.cart-count.bump, .gnav-badge.bump { animation: badge-pop var(--dur-3) var(--ease-out); }

/* ── Category tabs: right-edge scroll affordance ── */
.category-tabs-wrapper::after {
  content: ''; position: absolute; top: 0; right: 0; bottom: 2px;
  width: 32px; pointer-events: none;
  background: linear-gradient(to right, rgba(248,250,252,0), var(--bg-body));
  transition: opacity var(--dur-1);
}
.category-tabs-wrapper.at-end::after { opacity: 0; }

/* ── Auth pages: password toggle, inline validation, submit guard ── */
.pwd-field { position: relative; }
.pwd-field input { padding-right: 44px; }
.pwd-toggle {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 38px; height: 38px; display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); background: none; border: none; cursor: pointer;
  border-radius: 8px; font-size: 14px;
}
.pwd-toggle:hover { color: var(--primary); }
.field-error-msg { display: none; color: var(--red); font-size: 12px; margin-top: 5px; }
.field.invalid input { border-color: var(--red) !important; box-shadow: 0 0 0 3px rgba(220,38,38,.08) !important; }
.field.invalid .field-error-msg { display: block; }
.auth-btn[disabled] { opacity: .6; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
.btn-spinner {
  display: inline-block; width: 14px; height: 14px; margin-right: 6px; vertical-align: -2px;
  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); } }

/* ============================================================
   PRODUCT CARD — polished vitrine (append; overrides legacy ~246-295)
   - Badge fix: overlays anchor INSIDE .product-thumb (position+isolation),
     so "SEM ESTOQUE" always paints in FRONT of the image (the grayscale
     filter on the OOS img no longer wins the stacking order).
   - Adds .product-foot (the price panel doubles as the quick-add tap
     zone — see the "Quick-add zone" section) and .badge-low-stock.
     Keeps every class name the JS relies on.
   ============================================================ */

/* Footer pins to the card bottom regardless of name/desc height */
.product-card { display: flex; flex-direction: column; }
.product-card-inner { margin-bottom: 0; }

/* Thumb = overlay anchor + own stacking context (THE badge fix).
   Tinted, padded panel so white medicine boxes/pens don't float on white. */
.product-thumb {
  position: relative;
  isolation: isolate;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px;
  overflow: hidden;
}
.product-thumb img { width: 100%; height: 100%; object-fit: contain; }

/* OOS scrim — only on OOS, keeps the red badge legible over white photos */
.product-card.is-oos .product-thumb::after {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(180deg, rgba(15,23,42,.28) 0%, rgba(15,23,42,0) 42%);
  border-radius: var(--radius-sm);
}

/* ── BADGE FIX: true overlay IN FRONT of the image ──
   z-index above scrim/img + solid pill + shadow + white ring. */
.badge-sem-estoque {
  position: absolute; top: 6px; left: 6px; z-index: 3;
  background: var(--red); color: #fff;
  font-size: .58rem; font-weight: 800; line-height: 1;
  letter-spacing: .4px; text-transform: uppercase;
  padding: 4px 8px; border-radius: 999px;
  box-shadow: 0 2px 6px rgba(220,38,38,.40), 0 0 0 2px rgba(255,255,255,.85);
  pointer-events: none; /* clicks fall through to the card */
}
/* Optional low-stock urgency pill — GOLD so it never competes with the orange CTA */
.badge-low-stock {
  position: absolute; top: 6px; right: 6px; z-index: 3; pointer-events: none;
  background: var(--gold); color: #fff;
  font-size: .55rem; font-weight: 800; line-height: 1;
  letter-spacing: .3px; text-transform: uppercase;
  padding: 4px 7px; border-radius: 999px;
  box-shadow: 0 2px 6px rgba(0,0,0,.18);
}
/* Dim only the artwork; badge/footer stay fully legible. */
.product-card.is-oos .product-thumb img { filter: grayscale(.55); opacity: .6; }
.product-card.is-oos { cursor: default; }
.product-card.is-oos:hover { transform: none; box-shadow: var(--shadow-sm); }

/* ── Footer: price + persistent CTA, pinned to card bottom ── */
.product-foot {
  margin-top: auto;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px 10px;
  border-top: 1px solid var(--border);
}
/* Price now inline in the footer — drop its old border/padding */
.product-price {
  font-size: 1rem; font-weight: 800; color: var(--primary-dark);
  line-height: 1.1; white-space: nowrap; flex: 0 1 auto;
  padding: 0; border-top: 0;
}

/* ── Quick-add zone: the WHOLE footer (price panel) adds to the cart ──
   No button: a subtle cart watermark drawn inside the panel is the
   affordance that tapping here sends the product straight to the cart.
   (The card body above it opens the detail modal.) */
.product-foot { position: relative; }
.product-foot:not(.is-oos) {
  cursor: pointer;
  user-select: none; -webkit-tap-highlight-color: transparent;
}
.product-foot:not(.is-oos)::after {
  content: ''; position: absolute;
  right: 18px; top: 50%; width: 38px; height: 38px;
  transform: translateY(-50%);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%239A7B12' d='M7 18a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 18zm10 0a2 2 0 1 0 .001 4.001A2 2 0 0 0 17 18zM6.2 14h11.1c.8 0 1.5-.5 1.8-1.2l3-6.6A1 1 0 0 0 21.2 4.8H6.4l-.7-2A1 1 0 0 0 4.8 2H2v2h2.1l3.2 8.1-1.2 2.2C5.3 15.2 5.9 16 6.9 16H19v-2H6.7l-.5-.9z'/%3E%3C/svg%3E") center / contain no-repeat;
  opacity: .13; pointer-events: none;
  transition: opacity var(--dur-1) ease;
}
.price-box { transition: background var(--dur-1) ease, border-color var(--dur-1) ease, transform var(--dur-1) ease; }
.product-foot:not(.is-oos):hover .price-box {
  background: rgba(154,123,18,.10);
  border-color: rgba(154,123,18,.45);
}
.product-foot:not(.is-oos):hover::after { opacity: .26; }
.product-foot:not(.is-oos):active .price-box { transform: scale(.985); }
.product-foot:focus-visible {
  outline: 2px solid var(--gold); outline-offset: -2px;
  border-radius: var(--radius-sm);
}
/* Brief added-confirmation flash (no layout shift): JS toggles .is-adding ~600ms */
.product-foot.is-adding { pointer-events: none; }
.product-foot.is-adding .price-box {
  background: rgba(5,150,105,.10);
  border-color: rgba(5,150,105,.45);
}
/* Out of stock: the footer is informational only */
.product-foot.is-oos { cursor: default; }

/* ── Mobile (<=767px) ── */
@media (max-width: 767px) {
  .product-foot { flex-wrap: wrap; gap: 6px; padding: 8px; }
  .product-price { flex: 1 1 100%; font-size: .95rem; }
  .product-name { font-size: .82rem; }
  .product-desc { font-size: .72rem; }
}

/* ── Desktop (>=768px) ── */
@media (min-width: 768px) {
  .product-foot { padding: 10px 12px 12px; gap: 10px; }
  .product-price { font-size: 1.1rem; }
}

/* Reduced-motion: drop the micro-interactions on the quick-add zone */
@media (prefers-reduced-motion: reduce) {
  .price-box { transition: none; }
  .product-foot:not(.is-oos):active .price-box { transform: none; }
}

/* ============================================================
   PRICE PANEL — "de/por" anchoring + trust line (append-overrides)
   Inspired by classic promo cards: soft gold panel (echoes the
   PharmaGold wordmark), struck old price + OFERTA chip when
   compare_price is set, and a quiet trust line. The CTA goes
   full-width beneath the panel on every viewport.
   ============================================================ */
.product-foot {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}
.price-box {
  display: flex; flex-direction: column; gap: 3px;
  text-align: left;
  background: rgba(154,123,18,.06);
  border: 1px solid rgba(154,123,18,.22);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}
.price-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 4px 6px; flex-wrap: wrap; /* narrow cards: the chip drops below, the price never breaks */
}
.price-old {
  font-size: .7rem; font-weight: 600; color: var(--text-muted);
  text-decoration: line-through; white-space: nowrap;
}
.badge-oferta {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--red); color: #fff;
  font-size: .55rem; font-weight: 800; line-height: 1;
  letter-spacing: .4px; text-transform: uppercase;
  padding: 3px 7px; border-radius: 999px;
}
.badge-oferta i { font-size: .55rem; }
/* Price inside the panel goes gold (brand accent); overrides the blue */
.price-box .product-price {
  color: var(--gold);
  font-size: 1.15rem; font-weight: 800; line-height: 1.1;
  white-space: nowrap; padding: 0; border-top: 0; flex: none;
}
.trust-line {
  display: flex; align-items: center; gap: 4px;
  font-size: .62rem; color: var(--text-secondary);
}
.trust-line i { color: var(--green); font-size: .6rem; }
/* Modal "de/por" */
#product-modal-price .price-old,
#product-modal-price s {
  font-size: .8em; font-weight: 600; color: var(--text-muted); margin-right: 6px;
}
@media (max-width: 767px) {
  .price-box .product-price { font-size: 1.05rem; }
  .price-box { padding: 7px 8px; }
}

/* ═══════════════════════════════════════════════════════════════
   CATEGORY NAV REDESIGN — mobile filled pills + desktop sticky sidebar
   Appended last: source-order wins over the legacy .tab underline rules
   (~195-221) and the old ::after fade (~638-644) at equal specificity.
   Blue (--primary) = nav active. Orange (--cta) stays reserved for the
   product buy button.
   ═══════════════════════════════════════════════════════════════ */

/* Vestigial 2px bar — JS never drives it; hide everywhere (no markup edit). */
.scroll-indicator { display: none; }

/* Layout wrapper: plain block on mobile, flex row on desktop. */
.catalog-layout { display: block; }

/* ── MOBILE-FIRST (<=767px): rounded filled-pill bar ─────────────── */
.category-tabs-wrapper {
  position: sticky; top: 56px; z-index: 90;
  background: var(--bg-body);
  border-bottom: 1px solid var(--border);
}
.category-tabs {
  display: flex; gap: var(--space-2);
  overflow-x: auto; overflow-y: hidden;
  padding: var(--space-2) var(--space-4);
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  scroll-padding-left: var(--space-4);
}
.category-tabs::-webkit-scrollbar { display: none; }

.tab {
  flex-shrink: 0;
  display: inline-flex; align-items: center;
  min-height: 38px; padding: 8px 16px;
  white-space: nowrap;
  font-family: inherit; font-size: var(--fs-sm); font-weight: 600; line-height: 1;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;                 /* full pill (overrides old underline) */
  cursor: pointer;
  scroll-snap-align: start;
  transition: background var(--dur-1) ease, color var(--dur-1) ease,
              border-color var(--dur-1) ease, box-shadow var(--dur-1) ease;
}
.tab:hover { color: var(--text); border-color: var(--border-hover); }
.tab.active {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 2px 6px rgba(59,130,246,.28);
}
.tab.active:hover { color: #fff; background: var(--primary-dark); border-color: var(--primary-dark); }
.tab:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Both-edge scroll fades. Right fade reuses the existing .at-end hook;
   left fade uses the new .at-start hook (toggled in initTabsFade). */
.category-tabs-wrapper::before,
.category-tabs-wrapper::after {
  content: ''; position: absolute; top: 0; bottom: 1px;
  width: 28px; pointer-events: none; z-index: 1;
  transition: opacity var(--dur-1);
}
.category-tabs-wrapper::before {                /* left fade */
  left: 0; right: auto; opacity: 0;
  background: linear-gradient(to right, var(--bg-body), rgba(248,250,252,0));
}
.category-tabs-wrapper.at-start::before { opacity: 1; }
.category-tabs-wrapper::after {                 /* right fade (redefines old ::after) */
  right: 0; left: auto; opacity: 1;
  background: linear-gradient(to left, var(--bg-body), rgba(248,250,252,0));
}
.category-tabs-wrapper.at-end::after { opacity: 0; }

/* Skeleton pills match the new shape. */
.sk-tab { width: 84px; height: 38px; border-radius: 999px; margin: 8px 0; flex-shrink: 0; }
.category-tabs .sk-tab:first-child { margin-left: var(--space-4); }

/* ── DESKTOP (>=768px): same horizontal pill bar as mobile, centered
   within the content width and slightly roomier. (The earlier sticky
   left-sidebar layout was rejected by the user.) ── */
@media (min-width: 768px) {
  .category-tabs {
    max-width: 1200px; margin: 0 auto;
    padding: 10px 20px;
    scroll-padding-left: 20px;
  }
  .tab { min-height: 40px; font-size: .82rem; padding: 9px 18px; }
}

/* ── Reduced motion ─────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .category-tabs { scroll-snap-type: none; }
  .tab,
  .category-tabs-wrapper::before,
  .category-tabs-wrapper::after { transition: none; }
}

/* ============================================================
   PRODUCT CARD — bigger & bolder (space freed by removing the
   on-card button: larger photo, name and price get more emphasis)
   ============================================================ */
.product-thumb { max-height: 184px; }
.product-card-inner { padding: 12px 12px 10px; gap: 8px; }
.product-grid { gap: 10px; }

@media (max-width: 767px) {
  .product-name { font-size: .9rem; line-height: 1.25; }
  .product-desc { font-size: .75rem; }
  .price-box .product-price { font-size: 1.2rem; }
}
@media (min-width: 768px) {
  .product-grid { gap: 14px; }
  .product-thumb { width: 112px; height: 112px; }
  .product-name { font-size: .92rem; }
  .product-desc { font-size: .75rem; }
  .price-box .product-price { font-size: 1.3rem; }
}
