/* ============================================================
   MPS — Genesis Design System
   Editorial precision · Indigo primary · DM Sans + General Sans
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');
@import url('https://api.fontshare.com/v2/css?f[]=general-sans@500,600,700&display=swap');

:root {
  /* ── Colours ───────────────────────────────────────────── */
  --primary:        #6366F1;
  --primary-hover:  #4F46E5;
  --primary-ring:   rgba(99,102,241,0.12);
  --primary-glow:   rgba(99,102,241,0.35);
  --secondary:      #20970B;
  --neutral:        #9C9C9C;
  --bg:             #FAFAFA;
  --surface:        #FFFFFF;
  --text-1:         #0A0A0A;
  --text-2:         #6B6B6B;
  --border:         #E8E8EC;
  --success:        #10B981;
  --warning:        #F59E0B;
  --error:          #EF4444;
  --success-bg:     #ECFDF5;
  --warning-bg:     #FFFBEB;
  --error-bg:       #FEF2F2;

  /* ── Typography ────────────────────────────────────────── */
  --font-display: 'General Sans', 'DM Sans', system-ui, sans-serif;
  --font-body:    'DM Sans', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', 'Courier New', monospace;

  /* ── Radius ────────────────────────────────────────────── */
  --r-xs:   4px;
  --r-sm:   6px;
  --r-md:   8px;
  --r-lg:  12px;
  --r-pill: 9999px;

  /* ── Spacing ────────────────────────────────────────────── */
  --sp-1:  4px;
  --sp-2:  8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;

  /* ── Shadows (only on interactive) ─────────────────────── */
  --shadow-hover: 0 8px 30px rgba(0,0,0,0.08);
  --shadow-lg:    0 16px 48px rgba(0,0,0,0.12);
  --blur-nav:     blur(12px);
}

/* ── Reset ──────────────────────────────────────────────── */
*, *::before, *::after {
  margin: 0; padding: 0; box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
html { font-size: 15px; }
body {
  background: var(--bg);
  color: var(--text-1);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

/* ── Typography ─────────────────────────────────────────── */
.t-display { font-family: var(--font-display); font-size: 2.8rem; font-weight: 700; letter-spacing: -0.04em; line-height: 1.1; color: var(--text-1); }
.t-headline { font-family: var(--font-display); font-size: 2rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1.2; color: var(--text-1); }
.t-section  { font-family: var(--font-display); font-size: 1.4rem; font-weight: 600; letter-spacing: -0.02em; color: var(--text-1); }
.t-subhead  { font-family: var(--font-display); font-size: 1.1rem; font-weight: 600; letter-spacing: -0.01em; color: var(--text-1); }
.t-body     { font-family: var(--font-body); font-size: 0.93rem; font-weight: 400; color: var(--text-1); }
.t-small    { font-family: var(--font-body); font-size: 0.8rem; font-weight: 400; color: var(--text-2); }
.t-caption  { font-family: var(--font-body); font-size: 0.75rem; font-weight: 400; color: var(--neutral); }
.t-overline { font-family: var(--font-body); font-size: 0.68rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.08em; color: var(--neutral); }
.t-mono     { font-family: var(--font-mono); font-size: 0.8rem; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--sp-2);
  font-family: var(--font-body); font-weight: 500; font-size: 0.87rem;
  border-radius: var(--r-sm); cursor: pointer; border: none;
  transition: all 0.2s ease; position: relative; top: 0;
  white-space: nowrap; text-decoration: none;
}
.btn:hover { top: -1px; }
.btn:active { top: 0; }

.btn-sm  { height: 32px; padding: 0 12px; font-size: 0.8rem; }
.btn-md  { height: 38px; padding: 0 16px; }
.btn-lg  { height: 44px; padding: 0 24px; font-size: 0.93rem; }

.btn-primary {
  background: var(--primary); color: #fff;
  box-shadow: none;
}
.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 12px var(--primary-glow);
  color: #fff;
}

.btn-secondary {
  background: transparent; color: var(--text-1);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg); border-color: #C8C8CE; }

.btn-ghost {
  background: transparent; color: var(--text-2); border: none;
}
.btn-ghost:hover { color: var(--text-1); background: var(--bg); }

.btn-danger {
  background: transparent; color: var(--error);
  border: 1px solid var(--error);
}
.btn-danger:hover { background: var(--error-bg); }

.btn-full { width: 100%; }

.btn:disabled { opacity: 0.45; cursor: default; top: 0 !important; box-shadow: none !important; }

