@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700;800&family=Inter:wght@400;500;600&display=swap');

:root {
  --ivory: #fdf8f1;
  --paper: #ffffff;
  --ink: #2a1d14;
  --text: #2a1d14;
  --text-muted: #79706a;
  --text-faint: #a89f97;
  --border: #ece3d6;

  --red: #c8102e;
  --red-deep: #8e0e22;
  --red-light: #fdeaea;
  --gold: #d4af37;
  --gold-light: #f6e7b0;
  --gold-deep: #a8811e;

  --purple: var(--red);
  --purple-dark: var(--red-deep);

  --error: #c8102e;
  --success: #15803d;

  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;

  --shadow-card: 0 1px 2px rgba(42, 29, 20, 0.04), 0 16px 32px -12px rgba(42, 29, 20, 0.12);
  --shadow-glow-red: 0 14px 30px -10px rgba(200, 16, 46, 0.35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-size: 15px;
  background: var(--ivory);
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100vh;
}

h1, h2, h3 { font-family: var(--font-display); }

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--ivory); }
::-webkit-scrollbar-thumb { background: var(--gold); border-radius: 8px; }

/* ---------- Ícones 3D (substituem emoji em toda a app) ---------- */
.icon-3d {
  width: 23px;
  height: 23px;
  display: inline-block;
  object-fit: contain;
  vertical-align: -4px;
}

.icon-3d.icon-lg { width: 36px; height: 36px; vertical-align: -9px; }
.icon-3d.icon-xl { width: 44px; height: 44px; vertical-align: -12px; }

/* ---------- Header (injetado por header.js) ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(253, 248, 241, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.site-header-inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 20px;
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; text-decoration: none; }
.brand-logo { height: 57px; width: auto; display: block; }

.site-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
  flex-wrap: wrap;
}

.site-nav a {
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 8px;
  transition: color 0.15s, background 0.15s;
}

.site-nav a:hover, .site-nav a.active {
  color: var(--red);
  background: var(--red-light);
}

/* ---------- Carrinho: botão no menu principal ---------- */
.cart-trigger {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  margin-left: 6px;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  padding: 0;
}
.cart-trigger:hover { border-color: var(--gold); }
.cart-trigger img { width: 30px; height: 30px; }

.cart-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  line-height: 24px;
  text-align: center;
}

/* ---------- Carrinho: gaveta lateral ---------- */
.cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(42, 29, 20, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 90;
}
.cart-overlay.open { opacity: 1; pointer-events: auto; }

.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 480px;
  max-width: 100vw;
  background: var(--paper);
  border-left: 1px solid var(--border);
  box-shadow: -20px 0 40px -20px rgba(42, 29, 20, 0.3);
  transform: translateX(100%);
  transition: transform 0.28s ease;
  z-index: 100;
  display: flex;
  flex-direction: column;
}
.cart-drawer.open { transform: translateX(0); }

.cart-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--border);
}
.cart-drawer-header h2 { margin: 0; font-size: 18px; }
#cart-drawer-count { color: var(--text-muted); font-weight: 500; }

.cart-drawer-close {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--paper);
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.cart-drawer-close:hover { border-color: var(--gold); color: var(--ink); }

/* A lista rola; cabeçalho e rodapé ficam fixos. */
.cart-drawer-body { flex: 1; overflow-y: auto; padding: 8px 24px; }

.cart-drawer-empty {
  padding: 48px 0;
  text-align: center;
  color: var(--text-muted);
}

.cart-drawer-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.cart-drawer-item:last-child { border-bottom: none; }
.cart-drawer-item img,
.cart-drawer-thumb-empty {
  width: 82px;
  height: 57px;
  flex-shrink: 0;
  object-fit: cover;
  border-radius: 8px;
  background: var(--ivory);
}
.cart-drawer-item-info { flex: 1; min-width: 0; }
.cart-drawer-item-name {
  font-size: 14px;
  font-weight: 600;
  /* Os nomes vindos do fornecedor são longuíssimos — corta às 2 linhas. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cart-drawer-item-price { margin-top: 4px; font-weight: 700; color: var(--gold-deep); }

.cart-drawer-footer {
  padding: 18px 24px 24px;
  border-top: 1px solid var(--border);
}
.cart-drawer-footer .btn-primary,
.cart-drawer-footer a.btn-primary {
  width: 100%;
  text-align: center;
  text-decoration: none;
  display: block;
}
.cart-drawer-total {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  margin-bottom: 14px;
}

@media (max-width: 480px) {
  .cart-drawer { width: 100vw; }
}

.account-menu { position: relative; margin-left: 6px; }

/* Seletor de idioma — reutiliza o visual do menu de conta, mas mais estreito
   (mostra só a bandeira e o código, ex: 🇵🇹 PT). */
.lang-menu { position: relative; margin-left: 6px; }
.lang-menu .account-trigger { padding: 9px 11px; }
.lang-menu .account-dropdown { min-width: 160px; }
.lang-menu .account-dropdown a { justify-content: flex-start; }

.account-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  font-family: inherit;
  box-shadow: var(--shadow-card);
}

