/* ==========================================================
   global.css — MelhorEscolha
   Estilos compartilhados por todas as páginas
   ========================================================== */

/* ── RESET & BASE ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --brand:       #FF6B00;
  --brand-dark:  #E55A00;
  --brand-light: #FFF3E8;
  --text:        #111827;
  --muted:       #6B7280;
  --border:      #E5E7EB;
  --bg:          #F9FAFB;
  --white:       #FFFFFF;
  --green:       #059669;
  --green-light: #ECFDF5;
  --red:         #DC2626;
  --red-light:   #FEF2F2;
  --radius:      12px;
  --shadow:      0 1px 4px rgba(0,0,0,.08);
  --shadow-md:   0 4px 16px rgba(0,0,0,.10);
  --font:        'Inter', sans-serif;
  --max:         1200px;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

.container { max-width: var(--max); margin: 0 auto; padding: 0 20px; }

/* ── ANNOUNCEMENT BAR ─────────────────────────────────────── */
.announce-bar {
  background: var(--brand);
  color: #fff;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 16px;
}
.announce-bar a { color: #fff; text-decoration: underline; }

/* ── HEADER ───────────────────────────────────────────────── */
.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 20px;
  max-width: var(--max);
  margin: 0 auto;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
}
.logo span { color: var(--brand); }

/* ── MAIN NAV ─────────────────────────────────────────────── */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--white);
  cursor: pointer;
  margin-left: auto;
  flex-shrink: 0;
  transition: border-color .15s, background .15s;
  position: relative;
  z-index: 120;
}
.nav-toggle:hover { border-color: var(--brand); background: var(--brand-light); }
.nav-toggle-bar {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform .2s, opacity .2s;
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, .4);
  z-index: 90;
}
.nav-overlay.is-open { display: block; }

.main-nav { flex: 1; }
.nav-list {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 0;
}
.nav-list > .has-submenu { position: relative; }

.nav-item-row {
  display: flex;
  align-items: center;
  gap: 0;
}

.main-nav a,
.submenu-toggle {
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 8px;
  transition: color .15s, background .15s;
  background: transparent;
  border: none;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.main-nav a:hover,
.main-nav a.active,
.main-nav a:focus-visible,
.submenu-toggle:hover,
.submenu-toggle:focus-visible {
  color: var(--brand);
  background: var(--brand-light);
  outline: none;
}

.submenu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 8px;
  color: var(--muted);
}
.submenu-toggle svg {
  width: .7em;
  height: .7em;
  transition: transform .2s;
}
.has-submenu.is-open > .nav-item-row > .submenu-toggle svg,
.has-submenu:hover > .nav-item-row > .submenu-toggle svg {
  transform: rotate(180deg);
}

/* Desktop dropdowns */
.submenu {
  list-style: none;
  margin: 0;
  padding: 8px;
  min-width: 200px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 120;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity .15s, transform .15s, visibility .15s;
}
.has-submenu:hover > .submenu,
.has-submenu:focus-within > .submenu,
.has-submenu.is-open > .submenu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.submenu .has-submenu { position: relative; }
.submenu .submenu {
  top: -8px;
  left: calc(100% + 6px);
}
.submenu a,
.submenu .submenu-toggle {
  display: flex;
  width: 100%;
  text-align: left;
  border-radius: 8px;
}
.submenu .nav-item-row { width: 100%; }
.submenu .nav-item-row > a { flex: 1; }
.submenu .submenu-toggle svg { transform: rotate(-90deg); }
.submenu .has-submenu.is-open > .nav-item-row > .submenu-toggle svg,
.submenu .has-submenu:hover > .nav-item-row > .submenu-toggle svg {
  transform: rotate(90deg);
}

.header-actions { display: flex; align-items: center; gap: 8px; }

.btn-amazon {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--brand);
  color: #fff;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 99px;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s;
  text-decoration: none;
}
.btn-amazon:hover { background: var(--brand-dark); }

/* ── CATEGORY BADGE ───────────────────────────────────────── */
.category-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 99px;
  background: var(--brand-light);
  color: var(--brand);
}

/* ── BADGES ───────────────────────────────────────────────── */
.badge-new {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  background: #ECFDF5;
  color: #059669;
  border-radius: 4px;
  padding: 2px 7px;
}
.badge-hot {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  background: #FEF2F2;
  color: #DC2626;
  border-radius: 4px;
  padding: 2px 7px;
}
.badge-deal {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  background: #FFFBEB;
  color: #D97706;
  border-radius: 4px;
  padding: 2px 7px;
}

/* ── BREADCRUMB ───────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--muted);
  flex-wrap: wrap;
}
.breadcrumb a:hover { color: var(--brand); }

/* ── PAGINATION ───────────────────────────────────────────── */
.pagination { display: flex; align-items: center; justify-content: center; gap: 6px; }

.page-item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  background: var(--white);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: color .15s, background .15s, border-color .15s;
  font-family: var(--font);
}
.page-item:hover { color: var(--brand); border-color: var(--brand); background: var(--brand-light); }
.page-item.active { color: #fff; background: var(--brand); border-color: var(--brand); cursor: default; }
.page-item.dots { cursor: default; border-color: transparent; background: transparent; }
.page-item.dots:hover { color: var(--muted); background: transparent; border-color: transparent; }

.page-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  background: var(--white);
  border: 1px solid var(--border);
  cursor: pointer;
  gap: 6px;
  transition: color .15s, background .15s, border-color .15s;
  font-family: var(--font);
}
.page-arrow:hover { color: var(--brand); border-color: var(--brand); background: var(--brand-light); }
.page-arrow.disabled { opacity: .4; cursor: not-allowed; pointer-events: none; }

