/* Salazar Decor — identidade visual: creme, vinho e dourado */
:root {
  --bg: #faf6f1;
  --surface: #ffffff;
  --ink: #2c2420;
  --muted: #7a6f66;
  --wine: #7c1f2e;
  --wine-dark: #5f1622;
  --gold: #c9a227;
  --gold-soft: #f3e3b8;
  --line: #e8ded2;
  --radius: 12px;
  --shadow: 0 6px 24px rgba(60, 40, 30, .08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
}
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; line-height: 1.2; }
a { color: var(--wine); }
img { max-width: 100%; display: block; }
.container { max-width: 1140px; margin: 0 auto; padding: 0 20px; }

/* Header */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
}
.header-inner { display: flex; align-items: center; gap: 18px; padding: 12px 20px; flex-wrap: wrap; }
.logo { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink);
  font-family: Georgia, serif; font-size: 1.35rem; font-weight: 700; }
.logo em { color: var(--wine); font-style: italic; }
.main-nav { display: flex; gap: 14px; flex-wrap: wrap; }
.main-nav a { text-decoration: none; color: var(--ink); font-size: .95rem; padding: 6px 4px; border-bottom: 2px solid transparent; }
.main-nav a:hover, .main-nav a.active { color: var(--wine); border-color: var(--gold); }
.header-search { display: flex; margin-left: auto; }
.header-search input { border: 1px solid var(--line); border-radius: 8px 0 0 8px; padding: 8px 12px; min-width: 180px; background: var(--bg); }
.header-search button { border: 1px solid var(--line); border-left: 0; border-radius: 0 8px 8px 0; background: var(--surface); padding: 8px 10px; cursor: pointer; }
.cart-link { position: relative; text-decoration: none; font-size: 1.25rem; }
.cart-count {
  position: absolute; top: -6px; right: -10px; background: var(--wine); color: #fff;
  font-size: .72rem; border-radius: 999px; padding: 1px 7px; font-family: sans-serif;
}
.nav-toggle { display: none; border: 0; background: none; font-size: 1.3rem; cursor: pointer; }