.account-trigger:hover { border-color: var(--gold); }
.chevron { font-size: 13px; color: var(--text-muted); }

.account-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 16px 32px -12px rgba(42, 29, 20, 0.2);
  min-width: 290px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 60;
}

.account-dropdown a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 15px;
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
  font-size: 15px;
}

.account-dropdown a:hover { background: var(--ivory); color: var(--red); }

.dropdown-balance {
  font-size: 15px;
  font-weight: 700;
  color: var(--gold-deep);
  background: var(--gold-light);
  padding: 2px 9px;
  border-radius: 999px;
}

.dropdown-divider { height: 1px; background: var(--border); margin: 6px 4px; }

/* ---------- Hero (usado em calculator/wallet/warehouse/tracking) ---------- */
.hero {
  text-align: center;
  padding: 56px 20px 32px;
  max-width: 720px;
  margin: 0 auto;
}

.hero-eyebrow {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--gold-light);
  color: var(--gold-deep);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 16px;
}

.hero h1 { margin: 0 0 14px; font-size: 36px; }
.hero p { color: var(--text-muted); font-size: 16px; margin: 0; }

/* ---------- Layout ---------- */
.container {
  max-width: 780px;
  margin: 0 auto;
  padding: 48px 20px 80px;
}

/* A página de encomenda tem muito mais para mostrar (variantes, fotos de
   inspeção, resumo de preços) — em 780px ficava tudo espremido. */
.container.wide { max-width: 1120px; padding-left: 24px; padding-right: 24px; }

h1 {
  font-size: 36px;
  font-weight: 700;
  margin-bottom: 32px;
  color: var(--ink);
}

.steps {
  display: flex;
  justify-content: space-between;
  max-width: 640px;
  margin: 0 auto 32px;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 15px;
}

.step-icon {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  border: 1px solid var(--border);
}

.step.active .step-icon {
  background: linear-gradient(135deg, var(--red), var(--gold));
  border-color: transparent;
  box-shadow: var(--shadow-glow-red);
}

.step.active { color: var(--ink); font-weight: 600; }

.card {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  box-shadow: var(--shadow-card);
}

h2 { font-size: 22px; margin-top: 0; margin-bottom: 28px; color: var(--ink); }

label {
  display: block;
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text-muted);
}

input, textarea, select {
  width: 100%;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  color: var(--text);
  font-size: 15px;
  margin-bottom: 4px;
  font-family: inherit;
}

input::placeholder, textarea::placeholder { color: var(--text-faint); }

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-light);
}

textarea { min-height: 80px; resize: vertical; margin-bottom: 20px; }

/* Campo preenchido a partir do fornecedor: mostra-se claramente como
   informação e não como algo a preencher. */
input.locked {
  background: var(--ivory);
  color: var(--text-muted);
  cursor: default;
}
input.locked:focus { border-color: var(--border); box-shadow: none; }
/* Esconde as setinhas do input numérico quando está bloqueado */
input.locked::-webkit-outer-spin-button,
input.locked::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.row.three { grid-template-columns: 1fr 1fr 1fr; }

.field { margin-bottom: 0; }

