/* =========================================================
   KTech Eletrônicos — Catálogo v2
   Mobile-first · imagens quadradas · visual limpo
   ========================================================= */

:root {
  --brand: #5b5bd6;
  --brand-dark: #4338ca;
  --grad: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --bg: #f3f4f9;
  --surface: #ffffff;
  --surface-2: #f7f8fc;
  --text: #14151f;
  --muted: #6b7084;
  --line: #e6e8f0;
  --success: #16a34a;
  --danger: #e5484d;
  --warning: #f59e0b;
  --wa: #25d366;
  --wa-dark: #128c7e;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow-sm: 0 1px 2px rgba(20,21,31,.06), 0 1px 3px rgba(20,21,31,.04);
  --shadow: 0 8px 28px rgba(20,21,31,.08);
  --shadow-lg: 0 20px 50px rgba(20,21,31,.20);
  --gutter: 20px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);

  /* compatibilidade com utils.js */
  --primary: #667eea;
  --primary-dark: #5a6fd8;
  --secondary: #764ba2;
  --gray: #6b7084;
  --light: #f7f8fc;
  --dark: #14151f;
  --white: #ffffff;
  --gradient: var(--grad);
  --border-radius: 18px;
  --border-radius-sm: 12px;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
body.no-scroll { overflow: hidden; }

button { font-family: inherit; cursor: pointer; }
img { max-width: 100%; }

.hidden { display: none !important; }

/* ===== TOPO (header + categorias) ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(255,255,255,.9);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--line);
  padding-top: var(--safe-t);
}

.header {
  max-width: 1280px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas: "brand search cart";
  align-items: center;
  gap: 16px;
  padding: 12px var(--gutter);
}

.brand { grid-area: brand; display: flex; align-items: center; gap: 10px; text-decoration: none; min-width: 0; }
.brand .logo { height: 40px; width: auto; display: block; }
.brand h1 {
  font-size: 17px; font-weight: 800; letter-spacing: -.02em; color: var(--text);
  white-space: nowrap;
}
.brand h1 span { color: var(--brand); }

.search-container { grid-area: search; position: relative; width: 100%; max-width: 560px; justify-self: center; }
.search-icon {
  position: absolute; left: 15px; top: 50%; transform: translateY(-50%);
  color: var(--muted); pointer-events: none; display: flex;
}
.search-input {
  width: 100%; height: 46px;
  padding: 0 16px 0 44px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  font: inherit; font-size: 15px; color: var(--text);
  outline: none;
  transition: border-color .2s, background .2s, box-shadow .2s;
  -webkit-appearance: none; appearance: none;
}
.search-input::placeholder { color: #9aa0b4; }
.search-input:focus { border-color: var(--brand); background: var(--surface); box-shadow: 0 0 0 4px rgba(91,91,214,.12); }

.cart-button {
  grid-area: cart;
  position: relative;
  width: 46px; height: 46px;
  border: none; border-radius: 14px;
  background: var(--text); color: #fff;
  display: flex; align-items: center; justify-content: center;
  transition: transform .15s;
}
.cart-button:active { transform: scale(.94); }
.cart-count {
  position: absolute; top: -6px; right: -6px;
  min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 999px; border: 2px solid #fff;
  background: var(--danger); color: #fff;
  font-size: 11px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.cart-count.bump { animation: bump .35s ease; }
@keyframes bump { 50% { transform: scale(1.3); } }

/* Categorias */
.cat-nav { max-width: 1280px; margin: 0 auto; }
.cat-nav-track {
  display: flex; gap: 8px;
  overflow-x: auto;
  padding: 2px var(--gutter) 12px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}