/* Flash */
.flash { padding: 12px 20px; text-align: center; font-size: .95rem; }
.flash-ok { background: #e8f4e8; color: #245c2f; }
.flash-error { background: #fbe6e6; color: #8c1d1d; }

/* Hero */
.hero {
  display: flex; align-items: center; gap: 30px;
  background: linear-gradient(120deg, #fff 60%, var(--gold-soft));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 34px; margin: 26px 0; box-shadow: var(--shadow);
}
/* TK-2026-0014 (item 3): hero equilibrado — texto ocupa a largura restante e
a foto ganha presença; sem a FAQ, home flui hero → categorias → destaques */
.hero-text { flex: 1 1 auto; min-width: 0; }
.hero h1 { margin: 0 0 10px; font-size: 2.1rem; }
.hero h1 em { color: var(--wine); }
.hero p { color: var(--muted); max-width: 520px; }
.hero-art { font-size: 3rem; letter-spacing: 12px; }
.hero-actions { display: flex; gap: 12px; margin-top: 16px; flex-wrap: wrap; }

/* Buttons */
.btn {
  display: inline-block; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  padding: 9px 16px; border-radius: 8px; text-decoration: none; cursor: pointer; font-size: .95rem;
}
.btn:hover { border-color: var(--gold); }
.btn-primary { background: var(--wine); border-color: var(--wine); color: #fff; }
.btn-primary:hover { background: var(--wine-dark); }
.btn-ghost { background: transparent; border-color: var(--wine); color: var(--wine); }
.btn-lg { padding: 12px 22px; font-size: 1.02rem; }

/* Sections & grids */
.section { margin: 34px 0; }
.section h2 { margin-bottom: 16px; }
.category-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.category-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; text-decoration: none; color: var(--ink); box-shadow: var(--shadow);
  transition: transform .15s ease;
}
.category-card:hover { transform: translateY(-3px); }
.category-card img { width: 100%; height: 200px; object-fit: cover; }
.category-card-body { padding: 14px 16px; }
.category-card-body h3 { margin: 0 0 6px; }
.category-card-body p { margin: 0; color: var(--muted); font-size: .9rem; }

.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 18px; }
.product-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); transition: transform .15s ease;
}
.product-card:hover { transform: translateY(-3px); }
.product-card-link { text-decoration: none; color: var(--ink); display: block; }
.product-card-img { position: relative; background: #f1e9df; }
.product-card-img img { width: 100%; height: 210px; object-fit: cover; }
.badge-off {
  position: absolute; top: 10px; left: 10px; background: var(--gold); color: #3d2f05;
  font-size: .78rem; font-weight: 700; padding: 3px 8px; border-radius: 6px;
}
.product-card-body { padding: 12px 14px 16px; }
.product-card-cat { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.product-card-body h3 { margin: 4px 0 6px; font-size: 1.02rem; }
.product-card-price { margin: 0; color: var(--wine); font-weight: 700; }
.no-image {
  height: 210px; display: flex; flex-direction: column; gap: 6px; align-items: center; justify-content: center;
  color: var(--muted); font-size: .85rem; background: repeating-linear-gradient(45deg, #f1e9df, #f1e9df 12px, #ece2d5 12px, #ece2d5 24px);
}
.no-image::before { content: "🖼️"; font-size: 1.6rem; opacity: .55; }
.no-image.big { height: 100%; min-height: 320px; }

/* Listing page */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 24px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; }
.filters input, .filters select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.results-count { color: var(--muted); font-size: .9rem; }
.pagination { display: flex; gap: 8px; margin: 26px 0; justify-content: center; }
.page-link { padding: 8px 13px; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; color: var(--ink); background: var(--surface); }
.page-link.active { background: var(--wine); color: #fff; border-color: var(--wine); }
.empty-state { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); padding: 34px; text-align: center; margin: 24px 0; }

/* Category page */
.category-head { display: flex; gap: 22px; align-items: center; margin: 24px 0; }
.category-cover { width: 220px; height: 160px; object-fit: cover; border-radius: var(--radius); box-shadow: var(--shadow); }

/* Product page */
.product-page { display: grid; grid-template-columns: 1fr 1fr; gap: 34px; margin: 26px 0; }
.gallery-main img { width: 100%; max-height: 520px; object-fit: contain; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.gallery-thumbs { display: flex; gap: 10px; margin-top: 10px; }
.gallery-thumb { border: 1px solid var(--line); border-radius: 8px; padding: 2px; background: var(--surface); cursor: pointer; }
.gallery-thumb img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; }
.gallery-thumb.active, .gallery-thumb[aria-pressed="true"] { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold-soft); }
.breadcrumb { font-size: .85rem; color: var(--muted); margin-bottom: 8px; }
.product-sku { color: var(--muted); font-size: .85rem; }
.product-price-row { display: flex; align-items: baseline; gap: 12px; margin: 12px 0; }
.product-price { font-size: 1.7rem; font-weight: 800; color: var(--wine); font-family: Georgia, serif; }
.product-compare { color: var(--muted); text-decoration: line-through; }
.product-stock { font-size: .9rem; color: #2c7a3f; }
.product-stock.out { color: #a33; }
.product-description { color: var(--ink); }
.product-details { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; margin: 16px 0; }
.product-details h2 { font-size: 1.05rem; margin: 0 0 8px; }
.product-details ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: .92rem; }
.add-to-cart-row { display: flex; align-items: center; gap: 12px; margin: 18px 0 6px; }
.add-to-cart-row select { padding: 10px; border: 1px solid var(--line); border-radius: 8px; }
.buy-note { color: var(--muted); font-size: .85rem; }

/* TK-2026-0017: PIX copia e cola na página do pedido */
.pix-pay-box { margin-top: .75rem; padding: .75rem; border: 1px dashed var(--border, #999); border-radius: 10px; }
.pix-pay-box img.pix-qr { display: block; width: 220px; height: 220px; margin: .5rem auto; background: #fff; }
.pix-pay-box textarea.pix-code { width: 100%; font-family: monospace; font-size: .75rem; white-space: pre; }

/* Cart */
.cart-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.cart-table th { text-align: left; font-size: .82rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 12px; border-bottom: 1px solid var(--line); }
.cart-table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.cart-thumb img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; }
.qty-input { width: 70px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; }
.btn-remove { border: 0; background: none; color: #a33; cursor: pointer; font-size: 1rem; }
.cart-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 18px 0 30px; flex-wrap: wrap; }
.cart-subtotal { font-size: 1.1rem; }

/* Checkout */
.checkout-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 26px; margin: 22px 0 34px; }
.checkout-form, .checkout-summary, .order-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px;
}
.checkout-form label { display: block; margin-bottom: 12px; font-size: .9rem; color: var(--muted); }
.checkout-form input, .checkout-form select, .checkout-form textarea,
.lookup-form input, .order-card textarea {
  width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 8px; margin-top: 4px; font: inherit;
}
.form-row { display: flex; gap: 12px; }
.form-row label { flex: 1; }
.summary-list { list-style: none; margin: 0 0 12px; padding: 0; }
.summary-list li { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.summary-total { font-size: 1.1rem; text-align: right; }

/* Orders */
.order-success-banner { background: #e8f4e8; border: 1px solid #bcd9c0; border-radius: var(--radius); padding: 18px 22px; margin: 22px 0; }
.order-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 22px; margin-bottom: 34px; }
.lookup-form { display: flex; gap: 14px; align-items: end; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 22px; }
.lookup-form label { flex: 1; min-width: 220px; font-size: .85rem; color: var(--muted); }
.status-badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; }
.status-novo { background: #f3e3b8; color: #6b5310; }
.status-confirmado { background: #dbe9ff; color: #1c4c8a; }
.status-em_producao { background: #e6dcff; color: #4b2d8c; }
.status-enviado { background: #d3f1f0; color: #146c69; }
.status-entregue { background: #dcf3dd; color: #226b2c; }
.status-cancelado { background: #f6dada; color: #8c1d1d; }
.status-aberto { background: #d3f1f0; color: #146c69; }
.status-aguardando_equipe { background: #e6dcff; color: #4b2d8c; }
.status-resolvido { background: #dcf3dd; color: #226b2c; }
.status-fechado { background: #e8e8e8; color: #555; }

/* Footer */
.site-footer { background: #2c2420; color: #cfc4b8; margin-top: 50px; }
.footer-inner { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 22px; padding: 30px 20px; }
.site-footer a { color: var(--gold-soft); }
.site-footer strong { color: #fff; }
.footer-bottom { border-top: 1px solid #453a31; padding: 14px 20px; font-size: .82rem; text-align: center; }

/* Chat widget — TK-2026-0014 (item 5): bolha pequena e discreta "Precisa de
ajuda?"; em telas estreitas vira só o ícone circular para não atrapalhar */
#chat-widget { position: fixed; bottom: 16px; right: 16px; z-index: 100; font-family: inherit; }
#chat-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--wine); color: #fff; border: 0; border-radius: 999px;
  padding: 8px 14px; font-size: .8rem; cursor: pointer;
  box-shadow: 0 6px 18px rgba(124, 31, 46, .28); opacity: .92;
}
#chat-toggle:hover { background: var(--wine-dark); opacity: 1; }
#chat-toggle .chat-bubble-icon { font-size: 1.05rem; line-height: 1; }
@media (max-width: 640px) {
  #chat-toggle .chat-bubble-label { display: none; }
  #chat-toggle { padding: 0; width: 42px; height: 42px; justify-content: center; }
}
#chat-panel {
  width: min(380px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: 0 18px 48px rgba(40, 25, 20, .25); overflow: hidden; margin-bottom: 10px;
  display: flex; flex-direction: column;
}
.chat-head { display: flex; justify-content: space-between; align-items: center; background: var(--wine); color: #fff; padding: 10px 14px; }
.chat-head strong { font-size: .95rem; }
.chat-status { display: block; font-size: .74rem; opacity: .85; }
.chat-head-actions button { background: none; border: 0; color: #fff; cursor: pointer; font-size: .85rem; margin-left: 8px; }
#chat-messages { max-height: 320px; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.chat-msg { max-width: 85%; padding: 9px 12px; border-radius: 12px; font-size: .9rem; }
.chat-msg .chat-line { margin: 0; }
.chat-msg .chat-line + .chat-line { margin-top: 6px; }
.chat-msg .chat-line-head { font-weight: 700; }
.chat-msg ul { margin: 4px 0 0; padding-left: 20px; }
.chat-msg li { margin: 2px 0; }
.chat-msg a { color: var(--wine-dark, #6d1f2b); text-decoration: underline; }
.chat-msg code { background: rgba(0, 0, 0, .07); border-radius: 4px; padding: 1px 4px; font-size: .85em; }
.chat-hr { border-top: 1px solid rgba(0, 0, 0, .15); margin: 6px 0; }
.chat-msg.user { align-self: flex-end; background: var(--wine); color: #fff; border-bottom-right-radius: 4px; }
.chat-msg.assistant { align-self: flex-start; background: #f1e9df; border-bottom-left-radius: 4px; }
.chat-msg.error { background: #fbe6e6; color: #8c1d1d; }
.chat-msg.typing { color: var(--muted); font-style: italic; }
.chat-suggestions { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.chat-suggestion { border: 1px solid var(--gold); background: #fff8e8; color: #5c4a10; border-radius: 14px; padding: 5px 10px; font-size: .78rem; cursor: pointer; }
.chat-suggestion:hover { background: var(--gold); }
.chat-feedback { display: flex; gap: 6px; margin: 2px 0 6px; }
.chat-feedback button { border: 1px solid #d8cfc4; background: #fff; border-radius: 10px; padding: 3px 9px; font-size: .74rem; cursor: pointer; color: var(--muted); }
.chat-feedback button.chosen { background: var(--gold); border-color: var(--gold); color: #2b2010; }
.chat-feedback button:disabled { opacity: .6; cursor: default; }
.chat-products { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.chat-product-link { background: var(--wine); color: #fff; border-radius: 10px; padding: 4px 10px; font-size: .78rem; text-decoration: none; }
.chat-product-link:hover { opacity: .9; }
#chat-form { display: flex; border-top: 1px solid var(--line); }
#chat-input { flex: 1; border: 0; padding: 12px; font: inherit; }
#chat-form button { border: 0; background: var(--gold); color: #3d2f05; font-weight: 700; padding: 0 18px; cursor: pointer; }

/* Responsive */
@media (max-width: 860px) {
  .product-page, .checkout-grid, .order-grid { grid-template-columns: 1fr; }
  .hero { flex-direction: column; align-items: flex-start; }
  .main-nav { display: none; width: 100%; flex-direction: column; }
  .main-nav.open { display: flex; }
  .nav-toggle { display: block; }
  .header-search { margin-left: 0; }
  .category-head { flex-direction: column; align-items: flex-start; }
}

/* Acessibilidade */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .category-card, .product-card { transition: none; }
  .category-card:hover, .product-card:hover { transform: none; }
}
.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--wine); color: #fff; padding: 10px 16px; border-radius: 0 0 8px 0; z-index: 100;
}
.skip-link:focus { left: 0; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--gold); outline-offset: 2px;
}

/* Erros */
.error-page { text-align: center; padding: 48px 16px; }
.error-page h1 { margin-bottom: 8px; }

/* Carrinho / pedido */
.cart-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.order-toolbar { display: flex; gap: 10px; margin: 12px 0; flex-wrap: wrap; }

/* Impressão */
@media print {
  .site-header, .site-footer, #chat-widget, .no-print, .nav-toggle, .skip-link { display: none !important; }
  body { background: #fff; color: #000; }
  .order-card { border: 1px solid #ccc; box-shadow: none; }
  .main-content { max-width: 100%; }
}

/* Timeline de pedidos */
.timeline { list-style: none; padding: 0; margin: 8px 0; }
.timeline li { display: flex; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid #eee; flex-wrap: wrap; }
.timeline-note { color: var(--muted); font-size: .9rem; }

/* Hero com fotografia (TK-2026-0007) */
.hero-photo { width: min(400px, 45vw); aspect-ratio: 1 / 1; object-fit: cover; border-radius: var(--radius); box-shadow: var(--shadow); }
@media (max-width: 860px) { .hero-photo { width: min(280px, 80vw); } }

/* FAQ da home (TK-2026-0007) */
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 10px; }
.faq summary { font-weight: 700; cursor: pointer; color: var(--wine); }
.faq p { margin: 8px 0 0; color: var(--muted); font-size: .92rem; }

/* Checkout: indicador de etapas (TK-2026-0007) */
.checkout-steps { display: flex; gap: 10px; list-style: none; margin: 14px 0; padding: 0; flex-wrap: wrap; }
.checkout-steps li { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 7px 14px; font-size: .85rem; color: var(--muted); }
.checkout-steps li.done { border-color: #bcd9c0; color: #245c2f; }
.checkout-steps li.current { border-color: var(--wine); background: var(--wine); color: #fff; font-weight: 700; }

/* Produto: quantidade livre e aviso de adição (TK-2026-0007) */
.add-to-cart-row input[type="number"] { padding: 10px; border: 1px solid var(--line); border-radius: 8px; width: 110px; }
.qty-max { color: var(--muted); font-weight: 400; font-size: .82rem; }
#add-result { margin: 10px 0 0; padding: 10px 14px; background: #e8f4e8; color: #245c2f; border: 1px solid #bcd9c0; border-radius: 8px; font-size: .92rem; }

/* Frete no checkout via Melhor Envio (TK-2026-0009) */
.frete-box { border: 1px dashed var(--line); border-radius: 10px; padding: 12px; margin: 10px 0; }
.frete-option { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 8px 0; cursor: pointer; font-weight: 400; }
.frete-option input { margin-top: 3px; width: auto; }
.frete-option.frete-cheapest { border-color: #bcd9c0; background: #f2faf2; }
.frete-free { color: #245c2f; }