.hint {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.error {
  font-size: 14px;
  color: var(--error);
  margin-bottom: 12px;
}

.error.hidden, .hidden { display: none !important; }

.fetch-status {
  font-size: 14px;
  margin-bottom: 16px;
  min-height: 18px;
}

.fetch-status.loading { color: var(--gold-deep); }
.fetch-status.success { color: var(--success); }
.fetch-status.error { color: var(--error); }

.product-preview {
  display: flex;
  gap: 20px;
  align-items: center;
  background: var(--ivory);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 20px;
}

.product-preview img {
  width: 260px;
  height: 260px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--border);
  flex-shrink: 0;
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

.sku-selector {
  margin-bottom: 20px;
}

.sku-group {
  margin-bottom: 14px;
}

.sku-group-label {
  display: block;
  font-size: 16px;
  font-weight: 600;
  text-transform: capitalize;
  margin-bottom: 8px;
  color: var(--text-muted);
}

.qc-section {
  margin-bottom: 20px;
  padding: 14px;
  background: var(--ivory);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.qc-group + .qc-group {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.qc-photos {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 6px 0;
}

.qc-photos img {
  width: 200px;
  height: 200px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
  background: var(--border);
  cursor: zoom-in;
  transition: transform 0.15s;
}

.qc-photos img:hover {
  transform: scale(1.05);
}

/* ---------- Lightbox (ver foto em grande) ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(20, 12, 8, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 60px;
}

.lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
}

.lightbox-close,
.lightbox-nav {
  position: absolute;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  cursor: pointer;
  border-radius: 50%;
  line-height: 1;
  transition: background 0.15s;
}

.lightbox-close:hover,
.lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.3);
}

.lightbox-close {
  top: 20px;
  right: 24px;
  width: 40px;
  height: 40px;
  font-size: 18px;
}

.lightbox-nav {
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  font-size: 21px;
}

.lightbox-nav.prev { left: 16px; }
.lightbox-nav.next { right: 16px; }

.lightbox-counter {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-size: 14px;
  background: rgba(0, 0, 0, 0.4);
  padding: 4px 12px;
  border-radius: 999px;
}

.sku-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.sku-option {
  padding: 13px 24px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font-size: 16px;
  transition: border-color 0.15s, background 0.15s;
}

.sku-option:hover {
  border-color: var(--gold-deep);
}

/* Variantes com miniatura (tipicamente as cores) — a imagem ajuda a ver
   qual é a cor escolhida, em vez de só o nome. */
.sku-option.has-icon {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 20px 6px 6px;
}

.sku-option.has-icon img {
  width: 70px;
  height: 70px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--border);
}

.checkbox-field {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 20px 0 4px;
  font-size: 14px;
  line-height: 1.5;
  cursor: pointer;
}

/* A regra geral dos inputs poe width:100%, o que fazia a checkbox ocupar a
   linha toda e espremer o texto numa coluna de uma palavra. */
.checkbox-field input[type='checkbox'] {
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
  flex-shrink: 0;
}

.checkbox-field span { flex: 1; }

.sku-option.selected {
  border-color: var(--red);
  background: var(--red);
  color: #fff;
}

button, .btn-primary, .btn-secondary {
  display: inline-block;
  border: none;
  border-radius: 10px;
  padding: 15px 28px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  text-align: center;
}

.btn-primary {
  background: linear-gradient(135deg, var(--red), var(--gold));
  color: white;
  box-shadow: var(--shadow-glow-red);
}

.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; filter: none; }

.btn-secondary {
  background: var(--paper);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.btn-secondary:hover { color: var(--ink); border-color: var(--gold); }

.price-summary {
  background: var(--ivory);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
  font-size: 15px;
  line-height: 1.8;
}

.price-summary .total {
  font-size: 15px;
  font-weight: 700;
  color: var(--red-deep);
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: 6px;
}

.price-summary-item {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
}

/* ---------- Carrinho de compras ---------- */
.cart-section {
  margin: 20px 0;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.cart-section h3 {
  margin-bottom: 10px;
}

.cart-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cart-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--ivory);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}

.cart-item img {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--border);
  flex-shrink: 0;
}

.cart-item-info {
  flex: 1;
  min-width: 0;
}

.cart-item-name {
  font-weight: 600;
  font-size: 14px;
}

.cart-item-price {
  margin-top: 4px;
  font-weight: 700;
  color: var(--gold-deep);
}

.cart-item-remove {
  background: none;
  border: none;
  font-size: 16px;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
}

.cart-item-remove:hover {
  color: var(--red);
}

.cart-total {
  margin-top: 10px;
  font-weight: 600;
  text-align: right;
}

/* ---------- Carteira: cartão de saldo, banner e histórico ---------- */
.balance-card {
  background: linear-gradient(135deg, var(--red), var(--gold));
  border-radius: 16px;
  padding: 32px 28px;
  color: white;
  text-align: center;
  box-shadow: var(--shadow-glow-red);
}

