:root {
  --shopee: #ee4d2d;
  --shopee-hover: #d73f21;
  --shopee-soft: rgba(238, 77, 45, 0.14);
  --amber: #ffb547;

  --bg: #fff7f4;
  --surface: #ffffff;
  --surface-2: #fdeee9;
  --border: #f3d9d1;
  --text: #2a1a15;
  --muted: #8a6c63;
  --shadow: 0 6px 20px rgba(120, 40, 20, 0.08);
}

[data-theme="dark"] {
  --bg: #15100e;
  --surface: #211915;
  --surface-2: #2c211c;
  --border: #3a2b24;
  --text: #f7ece8;
  --muted: #b39a91;
  --shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

/* ---------- Marca ---------- */

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}
.brand-mark {
  display: block;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  object-fit: cover;
  flex-shrink: 0;
}
.brand-lg { font-size: 1.6rem; justify-content: center; gap: 12px; }
.brand-lg .brand-mark { width: 56px; height: 56px; border-radius: 14px; }

/* ---------- Botões ---------- */

.btn {
  border: 0;
  border-radius: 10px;
  padding: 10px 16px;
  font-weight: 600;
  transition: background 0.15s, transform 0.05s;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.6; cursor: wait; }
.btn-primary { background: var(--shopee); color: #fff; }
.btn-primary:hover { background: var(--shopee-hover); }
.btn-outline { background: transparent; color: var(--shopee); border: 1.5px solid var(--shopee); }
.btn-outline:hover { background: var(--shopee-soft); }
.btn-block { width: 100%; }
a.btn { display: block; text-align: center; text-decoration: none; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
}

/* ---------- Login ---------- */

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
  background:
    radial-gradient(circle at 20% 10%, rgba(238, 77, 45, 0.25), transparent 45%),
    radial-gradient(circle at 85% 90%, rgba(255, 181, 71, 0.22), transparent 45%),
    var(--bg);
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 32px 24px;
  box-shadow: var(--shadow);
}
.login-sub { text-align: center; color: var(--muted); margin: 8px 0 24px; }

/* ---------- Formulários ---------- */

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
  font-size: 0.9rem;
  font-weight: 600;
}
input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  font-weight: 400;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--shopee);
  outline-offset: -1px;
  border-color: transparent;
}
textarea { resize: vertical; }
.form-error { color: var(--shopee); min-height: 1.2em; margin: 0 0 10px; font-size: 0.9rem; }

/* ---------- Topo ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topnav { display: flex; gap: 4px; }
.navlink {
  border: 0;
  background: none;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 600;
}
.navlink.active, .navlink:hover { color: var(--shopee); background: var(--shopee-soft); }

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.search { width: 220px; border-radius: 999px; }

/* ---------- Filtros ---------- */

.chips {
  display: flex;
  gap: 8px;
  padding: 16px 24px 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.chip {
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 7px 14px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.88rem;
}
.chip.active { background: var(--shopee); border-color: var(--shopee); color: #fff; }

/* ---------- Grade de cards ---------- */

main { padding: 16px 24px 40px; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}
.card-media {
  position: relative;
  aspect-ratio: 9 / 16;
  background: var(--surface-2);
}
.card-media img,
.card-media video { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-size: 4rem;
}
.ph-Moda    { background: linear-gradient(150deg, #ff8a65, #ee4d2d); }
.ph-Casa    { background: linear-gradient(150deg, #ffd8a8, #e8925a); }
.ph-Beleza  { background: linear-gradient(150deg, #ffc1d0, #e8607a); }
.ph-Avatar  { background: linear-gradient(150deg, #ffc1b4, #f06a5d); }
.ph-Móveis { background: linear-gradient(150deg, #5c4a44, #2a1f1b); }
.ph-Acessórios { background: linear-gradient(150deg, #ffe0a3, #e0a03a); }
.ph-Calçados { background: linear-gradient(150deg, #ffd27a, #f29a2e); }
.ph-Outros  { background: linear-gradient(150deg, #ffb547, #ee4d2d); }

.badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
}
.badge-niche {
  top: auto;
  bottom: 10px;
  background: var(--amber);
  color: #3a2200;
}
.fav-btn {
  position: absolute;
  top: 6px;
  right: 8px;
  padding: 0;
  border: 0;
  background: none;
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}
.fav-btn.on { color: var(--shopee); }

.card-body { padding: 12px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-title { margin: 0 0 2px; font-size: 0.98rem; font-weight: 700; flex: 1; }

.empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* ---------- Modais ---------- */

.modal {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px;
  background: var(--surface);
  color: var(--text);
}
.modal::backdrop { background: rgba(20, 8, 4, 0.6); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.modal-head h2 { margin: 0; font-size: 1.15rem; }

.prompt-block {
  background: var(--surface-2);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
}
.prompt-block-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.prompt-label { font-weight: 700; color: var(--shopee); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; }
.prompt-text { margin: 0; line-height: 1.5; font-size: 0.92rem; white-space: pre-wrap; }
.btn-sm { padding: 6px 12px; font-size: 0.82rem; }

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  background: var(--text);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Navegação inferior (celular) ---------- */

.bottomnav { display: none; }

@media (max-width: 720px) {
  .topbar { padding: 10px 16px; gap: 12px; }
  .topnav, .logout-btn { display: none !important; }
  .search { width: 100%; max-width: 160px; }
  .chips { padding: 12px 16px 4px; }
  main { padding: 12px 16px 96px; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .card-placeholder { font-size: 3rem; }
  .card-title { font-size: 0.88rem; }
  .toast { bottom: 88px; }

  .bottomnav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    background: var(--surface);
    border-top: 1px solid var(--border);
  }
  .bottomnav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    border: 0;
    background: none;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 600;
    min-width: 60px;
  }
  .bottomnav-item span { font-size: 1.3rem; line-height: 1; }
  .bottomnav-item.active { color: var(--shopee); }
}
