:root {
  --brand-primary: #1f6e5c;
  --brand-primary-dark: #145446;
  --brand-accent: #2fb37f;
  --brand-accent-dark: #229367;
  --bg: #f7f4ec;
  --surface: #ffffff;
  --text: #1c2a26;
  --text-muted: #6b7770;
  --border: #e6e2d6;
  --shadow: 0 1px 3px rgba(20,84,70,0.06), 0 4px 12px rgba(20,84,70,0.05);
  --shadow-hover: 0 4px 12px rgba(20,84,70,0.10), 0 12px 24px rgba(20,84,70,0.08);
  --radius: 14px;
  --success: #229367;
  --danger: #dc2626;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 1px 3px rgba(20,84,70,0.05);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-top: 12px;
  padding-bottom: 12px;
  flex-wrap: wrap;
  min-height: 68px;
}

.brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: var(--brand-primary);
}

.brand picture,
.brand img {
  display: block;
}

.brand-logo {
  height: 36px;
  width: auto;
  display: block;
  object-fit: contain;
}

.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-btn {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.15s;
}

.filter-btn:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

.filter-btn.active {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: white;
}

/* Search bar */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.search-bar {
  position: relative;
  padding-top: 4px;
  padding-bottom: 12px;
  display: flex;
  align-items: center;
}

.search-input {
  width: 100%;
  padding: 12px 44px 12px 44px;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  background: var(--surface) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%236b7770' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='7'/><path d='M21 21l-4.35-4.35'/></svg>") no-repeat 16px center;
  font: inherit;
  font-size: 15px;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.search-input:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(31,110,92,0.12);
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  font-size: 22px;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 999px;
}

.search-clear:hover {
  background: rgba(0,0,0,0.06);
  color: var(--text);
}

/* Layout: sidebar + grid */
.layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 28px;
  align-items: start;
  padding-bottom: 40px;
}

.sidebar {
  position: sticky;
  top: 84px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px 12px;
  box-shadow: var(--shadow);
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 10px;
  padding: 0 8px;
}

.sidebar-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 0;
}

.sidebar-close {
  display: none;
  background: transparent;
  border: none;
  font-size: 28px;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 8px;
  border-radius: 8px;
}

.sidebar-close:hover {
  background: rgba(0,0,0,0.05);
  color: var(--text);
}

.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px 10px;
  border-radius: 8px;
  transition: background 0.15s;
}

.menu-toggle span {
  display: block;
  width: 22px;
  height: 2.5px;
  background: var(--brand-primary);
  border-radius: 2px;
}

.menu-toggle:hover {
  background: rgba(31,110,92,0.08);
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 40;
  opacity: 0;
  transition: opacity 0.2s ease-out;
  pointer-events: none;
}

.sidebar-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.category-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cat-btn {
  background: transparent;
  border: none;
  color: var(--text);
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  text-align: left;
  font-family: inherit;
}

.cat-btn:hover {
  background: rgba(31,110,92,0.08);
  color: var(--brand-primary);
}

.cat-btn.active {
  background: var(--brand-primary);
  color: white;
}

.cat-count {
  background: rgba(0,0,0,0.06);
  color: inherit;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  line-height: 1.4;
  flex-shrink: 0;
}

.cat-btn.active .cat-count {
  background: rgba(255,255,255,0.22);
}

.cat-tag {
  display: inline-block;
  align-self: flex-start;
  background: rgba(31,110,92,0.10);
  color: var(--brand-primary);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Hero */
.hero {
  padding: 32px 0 16px;
}

.hero h1 {
  margin: 0 0 6px;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--brand-primary);
}

.hero-sub {
  margin: 0;
  color: var(--text-muted);
  font-size: 15px;
}

/* Grid */
.deals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  min-width: 0;
}

.loading, .empty {
  grid-column: 1 / -1;
  padding: 60px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 15px;
}

/* Card */
.deal-card {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  transition: transform 0.15s, box-shadow 0.15s;
  text-decoration: none;
  color: inherit;
  position: relative;
}

.deal-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.deal-img-wrap {
  position: relative;
  aspect-ratio: 1 / 1;
  background: #f2f0e6;
  overflow: hidden;
}

.deal-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 12px;
  transition: transform 0.3s;
}

.deal-card:hover .deal-img {
  transform: scale(1.04);
}

.discount-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--brand-accent);
  color: white;
  font-weight: 800;
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(47,179,127,0.4);
}

.mp-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255,255,255,0.95);
  color: var(--text);
  font-weight: 600;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.deal-body {
  padding: 14px 14px 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 8px;
}

.deal-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  margin: 0;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 38px;
}

.price-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.price-original {
  color: var(--text-muted);
  text-decoration: line-through;
  font-size: 13px;
}

.price-current {
  color: var(--success);
  font-weight: 800;
  font-size: 20px;
  line-height: 1;
}