.balance-card .balance-label {
  font-size: 12px;
  letter-spacing: 0.06em;
  opacity: 0.9;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.balance-card .balance-amount {
  font-family: var(--font-display);
  font-size: 29px;
  font-weight: 800;
  margin-bottom: 22px;
}

.balance-actions { display: flex; gap: 10px; }
.balance-actions button { flex: 1; }

.btn-white {
  background: white;
  color: var(--red-deep);
  box-shadow: none;
}
.btn-white:hover { filter: brightness(0.97); }

.btn-outline-white {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.6);
  color: white;
}
.btn-outline-white:hover { background: rgba(255, 255, 255, 0.12); }

.info-banner {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: var(--gold-light);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 13px;
  color: var(--ink);
  margin-bottom: 24px;
  line-height: 1.5;
}

.info-banner a { color: var(--red); font-weight: 600; }
.info-banner img { flex-shrink: 0; margin-top: 1px; }

.tx-table-wrap { overflow-x: auto; }

table.tx-table { width: 100%; border-collapse: collapse; font-size: 13px; }

table.tx-table th {
  text-align: left;
  padding: 10px 12px;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

table.tx-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  color: var(--ink);
  white-space: nowrap;
}

table.tx-table tr:last-child td { border-bottom: none; }

.tx-status {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.tx-status-completed, .tx-status-approved { background: #e0f6e9; color: #16a34a; }
.tx-status-pending { background: var(--gold-light); color: var(--gold-deep); }
.tx-status-rejected { background: var(--red-light); color: var(--red-deep); }

/* ---------- Definições da Conta ---------- */
.avatar-row { display: flex; align-items: center; gap: 20px; }

.avatar-preview {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--border);
  background: var(--ivory);
  flex-shrink: 0;
}

.success-text { font-size: 12px; color: var(--success); margin-bottom: 12px; }

/* ---------- Suporte / Consultas ---------- */
.faq-item {
  border-bottom: 1px solid var(--border);
}
.faq-item:last-child { border-bottom: none; }

.faq-question {
  width: 100%;
  background: none;
  border: none;
  text-align: left;
  padding: 16px 4px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.faq-question .chevron { transition: transform 0.15s; color: var(--text-muted); }
.faq-question.open .chevron { transform: rotate(180deg); }

.faq-answer {
  padding: 0 4px 16px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}

.ticket-card {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-card);
  transition: border-color 0.15s;
}
.ticket-card:hover { border-color: var(--gold); }

.ticket-status {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.ticket-status-open { background: var(--gold-light); color: var(--gold-deep); }
.ticket-status-answered { background: #e0f6e9; color: #16a34a; }
.ticket-status-closed { background: #f0eeee; color: var(--text-muted); }

.category-tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--ivory);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 6px;
}

.chat-thread { display: flex; flex-direction: column; gap: 14px; margin-bottom: 20px; }

.chat-bubble {
  max-width: 78%;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
}

.chat-bubble.from-customer {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--red), var(--gold));
  color: white;
  border-bottom-right-radius: 4px;
}

.chat-bubble.from-admin {
  align-self: flex-start;
  background: var(--ivory);
  border: 1px solid var(--border);
  color: var(--ink);
  border-bottom-left-radius: 4px;
}

.chat-bubble .chat-meta {
  display: block;
  font-size: 10px;
  opacity: 0.75;
  margin-top: 6px;
}

/* ---------- Programa de Afiliados ---------- */
.affiliate-card {
  background: linear-gradient(135deg, var(--red), var(--gold));
  border-radius: 16px;
  padding: 24px 28px;
  color: white;
  box-shadow: var(--shadow-glow-red);
}

.affiliate-card-top {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.affiliate-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
}

.affiliate-tier-badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.25);
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  margin-left: 8px;
}

.affiliate-code-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  opacity: 0.95;
}

.affiliate-code-row button {
  background: rgba(255, 255, 255, 0.25);
  color: white;
  border: none;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 11px;
  cursor: pointer;
}
.affiliate-code-row button:hover { background: rgba(255, 255, 255, 0.4); }

.growth-bar-track {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
  margin-top: 6px;
}

.growth-bar-fill {
  background: white;
  height: 100%;
  border-radius: 999px;
  transition: width 0.4s ease;
}

table.tier-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 12px; }

table.tier-table th {
  text-align: center;
  padding: 10px;
  background: var(--ivory);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  border: 1px solid var(--border);
}

table.tier-table td {
  text-align: center;
  padding: 10px;
  border: 1px solid var(--border);
  color: var(--ink);
}

table.tier-table th.current-tier, table.tier-table td.current-tier {
  background: var(--gold-light);
  font-weight: 700;
}