/* ── SIDEBAR SHARED ───────────────────────────────────────── */
.sidebar { display: flex; flex-direction: column; gap: 24px; }

.sidebar-widget {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.widget-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.widget-title svg { color: var(--brand); }

.filter-list { list-style: none; display: flex; flex-direction: column; gap: 4px; }

.filter-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--text);
  cursor: pointer;
  transition: background .15s, color .15s;
  border: none;
  background: transparent;
  font-family: var(--font);
  width: 100%;
  text-align: left;
  text-decoration: none;
}
.filter-item:hover { background: var(--bg); color: var(--brand); }
.filter-item.active { background: var(--brand-light); color: var(--brand); font-weight: 600; }

.filter-count {
  font-size: 11.5px;
  color: var(--muted);
  background: var(--bg);
  border-radius: 99px;
  padding: 1px 8px;
  font-weight: 600;
}
.filter-item.active .filter-count { background: rgba(255,107,0,.15); color: var(--brand); }

.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  display: inline-flex;
  align-items: center;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 5px 14px;
  transition: border-color .15s, color .15s, background .15s;
  text-decoration: none;
}
.tag:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-light); }

/* ── FOOTER ───────────────────────────────────────────────── */
.site-footer { background: #111827; color: #9CA3AF; padding: 56px 0 0; }

.footer-grid {
  display: grid;
  grid-template-columns: 240px 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 40px;
}

.footer-brand .logo { color: #fff; margin-bottom: 12px; }
.footer-brand p { font-size: 13px; line-height: 1.7; }
.footer-brand .socials { display: flex; gap: 10px; margin-top: 16px; }
.footer-brand .socials a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  background: #1F2937;
  border-radius: 8px;
  color: #9CA3AF;
  transition: background .15s, color .15s;
}
.footer-brand .socials a:hover { background: var(--brand); color: #fff; }

.footer-col h4 { font-size: 13px; font-weight: 700; color: #F9FAFB; margin-bottom: 14px; }
.footer-col ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.footer-col ul li a { font-size: 13px; transition: color .15s; }
.footer-col ul li a:hover { color: #fff; }

.footer-bottom {
  border-top: 1px solid #1F2937;
  padding: 18px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
}
.footer-bottom a { transition: color .15s; }
.footer-bottom a:hover { color: #fff; }

.disclaimer {
  font-size: 11.5px;
  color: #4B5563;
  text-align: center;
  padding: 12px 0 18px;
  line-height: 1.6;
}

/* ── BACK TO TOP ──────────────────────────────────────────── */
.back-to-top {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 44px;
  height: 44px;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(255,107,0,.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s, background .15s;
  z-index: 200;
}
.back-to-top.visible { opacity: 1; pointer-events: auto; }
.back-to-top:hover { background: var(--brand-dark); transform: translateY(-3px); }

/* ── RESPONSIVE BASE ──────────────────────────────────────── */
@media (max-width: 1024px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .footer-grid { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; gap: 8px; text-align: center; }

  .nav-toggle { display: flex; order: 3; margin-left: 0; }
  .header-actions { order: 2; margin-left: auto; }

  .main-nav {
    position: fixed;
    top: 0;
    right: 0;
    width: min(320px, 88vw);
    height: 100vh;
    background: var(--white);
    border-left: 1px solid var(--border);
    z-index: 110;
    padding: 72px 16px 24px;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform .25s ease;
    flex: none;
  }
  .main-nav.is-open { transform: translateX(0); }

  .nav-list {
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
  }
  .nav-list > .has-submenu { position: static; }

  .main-nav a,
  .submenu-toggle {
    width: 100%;
    justify-content: flex-start;
    padding: 12px 14px;
    font-size: 15px;
  }

  .nav-item-row { width: 100%; }
  .nav-item-row > a { flex: 1; }
  .submenu-toggle { width: auto; flex-shrink: 0; }

  .submenu {
    position: static;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: none;
    box-shadow: none;
    border: none;
    border-radius: 0;
    background: var(--bg);
    padding: 4px 0 4px 12px;
    min-width: 0;
    display: none;
    margin: 0 0 4px;
  }
  .has-submenu.is-open > .submenu { display: block; }

  /* Disable hover-open on touch; JS toggles .is-open */
  .has-submenu:hover > .submenu,
  .has-submenu:focus-within > .submenu {
    display: none;
  }
  .has-submenu.is-open > .submenu { display: block; }
  .has-submenu.is-open:hover > .submenu,
  .has-submenu.is-open:focus-within > .submenu {
    display: block;
  }

  .submenu .submenu {
    left: auto;
    top: auto;
    padding-left: 12px;
  }
  .submenu .submenu-toggle svg { transform: none; }
  .submenu .has-submenu.is-open > .nav-item-row > .submenu-toggle svg,
  .submenu .has-submenu:hover > .nav-item-row > .submenu-toggle svg {
    transform: rotate(180deg);
  }

  .has-submenu.is-open > .nav-item-row > .submenu-toggle svg {
    transform: rotate(180deg);
  }
}