/* ── Inputs ──────────────────────────────────────────────── */
.input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text-1);
  font-family: var(--font-body);
  font-size: 0.87rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}
.input::placeholder { color: var(--neutral); }
.input.error { border-color: var(--error); }
.input.error:focus { box-shadow: 0 0 0 3px rgba(239,68,68,0.12); }

.input-label {
  display: block;
  font-size: 0.8rem; font-weight: 500;
  color: var(--text-2);
  margin-bottom: var(--sp-1);
}
.input-group { margin-bottom: var(--sp-4); }
.input-hint { font-size: 0.75rem; color: var(--neutral); margin-top: var(--sp-1); }
.input-error { font-size: 0.75rem; color: var(--error); margin-top: var(--sp-1); }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}
.card-body  { padding: var(--sp-5); }
.card-flat  { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }

/* ── Chips & Badges ──────────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 12px;
  border-radius: var(--r-pill);
  background: #F3F4F6; color: #6B7280;
  font-size: 0.75rem; font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  border: none;
  font-family: var(--font-body);
  transition: all 0.15s;
}
.chip.active { background: var(--primary); color: #fff; }
.chip:hover:not(.active) { background: #E5E7EB; }

.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px;
  border-radius: var(--r-xs);
  font-size: 0.68rem; font-weight: 600;
  letter-spacing: 0.02em; white-space: nowrap;
}
.badge-indigo  { background: #EEF2FF; color: var(--primary); }
.badge-success { background: var(--success-bg); color: #065F46; }
.badge-warning { background: var(--warning-bg); color: #92400E; }
.badge-error   { background: var(--error-bg);   color: #991B1B; }
.badge-neutral { background: #F3F4F6; color: #6B7280; }

/* ── Nav ─────────────────────────────────────────────────── */
.nav-top {
  position: sticky; top: 0; left: 0; right: 0;
  height: 56px;
  background: rgba(255,255,255,0.92);
  backdrop-filter: var(--blur-nav);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 var(--sp-4);
  z-index: 200;
  gap: var(--sp-3);
}
.nav-logo {
  font-family: var(--font-display);
  font-weight: 700; font-size: 1rem;
  color: var(--text-1); letter-spacing: -0.02em;
  display: flex; align-items: center; gap: var(--sp-2);
  text-decoration: none;
}
.nav-logo img { height: 28px; max-width: 100px; object-fit: contain; }

/* ── Bottom nav (mobile) ─────────────────────────────────── */
.mps-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: 60px;
  background: rgba(255,255,255,0.95);
  backdrop-filter: var(--blur-nav);
  border-top: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 4px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  z-index: 200;
}
.mps-nav-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px; text-decoration: none;
  color: var(--neutral);
  font-size: 0.65rem; font-weight: 500;
  font-family: var(--font-body);
  padding: 6px 4px;
  border-radius: var(--r-md);
  transition: color 0.15s, background 0.15s;
}
.mps-nav-item.active { color: var(--primary); }
.mps-nav-item .mps-nav-icon {
  display: flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
}

/* ── List rows ───────────────────────────────────────────── */
.list-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}
.list-row:last-child { border-bottom: none; }
.list-row:hover { background: var(--bg); }

/* ── Section header ──────────────────────────────────────── */
.section-hd {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--sp-4);
}
.section-hd h2 { font-family: var(--font-display); font-size: 1.05rem; font-weight: 600; letter-spacing: -0.02em; }