/* ---------- Janela modal (aviso de risco) ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(42, 29, 20, 0.45);
}

.modal-box {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 24px 48px -16px rgba(42, 29, 20, 0.35);
  max-width: 640px;
  width: 100%;
  /* Em ecrãs baixos o texto rola dentro da caixa, em vez de sair do ecrã. */
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
}

.modal-box h2 { margin: 0 0 18px; font-size: 18px; }
.modal-box p { margin: 0 0 16px; line-height: 1.65; color: var(--text-muted); font-size: 14px; }
.modal-box .actions { margin-top: 22px; justify-content: flex-end; }

.modal-box { position: relative; }

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--paper);
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
.modal-close:hover { border-color: var(--gold); color: var(--ink); }

/* Nota permanente por baixo do botão de adicionar ao carrinho */
.risk-note { margin: 10px 0 0; text-align: right; }
.risk-note a { color: var(--text-muted); text-decoration: underline; }
.risk-note a:hover { color: var(--red); }

/* Miniatura e coluna de ação nos cartões das encomendas */
.order-thumb {
  width: 84px;
  height: 84px;
  flex-shrink: 0;
  object-fit: cover;
  border-radius: 10px;
  background: var(--ivory);
  border: 1px solid var(--border);
}

.order-action { text-align: right; }
.order-amount { font-size: 14px; color: var(--text-muted); margin-bottom: 8px; }

/* Foto + nome do produto, clicáveis para abrir a página do fornecedor */
.order-link {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}
a.order-link:hover .name { color: var(--red); text-decoration: underline; }
a.order-link:hover .order-thumb { border-color: var(--gold); }

/* Foto + nome do carrinho, clicáveis para abrir o produto no nosso site */
.cart-drawer-link {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex: 1;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}
a.cart-drawer-link:hover .cart-drawer-item-name { color: var(--red); text-decoration: underline; }
a.cart-drawer-link:hover img { border-color: var(--gold); }

/* Preço final do artigo, igual ao que aparece no resumo do pagamento */
.final-price {
  margin-top: 8px;
  font-size: 16px;
  font-weight: 700;
  color: var(--gold-deep);
}

/* ---------- Confirmação de pagamento ---------- */
.success-box {
  margin-top: 28px;
  padding: 22px 24px;
  background: var(--ivory);
  border: 1px solid var(--border);
  border-radius: 14px;
  text-align: left;
}

.success-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  font-size: 14px;
  color: var(--text-muted);
}
.success-row span:last-child { color: var(--ink); font-weight: 600; }

.success-row.total {
  border-top: 1px solid var(--border);
  margin-top: 6px;
  padding-top: 14px;
  font-size: 16px;
}
.success-row.total span:last-child { color: var(--gold-deep); font-weight: 700; }

/* Nomes dos produtos vindos do fornecedor — longos, ficam mais discretos. */
.success-products {
  padding: 4px 0 10px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

/* ---------- Sorte Diária ---------- */
.wheel-stage {
  position: relative;
  display: flex;
  justify-content: center;
  padding: 12px 0 4px;
}

.wheel-wrap {
  position: relative;
  width: 420px;
  max-width: 100%;
  aspect-ratio: 1;
}

/* Halo por trás da roda: dá-lhe profundidade sem pesar no ecrã. */
.wheel-wrap::before {
  content: '';
  position: absolute;
  inset: -6%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(212, 175, 55, 0.28), rgba(212, 175, 55, 0) 68%);
  animation: wheel-halo 3.6s ease-in-out infinite;
  pointer-events: none;
}

@keyframes wheel-halo {
  0%, 100% { opacity: 0.55; transform: scale(0.98); }
  50% { opacity: 1; transform: scale(1.02); }
}

/* Aro, lâmpadas, ponteiro e centro são fixos; só o disco roda. */
.wheel-static,
.wheel-disc {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.wheel-disc {
  transform-origin: 50% 50%;
  filter: drop-shadow(0 14px 28px rgba(42, 29, 20, 0.32));
}

.wheel-static { pointer-events: none; z-index: 3; }

/* As lâmpadas do aro acendem alternadamente, como numa roda de feira. */
.wheel-bulb { animation: wheel-bulb 1.1s ease-in-out infinite; }
.wheel-bulb:nth-child(odd) { animation-delay: 0.55s; }

@keyframes wheel-bulb {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 1; }
}

.wheel-spinning .wheel-bulb { animation-duration: 0.35s; }