.coupon-line {
  background: #fff4d1;
  color: #7a5310;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.coupon-line.has-copy {
  justify-content: space-between;
  gap: 8px;
  padding: 6px 6px 6px 10px;
}

.coupon-main {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.coupon-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #5c3d0c;
}

.coupon-hint {
  color: #a37217;
  font-weight: 600;
  margin-left: 4px;
}

.coupon-copy {
  flex-shrink: 0;
  background: #7a5310;
  color: white;
  border: none;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  transition: background 0.15s, transform 0.1s;
  font-family: inherit;
}

.coupon-copy:hover { background: #5c3d0c; }
.coupon-copy:active { transform: scale(0.96); }
.coupon-copy.copied {
  background: var(--success);
}

.deal-cta {
  margin-top: auto;
  background: var(--brand-primary);
  color: white;
  text-align: center;
  padding: 10px 12px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 14px;
  transition: background 0.15s;
}

.deal-card:hover .deal-cta {
  background: var(--brand-primary-dark);
}

/* Footer */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 28px 0;
  margin-top: 40px;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.footer-logo {
  height: 56px;
  width: auto;
  display: block;
}

.site-footer p {
  margin: 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  max-width: 640px;
}

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; gap: 0; }
  .menu-toggle { display: flex; }
  .site-header .container {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
  }
  .filters { grid-column: 1 / -1; justify-content: center; }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    max-width: 85vw;
    z-index: 50;
    background: var(--surface);
    border-radius: 0;
    padding: 20px 12px;
    box-shadow: 4px 0 24px rgba(0,0,0,0.15);
    transform: translateX(-100%);
    transition: transform 0.25s ease-out;
    overflow-y: auto;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: block; }
  .sidebar-title {
    font-size: 15px;
    text-transform: none;
    letter-spacing: 0;
    color: var(--text);
  }
}

@media (max-width: 640px) {
  .hero h1 { font-size: 22px; }
  .brand-logo { height: 34px; }
  .site-header .container { min-height: 50px; padding-top: 6px; padding-bottom: 6px; }
  .footer-logo { height: 44px; }
  .deals-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .deal-title { font-size: 13px; }
  .price-current { font-size: 17px; }
}

/* ==========================================================================
 * PAGE SWITCH (Ofertas <-> Cupons) — comum ao index e cupons.html
 * ========================================================================== */

.page-switch {
  display: inline-flex;
  gap: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
}

.page-switch-btn {
  padding: 6px 14px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.page-switch-btn:hover {
  color: var(--brand-primary);
}

.page-switch-btn.active {
  background: var(--brand-primary);
  color: white;
  cursor: default;
}

/* ==========================================================================
 * COUPONS PAGE (cupons.html)
 * ========================================================================== */

.hero-note {
  color: var(--text-muted);
  font-size: 13px;
  margin: 8px 0 0;
  max-width: 560px;
  line-height: 1.5;
}

.hero-note strong { color: var(--text); }

.coupons-page {
  display: grid;
  gap: 32px;
  padding: 8px 0 40px;
}

.coupon-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.coupon-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.coupon-section-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.01em;
}

.coupon-section-count {
  background: var(--brand-primary);
  color: white;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  min-width: 28px;
  text-align: center;
}

.coupon-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.coupon-card {
  background: #fff9e8;
  border: 1.5px dashed #d9b565;
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.15s, transform 0.1s;
}

.coupon-card:hover {
  border-color: #a37217;
}

.coupon-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.coupon-card-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.coupon-card-discount {
  font-size: 15px;
  font-weight: 700;
  color: #5c3d0c;
  line-height: 1.35;
}

.coupon-card-code {
  display: flex;
  align-items: center;
  gap: 10px;
}

.coupon-card-code code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.03em;
  color: #7a5310;
  background: #fff4d1;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #d9b565;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.coupon-card .coupon-copy {
  padding: 6px 14px;
  font-size: 12px;
}

.coupon-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}

.chip-rule {
  background: rgba(122, 83, 16, 0.10);
  color: #7a5310;
}

.chip-cat {
  background: rgba(31, 110, 92, 0.10);
  color: var(--brand-primary);
}

.chip-verified {
  background: rgba(34, 147, 103, 0.15);
  color: var(--success);
}

.coupon-empty {
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
  padding: 24px 12px;
  margin: 0;
  background: var(--bg);
  border-radius: 8px;
}

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
  font-size: 15px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

@media (max-width: 640px) {
  .page-switch-btn { padding: 5px 10px; font-size: 12px; }
  .coupons-page { gap: 20px; }
  .coupon-section { padding: 16px; }
  .coupon-section-header h2 { font-size: 17px; }
  .coupon-list { grid-template-columns: 1fr; gap: 10px; }
  .coupon-card { padding: 12px; }
  .coupon-card-discount { font-size: 14px; }
  .coupon-card-code code { font-size: 15px; }
}