/* ── Toggle switch ───────────────────────────────────────── */
.tog {
  position: relative; width: 42px; height: 24px; flex-shrink: 0;
}
.tog input { opacity: 0; width: 0; height: 0; }
.tog-track {
  position: absolute; inset: 0;
  background: var(--border); border-radius: var(--r-pill);
  cursor: pointer; transition: background 0.2s;
}
.tog-track::before {
  content: '';
  position: absolute; width: 18px; height: 18px;
  left: 3px; bottom: 3px;
  background: #fff; border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.tog input:checked + .tog-track { background: var(--primary); }
.tog input:checked + .tog-track::before { transform: translateX(18px); }
.tog input:focus + .tog-track { box-shadow: 0 0 0 3px var(--primary-ring); }

/* ── Toast ───────────────────────────────────────────────── */
.toast-wrap {
  position: fixed; top: 72px; left: 50%;
  transform: translateX(-50%) translateY(-8px);
  z-index: 9000; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.toast-item {
  background: var(--text-1); color: #fff;
  padding: 10px 20px; border-radius: var(--r-sm);
  font-size: 0.82rem; font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(-4px);
  transition: opacity 0.25s, transform 0.25s;
  white-space: nowrap;
}
.toast-item.show { opacity: 1; transform: translateY(0); }
.toast-item.error { background: var(--error); }
.toast-item.success { background: var(--success); }

/* Old single-toast compat */
#toast {
  position: fixed; top: -80px; left: 50%;
  transform: translateX(-50%);
  background: var(--text-1); color: #fff;
  padding: 10px 20px; border-radius: var(--r-sm);
  font-size: 0.82rem; font-weight: 500;
  z-index: 9000; transition: top 0.3s;
  box-shadow: var(--shadow-lg); white-space: nowrap;
}
#toast.show { top: 72px; }
#toast.erro { background: var(--error); }

/* ── Skeleton ────────────────────────────────────────────── */
.skel {
  background: linear-gradient(90deg, #F3F4F6 25%, #E9EAEC 50%, #F3F4F6 75%);
  background-size: 200% 100%;
  animation: skel 1.4s ease infinite;
  border-radius: var(--r-xs);
}
@keyframes skel {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Offer card ──────────────────────────────────────────── */
.offer-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: box-shadow 0.2s, transform 0.2s;
}
.offer-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}
.offer-card.premium { border-color: #FDE68A; box-shadow: 0 0 0 1px #FDE68A; }

.offer-img-wrap { position: relative; height: 192px; overflow: hidden; background: #F3F4F6; }
.offer-img-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.offer-img-wrap .carousel { display: flex; height: 100%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.offer-img-wrap .carousel::-webkit-scrollbar { display: none; }
.offer-img-wrap .carousel img { flex-shrink: 0; scroll-snap-align: start; width: 100%; }
.offer-img-badge { position: absolute; bottom: 8px; right: 8px; background: rgba(10,10,10,0.6); backdrop-filter: blur(4px); color: #fff; font-size: 0.65rem; font-weight: 500; padding: 3px 8px; border-radius: var(--r-xs); display: flex; align-items: center; gap: 4px; }

.offer-body { padding: 14px 16px 16px; }
.offer-shop-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.offer-av { width: 22px; height: 22px; border-radius: 50%; background: #EEF2FF; color: var(--primary); font-size: 0.6rem; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; overflow: hidden; }
.offer-av img { width: 100%; height: 100%; object-fit: cover; }
.offer-shop-name { font-size: 0.78rem; font-weight: 500; color: var(--text-2); cursor: pointer; }
.offer-shop-name:hover { color: var(--primary); }
.offer-loc { font-size: 0.72rem; color: var(--neutral); margin-left: auto; display: flex; align-items: center; gap: 3px; }

.offer-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.offer-title { font-family: var(--font-display); font-size: 0.95rem; font-weight: 600; letter-spacing: -0.01em; color: var(--text-1); margin-bottom: 4px; line-height: 1.35; }
.offer-desc { font-size: 0.8rem; color: var(--text-2); line-height: 1.5; margin-bottom: 12px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.offer-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.offer-price { font-family: var(--font-display); font-size: 1.15rem; font-weight: 700; letter-spacing: -0.02em; color: var(--text-1); }
.offer-price .cur { font-size: 0.75rem; font-weight: 500; color: var(--text-2); margin-right: 1px; }

.cashback-row {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--success-bg);
  border-top: 1px solid #D1FAE5;
  padding: 8px 16px; gap: 8px;
}
.cashback-row .cb-info { font-size: 0.78rem; font-weight: 500; color: #065F46; display: flex; align-items: center; gap: 6px; }
.cashback-row .cb-btn { font-size: 0.72rem; font-weight: 600; color: #065F46; background: #fff; border: 1px solid #A7F3D0; border-radius: var(--r-xs); padding: 4px 10px; cursor: pointer; font-family: var(--font-body); transition: background 0.15s; }
.cashback-row .cb-btn:hover { background: #D1FAE5; }

/* ── Sheet (modal) ───────────────────────────────────────── */
.sheet-overlay {
  position: fixed; inset: 0;
  background: rgba(10,10,10,0.5);
  z-index: 500; display: none;
  align-items: flex-end; justify-content: center;
}
.sheet-overlay.open { display: flex; }
.sheet {
  background: var(--surface);
  border-radius: 12px 12px 0 0;
  padding: var(--sp-6) var(--sp-5) var(--sp-10);
  width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto;
  animation: slideUp 0.25s cubic-bezier(.16,1,.3,1);
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet-handle { width: 36px; height: 4px; background: var(--border); border-radius: var(--r-pill); margin: 0 auto var(--sp-5); }
.sheet-title { font-family: var(--font-display); font-size: 1rem; font-weight: 600; letter-spacing: -0.02em; display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sp-2); }
.sheet-close { background: var(--bg); border: none; border-radius: var(--r-pill); width: 28px; height: 28px; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--text-2); transition: background 0.15s; }
.sheet-close:hover { background: var(--border); }

/* ── Pagination ──────────────────────────────────────────── */
.pag { display: flex; align-items: center; justify-content: center; gap: var(--sp-3); padding: var(--sp-5); }
.pag-btn { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 8px 16px; font-size: 0.82rem; font-weight: 500; cursor: pointer; font-family: var(--font-body); color: var(--text-1); display: flex; align-items: center; gap: 6px; transition: all 0.15s; }
.pag-btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.pag-btn:disabled { opacity: 0.35; cursor: default; }
.pag-info { font-size: 0.8rem; color: var(--text-2); font-weight: 500; min-width: 60px; text-align: center; }

/* ── Filter bar ──────────────────────────────────────────── */
.filter-bar { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 0 var(--sp-4); }
.filter-bar::-webkit-scrollbar { display: none; }

/* ── Search bar ──────────────────────────────────────────── */
.search-bar { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 10px 14px; transition: border-color 0.15s, box-shadow 0.15s; }
.search-bar:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.search-bar input { border: none; background: transparent; flex: 1; font-size: 0.87rem; font-family: var(--font-body); color: var(--text-1); outline: none; }
.search-bar input::placeholder { color: var(--neutral); }

/* ── Panel card (Painel/forms) ───────────────────────────── */
.panel-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--sp-5); margin-bottom: var(--sp-4); }
.panel-card-title { font-family: var(--font-display); font-size: 0.78rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--neutral); margin-bottom: var(--sp-4); display: flex; align-items: center; gap: 6px; }

/* ── Info bar ────────────────────────────────────────────── */
.info-bar { display: flex; align-items: center; gap: 8px; padding: 0 var(--sp-4); margin-bottom: var(--sp-3); }
.info-pill { display: inline-flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-pill); padding: 5px 12px; font-size: 0.78rem; font-weight: 500; color: var(--text-2); }
.info-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); }
.info-count { font-weight: 600; color: var(--text-1); }
.search-tag { background: #EEF2FF; color: var(--primary); border-radius: var(--r-xs); padding: 3px 8px; font-size: 0.72rem; font-weight: 500; display: inline-flex; align-items: center; gap: 4px; }

/* ── Cashback section (form) ─────────────────────────────── */
.cb-section-on  { background: var(--success-bg); border: 1px solid #A7F3D0; border-radius: var(--r-lg); padding: var(--sp-4); margin-bottom: var(--sp-4); }
.cb-section-off { background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--sp-4); margin-bottom: var(--sp-4); }
.cb-hd { display: flex; align-items: center; justify-content: space-between; }
.cb-hd-info { display: flex; align-items: center; gap: 8px; }
.cb-hd-info strong { font-size: 0.87rem; font-weight: 500; color: var(--text-1); }
.cb-hd-info span { font-size: 0.78rem; color: var(--text-2); display: block; }
.cb-pct-row { display: flex; align-items: center; gap: 10px; margin-top: var(--sp-3); padding-top: var(--sp-3); border-top: 1px solid #A7F3D0; }
.cb-pct-row label { font-size: 0.8rem; font-weight: 500; color: #065F46; white-space: nowrap; }
.cb-pct-input { width: 72px; padding: 7px 10px; border: 1px solid #6EE7B7; border-radius: var(--r-sm); font-size: 0.87rem; font-weight: 600; color: #065F46; text-align: center; background: var(--surface); font-family: var(--font-body); outline: none; }
.cb-pct-input:focus { box-shadow: 0 0 0 3px rgba(16,185,129,0.12); }
.cb-pct-preview { font-size: 0.78rem; color: #059669; font-weight: 500; }

/* ── Photo slots ─────────────────────────────────────────── */
.photo-slots { display: flex; gap: var(--sp-3); margin-bottom: 4px; }
.photo-slot { flex: 1; aspect-ratio: 1; background: var(--bg); border: 1px dashed #C4C4CC; border-radius: var(--r-md); display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; overflow: hidden; position: relative; transition: border-color 0.15s; }
.photo-slot:hover { border-color: var(--primary); }
.photo-slot img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.photo-slot span { font-size: 0.65rem; font-weight: 500; color: var(--neutral); margin-top: 4px; }

/* ── Spin ────────────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 1s linear infinite; display: inline-block; }

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