/* Botão central: é ele que gira a roda. */
.wheel-hub {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 22%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  z-index: 4;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font: inherit;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  background: radial-gradient(circle at 35% 30%, #e8455f, var(--red) 55%, #7d0c1e);
  box-shadow:
    0 0 0 5px var(--gold-deep),
    0 0 0 8px var(--gold-light),
    0 8px 18px rgba(42, 29, 20, 0.4);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.wheel-hub:hover:not(:disabled) { transform: translate(-50%, -50%) scale(1.06); }
.wheel-hub:active:not(:disabled) { transform: translate(-50%, -50%) scale(0.96); }

.wheel-hub:disabled {
  cursor: default;
  filter: grayscale(0.65);
  opacity: 0.75;
}

/* Enquanto dá para girar, o centro chama a atenção. */
.wheel-hub.ready { animation: hub-pulse 1.8s ease-in-out infinite; }

@keyframes hub-pulse {
  0%, 100% { box-shadow: 0 0 0 5px var(--gold-deep), 0 0 0 8px var(--gold-light), 0 8px 18px rgba(42, 29, 20, 0.4); }
  50% { box-shadow: 0 0 0 5px var(--gold-deep), 0 0 0 14px rgba(246, 231, 176, 0.45), 0 8px 22px rgba(42, 29, 20, 0.45); }
}

.spin-result {
  margin: 22px auto 0;
  max-width: 460px;
  padding: 16px 22px;
  border-radius: 14px;
  border: 1px solid var(--border);
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  animation: result-in 0.45s cubic-bezier(0.2, 1.2, 0.3, 1);
}

@keyframes result-in {
  from { opacity: 0; transform: translateY(10px) scale(0.96); }
  to { opacity: 1; transform: none; }
}

.spin-result.win {
  border-color: var(--gold);
  background: linear-gradient(135deg, var(--gold-light), #fff8e2);
  box-shadow: 0 8px 22px rgba(212, 175, 55, 0.28);
}

/* Confetes: pequenos papelinhos largados do topo quando há prémio. */
.confetti {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
  z-index: 5;
}

.confetti i {
  position: absolute;
  top: -12%;
  width: 9px;
  height: 14px;
  border-radius: 2px;
  animation: confetti-fall 1.6s ease-in forwards;
}

@keyframes confetti-fall {
  to { transform: translateY(340px) rotate(540deg); opacity: 0; }
}

.points-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.points-value {
  font-size: 30px;
  font-weight: 800;
  color: var(--gold-deep);
  line-height: 1.1;
}

@media (max-width: 560px) {
  .wheel-wrap { width: 300px; }
  .wheel-hub { font-size: 13px; }
}

.coupon-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
  margin-bottom: 4px;
}

/* O input global é width:100%; aqui tem de partilhar a linha com o botão. */
.coupon-row input { flex: 1; margin: 0; text-transform: uppercase; }
.coupon-row .btn-secondary { flex: 0 0 auto; white-space: nowrap; }


/* ---------- Menu de três tracinhos (telemóvel) ---------- */
.nav-toggle {
  display: none; /* só aparece em ecrãs estreitos */
  margin-left: auto;
  width: 44px;
  height: 44px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--paper);
  cursor: pointer;
  flex-direction: column;
  justify-content: space-between;
  gap: 0;
}

.nav-toggle span {
  display: block;
  height: 2px;
  width: 100%;
  border-radius: 2px;
  background: var(--ink);
  transition: transform 0.2s, opacity 0.2s;
}

/* Aberto, os tracinhos viram um X. */
/* 24px de altura util menos 6px de tracinhos = 18px de folga, 9px por vao.
   Cada tracinho exterior tem de percorrer 9px + a sua propria altura para
   assentar no centro. */
.nav-toggle.open span:nth-child(1) { transform: translateY(11px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-11px) rotate(-45deg); }

@media (max-width: 820px) {
  .nav-toggle { display: flex; }

  /* O menu passa a ser uma folha que desce por baixo do cabeçalho. */
  .site-nav {
    display: none;
    width: 100%;
    margin-left: 0;
    padding-top: 10px;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  .site-nav.open { display: flex; }

  .site-nav a {
    padding: 14px 12px;
    font-size: 16px;
    border-radius: 10px;
  }

  /* Carrinho, idioma e conta em linha, para não ocuparem três alturas. */
  .site-nav .cart-trigger,
  .site-nav .lang-menu,
  .site-nav .account-menu {
    align-self: flex-start;
  }

  .site-header-inner {
    gap: 12px;
    padding: 12px 16px;
  }

  .brand-logo { height: 46px; }
}