.cat-nav-track::-webkit-scrollbar { display: none; }
.cat-nav-pill {
  flex-shrink: 0;
  height: 36px; padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 13.5px; font-weight: 600;
  white-space: nowrap;
  transition: all .2s;
}
@media (hover: hover) { .cat-nav-pill:hover { color: var(--text); border-color: #cfd3e1; } }
.cat-nav-pill.active { background: var(--text); color: #fff; border-color: var(--text); }

/* ===== CONTEÚDO ===== */
.products-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 18px var(--gutter) calc(120px + var(--safe-b));
}

.hero-strip {
  display: flex; gap: 8px;
  overflow-x: auto; scrollbar-width: none;
  margin: 0 calc(var(--gutter) * -1) 6px;
  padding: 0 var(--gutter) 2px;
}
.hero-strip::-webkit-scrollbar { display: none; }
.hero-chip {
  flex-shrink: 0;
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600; color: var(--muted);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; padding: 7px 12px;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 18px;
}

.category-header {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 10px;
  margin: 22px 0 0;
}
.category-header:first-child { margin-top: 10px; }
.category-header-label { font-size: 18px; font-weight: 800; letter-spacing: -.01em; color: var(--text); }
.category-count {
  font-size: 12px; font-weight: 700; color: var(--muted);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; padding: 2px 9px;
}
.category-header::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* ===== CARD DE PRODUTO ===== */
.product-card {
  position: relative;
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s;
}
@media (hover: hover) {
  .product-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: transparent; }
  .product-card:hover .product-image { transform: scale(1.04); }
}
.product-card.in-cart { border-color: rgba(91,91,214,.45); box-shadow: 0 0 0 1px rgba(91,91,214,.25); }

.product-media {
  position: relative;
  aspect-ratio: 1 / 1;            /* imagem quadrada */
  background: #fff;
  overflow: hidden;
  cursor: pointer;
  outline: none;
}
.product-image {
  width: 100%; height: 100%;
  object-fit: contain;            /* nunca corta */
  display: block;
  transition: transform .4s ease;
}
.product-media:focus-visible { box-shadow: inset 0 0 0 3px var(--brand); }

.badge-off {
  position: absolute; top: 10px; left: 10px;
  background: var(--danger); color: #fff;
  font-size: 12px; font-weight: 800; letter-spacing: .01em;
  padding: 4px 8px; border-radius: 999px;
  box-shadow: 0 4px 10px rgba(229,72,77,.3);
}
.badge-incart {
  position: absolute; top: 10px; right: 10px;
  background: var(--brand); color: #fff;
  font-size: 12px; font-weight: 800;
  padding: 4px 8px; border-radius: 999px;
  box-shadow: 0 4px 10px rgba(91,91,214,.3);
}

.product-body {
  flex: 1;
  display: flex; flex-direction: column; gap: 10px;
  padding: 12px 14px 14px;
  border-top: 1px solid var(--line);
}
.product-title {
  font-size: 14px; font-weight: 600; line-height: 1.35; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  min-height: calc(1.35em * 3);
  cursor: pointer;
  word-break: break-word;
}
.product-price { display: flex; flex-direction: column; gap: 1px; margin-top: auto; }
.product-price-old { font-size: 12.5px; color: var(--muted); text-decoration: line-through; }
.product-price-now { font-size: 20px; font-weight: 800; letter-spacing: -.02em; color: var(--text); }
.product-price-ask { font-size: 14px; font-weight: 700; color: var(--wa-dark); }

.btn-add, .btn-consulte {
  width: 100%; height: 42px;
  border: none; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 14px; font-weight: 700;
  text-decoration: none;
  transition: transform .15s, box-shadow .2s, filter .2s;
}
.btn-add { background: var(--grad); color: #fff; box-shadow: 0 6px 16px rgba(102,126,234,.3); }
.btn-consulte { background: linear-gradient(135deg, var(--wa), var(--wa-dark)); color: #fff; box-shadow: 0 6px 16px rgba(37,211,102,.25); }
.btn-add:active, .btn-consulte:active { transform: scale(.97); }
@media (hover: hover) { .btn-add:hover, .btn-consulte:hover { filter: brightness(1.06); } }

.qty-stepper {
  width: 100%; height: 42px;
  display: flex; align-items: center; justify-content: space-between;
  border: 1.5px solid var(--brand);
  border-radius: 12px;
  background: rgba(91,91,214,.06);
  overflow: hidden;
}
.qty-btn {
  width: 42px; height: 100%;
  border: none; background: transparent;
  color: var(--brand-dark);
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.qty-btn:active { background: rgba(91,91,214,.15); }
.qty-btn[data-action="remove"] { color: var(--danger); }
.qty-value { font-size: 15px; font-weight: 800; color: var(--brand-dark); min-width: 24px; text-align: center; }
.qty-stepper.sm { width: auto; height: 34px; border-radius: 10px; }
.qty-stepper.sm .qty-btn { width: 34px; }

/* Estado vazio / erro */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 56px 20px;
  color: var(--muted);
}
.empty-state .es-icon { font-size: 44px; margin-bottom: 12px; }
.empty-state .es-title { font-size: 17px; font-weight: 700; color: var(--text); }
.empty-state .es-sub { font-size: 14px; margin-top: 6px; }
.empty-state button {
  margin-top: 16px; height: 40px; padding: 0 18px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  font-weight: 600; color: var(--text);
}

/* Skeleton */
.skeleton-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; padding-bottom: 14px; }
.sk-img { aspect-ratio: 1 / 1; }
.sk-line { height: 12px; margin: 14px 14px 0; border-radius: 6px; }
.sk-line.short { width: 45%; }
.sk-btn { height: 40px; margin: 16px 14px 0; border-radius: 12px; }
.sk-img, .sk-line, .sk-btn {
  background: linear-gradient(90deg, #eef0f6 25%, #f8f9fc 50%, #eef0f6 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite linear;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.fade-in { animation: fadeIn .35s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ===== BARRA FLUTUANTE DO CARRINHO ===== */
.floating-cart {
  position: fixed;
  left: 50%;
  bottom: calc(16px + var(--safe-b));
  transform: translateX(-50%);
  z-index: 1500;
  width: min(440px, calc(100vw - 24px));
  display: flex; align-items: center; gap: 12px;
  padding: 8px 8px 8px 14px;
  border: none; border-radius: 18px;
  background: var(--text); color: #fff;
  box-shadow: var(--shadow-lg);
  text-align: left;
  transition: transform .35s cubic-bezier(.32,.72,0,1), opacity .25s;
}
.floating-cart.is-empty { transform: translate(-50%, 160%); opacity: 0; pointer-events: none; }
.fc-icon { position: relative; display: flex; }
.fc-badge {
  position: absolute; top: -8px; right: -10px;
  min-width: 18px; height: 18px; padding: 0 4px;
  background: var(--danger); border-radius: 999px;
  font-size: 10.5px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.fc-text { flex: 1; display: flex; flex-direction: column; line-height: 1.15; padding-left: 4px; }
.fc-text small { font-size: 11.5px; color: #b9bdcc; font-weight: 500; }
.fc-text strong { font-size: 16px; font-weight: 800; }
.fc-cta {
  background: var(--grad); color: #fff;
  padding: 0 16px; height: 42px; border-radius: 12px;
  display: flex; align-items: center;
  font-size: 14px; font-weight: 700; white-space: nowrap;
}

/* ===== PAINEL DO CARRINHO ===== */
.cart-overlay {
  position: fixed; inset: 0;
  background: rgba(10,11,20,.5);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  z-index: 2000;
  opacity: 0; visibility: hidden;
  transition: opacity .3s, visibility .3s;
}
.cart-overlay.active { opacity: 1; visibility: visible; }

.cart-panel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(460px, 100vw);
  background: var(--bg);
  z-index: 2001;
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform .35s cubic-bezier(.32,.72,0,1);
  box-shadow: var(--shadow-lg);
}
.cart-panel.active { transform: none; }

.cart-header {
  display: flex; align-items: center; gap: 12px;
  padding: calc(12px + var(--safe-t)) 16px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.cart-close {
  height: 38px; padding: 0 12px 0 8px;
  display: flex; align-items: center; gap: 4px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--text);
  font-size: 14px; font-weight: 600;
}
.cart-title { font-size: 18px; font-weight: 800; letter-spacing: -.01em; }
.cart-title-count { color: var(--muted); font-weight: 600; }

.cart-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 14px;
  display: flex; flex-direction: column; gap: 12px;
}

.cart-items { display: flex; flex-direction: column; gap: 10px; }

.cart-empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.cart-empty .es-icon { font-size: 48px; margin-bottom: 12px; }
.cart-empty .es-title { font-size: 17px; font-weight: 700; color: var(--text); }
.cart-empty button {
  margin-top: 18px; height: 44px; padding: 0 22px;
  border: none; border-radius: 12px;
  background: var(--grad); color: #fff; font-weight: 700; font-size: 15px;
}

.cart-item {
  position: relative;
  display: grid;
  grid-template-columns: 64px 1fr;
  column-gap: 12px; row-gap: 8px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.cart-item-thumb {
  grid-row: span 2;
  width: 64px; height: 64px;
  object-fit: contain; background: #fff;
  border: 1px solid var(--line); border-radius: 10px;
}
.cart-item-info { min-width: 0; padding-right: 30px; }
.cart-item-name {
  font-size: 14px; font-weight: 600; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.cart-item-price { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.cart-item-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cart-item-subtotal { font-size: 15px; font-weight: 800; }
.cart-item-remove {
  position: absolute; top: 8px; right: 8px;
  width: 30px; height: 30px;
  border: none; border-radius: 8px; background: transparent;
  color: var(--muted);
  display: flex; align-items: center; justify-content: center;
}
.cart-item-remove:active { background: #fde8e8; color: var(--danger); }

.cart-total {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 6px;
}
.total-row { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; color: var(--muted); }
.total-row strong { color: var(--text); font-weight: 700; }
.total-row.grand { margin-top: 4px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 16px; color: var(--text); font-weight: 800; }
.total-row.grand strong { font-size: 18px; font-weight: 800; }

.cart-checkout { display: flex; flex-direction: column; gap: 12px; }

.panel-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px;
}
.field-label {
  display: block;
  font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}
.field-label.mt { margin-top: 14px; }

.option-group { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.option-group.three { grid-template-columns: repeat(3, 1fr); }
.option-card {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 64px; padding: 10px 6px;
  border: 1.5px solid var(--line); border-radius: 12px;
  background: var(--surface);
  font-size: 13.5px; font-weight: 600; color: var(--text); text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s, box-shadow .2s;
}
.option-card input { position: absolute; opacity: 0; pointer-events: none; }
.option-emoji { font-size: 20px; line-height: 1; }
.option-card:has(input:checked) {
  border-color: var(--brand);
  background: rgba(91,91,214,.06);
  color: var(--brand-dark);
  box-shadow: 0 0 0 3px rgba(91,91,214,.12);
}
.option-card:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }

.form-input, .form-select, .form-textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  margin-top: 8px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  font: inherit; font-size: 16px; color: var(--text);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  -webkit-appearance: none; appearance: none;
}
.form-input:first-child, .form-select:first-child { margin-top: 0; }
.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%236b7084' stroke-width='2'%3E%3Cpath d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
  padding-right: 36px;
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-input::placeholder, .form-textarea::placeholder { color: #9aa0b4; }
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(91,91,214,.12); }
.field-row { display: grid; grid-template-columns: 1fr 2fr; gap: 8px; }
.field-row .form-input { margin-top: 8px; }

.form-error { display: none; color: var(--danger); font-size: 12.5px; margin-top: 6px; }
.form-error.active { display: block; }
.input-error { border-color: var(--danger) !important; box-shadow: 0 0 0 4px rgba(229,72,77,.1) !important; }

/* Mapa e taxa */
.map-container { height: 220px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.leaflet-container { font-family: inherit; }
.map-instruction {
  margin: 10px 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(91,91,214,.08);
  color: var(--brand-dark);
  font-size: 13.5px; font-weight: 600; line-height: 1.35;
}
.delivery-distance {
  margin-bottom: 6px;
  padding: 12px;
  border-radius: 10px;
  background: #ecfdf3; border: 1px solid #bbf0cf;
  text-align: center;
}
.delivery-distance .delivery-fee { font-size: 15px; font-weight: 800; color: #11733a; }
.delivery-distance .distance-info { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.delivery-distance.calculating { background: #fff8e6; border-color: #fde3a7; color: #8a5a00; }
.delivery-distance .loading-text { font-size: 13.5px; font-weight: 600; }
.delivery-distance.delivery-unavailable { background: #fdecec; border-color: #f7c5c6; }
.delivery-distance.delivery-unavailable .delivery-fee { color: #b42328; }

/* Rodapé fixo com o total e o botão */
.cart-footer {
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 12px 16px calc(12px + var(--safe-b));
  box-shadow: 0 -10px 24px rgba(20,21,31,.06);
}
.cart-footer-total { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; font-size: 14px; color: var(--muted); }
.cart-footer-total strong { font-size: 21px; font-weight: 800; color: var(--text); letter-spacing: -.02em; }
.whatsapp-button {
  width: 100%; height: 52px;
  border: none; border-radius: 14px;
  background: linear-gradient(135deg, var(--wa), var(--wa-dark));
  color: #fff;
  font-size: 16px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 8px 20px rgba(37,211,102,.3);
  transition: transform .15s, filter .2s, background .2s;
}
.whatsapp-button:active { transform: scale(.98); }
.whatsapp-button.is-disabled { background: #c5c9d6; box-shadow: none; }
.checkout-hint { margin-top: 8px; font-size: 12.5px; color: var(--muted); text-align: center; }

.cart-panel.is-empty .cart-checkout,
.cart-panel.is-empty .cart-total,
.cart-panel.is-empty .cart-footer { display: none !important; }

/* ===== MODAL DE PRODUTO ===== */
.modal {
  position: fixed; inset: 0;
  z-index: 5000;
  display: none;
  align-items: flex-end; justify-content: center;
  background: rgba(10,11,20,.6);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.modal.active { display: flex; }

.desc-modal-wrapper {
  position: relative;
  width: 100%; max-width: 560px;
  max-height: 92dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  box-shadow: var(--shadow-lg);
  animation: sheetUp .38s cubic-bezier(.32,.72,0,1);
  padding-bottom: var(--safe-b);
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
@keyframes popIn { from { transform: scale(.95); opacity: 0; } to { transform: none; opacity: 1; } }

.sheet-handle {
  position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
  width: 40px; height: 5px; border-radius: 99px;
  background: rgba(20,21,31,.18); z-index: 3;
}

.desc-modal-close {
  position: sticky; top: 12px;
  z-index: 6;
  margin: 12px 12px -50px auto;
  width: 38px; height: 38px;
  border: none; border-radius: 50%;
  background: rgba(20,21,31,.65); color: #fff;
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
}

.desc-modal-img-wrap {
  position: relative;
  aspect-ratio: 1 / 1;
  max-height: 58dvh;
  width: 100%;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.desc-modal-img { width: 100%; height: 100%; object-fit: contain; display: block; }
.desc-modal-img-wrap .badge-off { top: 14px; left: 14px; font-size: 13px; padding: 5px 10px; }

.desc-img-tools { position: absolute; right: 12px; bottom: 12px; display: flex; gap: 8px; }
.icon-btn {
  width: 40px; height: 40px;
  border: none; border-radius: 12px;
  background: rgba(20,21,31,.65); color: #fff;
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  transition: background .2s;
}
@media (hover: hover) { .icon-btn:hover, .desc-modal-close:hover { background: rgba(20,21,31,.85); } }

.desc-modal-body { padding: 18px 18px 24px; display: flex; flex-direction: column; gap: 12px; }
.desc-modal-cat {
  align-self: flex-start;
  font-size: 12px; font-weight: 700;
  color: var(--brand-dark);
  background: rgba(91,91,214,.08);
  border-radius: 999px; padding: 4px 10px;
}
.desc-modal-title { font-size: 19px; font-weight: 800; line-height: 1.3; letter-spacing: -.01em; }
.desc-modal-price { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; }
.desc-preco-old { font-size: 14px; color: var(--muted); text-decoration: line-through; }
.desc-preco-atual { font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.desc-off { font-size: 12px; font-weight: 800; color: var(--danger); background: #fdecec; border-radius: 999px; padding: 3px 8px; }
.desc-preco-consulte { font-size: 17px; font-weight: 700; color: var(--wa-dark); }

.desc-modal-actions { display: flex; flex-direction: column; gap: 8px; }
.btn-primary, .btn-wa {
  width: 100%; min-height: 50px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 15px; font-weight: 700;
  text-decoration: none;
  transition: transform .15s, filter .2s;
}
.btn-primary { border: none; background: var(--grad); color: #fff; box-shadow: 0 8px 20px rgba(102,126,234,.3); }
.btn-primary.wa { background: linear-gradient(135deg, var(--wa), var(--wa-dark)); box-shadow: 0 8px 20px rgba(37,211,102,.3); }
.btn-wa { border: 1.5px solid #bfe9cf; background: #f0fbf4; color: #0f7a44; }
.btn-primary:active, .btn-wa:active { transform: scale(.98); }

.desc-modal-desc {
  font-size: 14.5px; line-height: 1.65; color: #343747;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  word-break: break-word;
}
.desc-link { color: var(--brand-dark); text-decoration: underline; word-break: break-all; }

/* Foto em tela cheia */
.img-fullscreen-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,.95);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .25s;
}
.img-fullscreen-overlay.active { opacity: 1; }
.img-fullscreen-img { max-width: 100%; max-height: 100dvh; object-fit: contain; transform: scale(.96); transition: transform .25s; }
.img-fullscreen-overlay.active .img-fullscreen-img { transform: none; }
.img-fullscreen-close {
  position: absolute; top: calc(14px + var(--safe-t)); right: 14px;
  width: 42px; height: 42px; border: none; border-radius: 50%;
  background: rgba(255,255,255,.15); color: #fff;
  display: flex; align-items: center; justify-content: center;
}

/* ===== TOAST ===== */
.toast-host {
  position: fixed;
  top: calc(12px + var(--safe-t)); left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none;
  width: max-content; max-width: calc(100vw - 24px);
}
.toast {
  background: var(--text); color: #fff;
  padding: 11px 16px; border-radius: 999px;
  font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(-10px);
  transition: opacity .25s, transform .25s;
  text-align: center;
}
.toast.show { opacity: 1; transform: none; }
.toast-success::before { content: '✓  '; color: #4ade80; font-weight: 800; }
.toast-danger { background: #b42328; }

/* ===== DESKTOP ===== */
@media (min-width: 760px) {
  .modal.active { align-items: center; padding: 24px; }
  .desc-modal-wrapper {
    max-width: 960px;
    height: min(640px, 88vh);
    max-height: none;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    overflow: hidden;
    border-radius: 24px;
    padding-bottom: 0;
    animation: popIn .22s ease-out;
  }
  .sheet-handle { display: none; }
  .desc-modal-close { position: absolute; top: 14px; right: 14px; margin: 0; background: var(--surface-2); color: var(--text); border: 1px solid var(--line); backdrop-filter: none; }
  .desc-modal-img-wrap { aspect-ratio: auto; max-height: none; height: 100%; border-bottom: none; border-right: 1px solid var(--line); }
  .desc-modal-body { overflow-y: auto; padding: 32px 28px 28px; }
  .desc-modal-title { font-size: 22px; padding-right: 40px; }
}

/* ===== CELULAR ===== */
@media (max-width: 640px) {
  :root { --gutter: 12px; }

  .header {
    grid-template-columns: 1fr auto;
    grid-template-areas: "brand cart" "search search";
    gap: 10px;
    padding: 10px var(--gutter);
  }
  .brand .logo { height: 34px; }
  .brand h1 { font-size: 16px; }
  .search-input { height: 44px; font-size: 16px; } /* 16px evita zoom no iPhone */
  .cart-button { width: 42px; height: 42px; border-radius: 12px; }
  .cat-nav-track { padding-bottom: 10px; }
  .cat-nav-pill { height: 34px; font-size: 13px; padding: 0 12px; }

  .products-container { padding-top: 12px; }
  .products-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .category-header { margin-top: 18px; }
  .category-header-label { font-size: 16px; }

  .product-card { border-radius: 14px; }
  .product-body { padding: 10px 10px 12px; gap: 8px; }
  .product-title { font-size: 13px; }
  .product-price-old { font-size: 11.5px; }
  .product-price-now { font-size: 17px; }
  .badge-off, .badge-incart { top: 8px; font-size: 11px; padding: 3px 7px; }
  .badge-off { left: 8px; }
  .badge-incart { right: 8px; }
  .btn-add, .btn-consulte, .qty-stepper { height: 40px; font-size: 13px; border-radius: 10px; }
  .btn-add svg { display: none; }
  .qty-btn { width: 40px; }

  .cart-panel { width: 100vw; }
  .option-card { font-size: 12.5px; }
}

@media (max-width: 360px) {
  .brand h1 { display: none; }
  .products-grid { gap: 8px; }
  .fc-cta { padding: 0 12px; font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
