/* assets/css/style.css */

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

:root {
  --brand: #FFE600;
  --brand-dark: #D4BE00;
  --ml-yellow: #FFE600;
  --ml-blue: #3483FA;
  --accent: #3483FA;
  --accent-hover: #2968c8;
  --text: #1a1a2e;
  --text-muted: #666;
  --bg: #f5f5f5;
  --bg-card: #fff;
  --border: #e5e5e5;
  --radius: 10px;
  --shadow: 0 2px 12px rgba(0,0,0,.08);
  --shadow-hover: 0 6px 24px rgba(0,0,0,.14);
  --success: #00a650;
  --danger: #e84545;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

html { scroll-behavior: smooth; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.55; font-size: 15px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

/* ─── Container ─────────────────────────────────────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.main-content { padding: 24px 20px; }

/* ─── Header ─────────────────────────────────────────────────────────────────  */
.site-header {
  background: var(--text);
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.header-inner {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 20px; flex-wrap: wrap;
}
.logo { display: flex; align-items: center; text-decoration: none; flex-shrink: 0; }
.logo-compara { font-size: 1.4rem; font-weight: 800; color: #fff; }
.logo-ja      { font-size: 1.4rem; font-weight: 800; color: var(--brand); }

/* Search form in header */
.search-form { flex: 1; min-width: 220px; }
.search-wrap { position: relative; display: flex; }
.search-input {
  width: 100%; padding: 10px 48px 10px 16px;
  border: 2px solid transparent; border-radius: 8px;
  font-size: 15px; outline: none; background: #fff;
  transition: border-color .2s;
}
.search-input:focus { border-color: var(--brand); }
.search-btn {
  position: absolute; right: 0; top: 0; bottom: 0;
  background: var(--brand); border: none; border-radius: 0 8px 8px 0;
  padding: 0 14px; cursor: pointer; display: flex; align-items: center;
  transition: background .2s;
}
.search-btn:hover { background: var(--brand-dark); }

.header-nav { display: flex; gap: 12px; flex-shrink: 0; }
.header-nav a { color: #ccc; font-size: .9rem; white-space: nowrap; }
.header-nav a:hover { color: var(--brand); text-decoration: none; }

/* ─── Autocomplete ──────────────────────────────────────────────────────────── */
.autocomplete-box {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  box-shadow: var(--shadow); z-index: 200; display: none;
}
.autocomplete-box.visible { display: block; }
.ac-item { padding: 10px 16px; cursor: pointer; font-size: 14px; }
.ac-item:hover { background: #f0f4ff; }

/* ─── Hero ───────────────────────────────────────────────────────────────────  */
.hero {
  background: linear-gradient(135deg, var(--text) 0%, #2d2d44 100%);
  padding: 60px 20px 48px; text-align: center; color: #fff;
}
.hero-title { font-size: clamp(1.6rem, 4vw, 2.4rem); font-weight: 800; margin-bottom: 10px; }
.hero-subtitle { color: #aaa; margin-bottom: 28px; font-size: 1.05rem; }
.search-form--hero .search-wrap { max-width: 680px; margin: 0 auto; }
.search-input--hero { padding: 14px 160px 14px 20px; font-size: 16px; border-radius: 10px; }
.search-btn--hero {
  position: absolute; right: 0; top: 0; bottom: 0;
  background: var(--brand); color: var(--text);
  border: none; border-radius: 0 10px 10px 0;
  padding: 0 22px; font-weight: 700; font-size: 15px; cursor: pointer;
  white-space: nowrap;
}
.search-btn--hero:hover { background: var(--brand-dark); }
.hero-stores {
  margin-top: 20px; display: flex; align-items: center;
  justify-content: center; gap: 12px; flex-wrap: wrap;
}
.hero-stores span { color: #aaa; font-size: .9rem; }
.coming-soon {
  font-size: .8rem; color: #666; background: rgba(255,255,255,.1);
  padding: 3px 10px; border-radius: 20px;
}

/* ─── Products Grid ─────────────────────────────────────────────────────────── */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px; margin-top: 16px;
}
.products-grid--small { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }

/* ─── Product Card ──────────────────────────────────────────────────────────── */
.product-card {
  background: var(--bg-card); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
  display: flex; flex-direction: column;
  transition: box-shadow .2s, transform .2s;
  color: var(--text); text-decoration: none;
}
.product-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); text-decoration: none; }
.card-link { text-decoration: none; color: inherit; flex: 1; display: flex; flex-direction: column; }

.card-image {
  position: relative; overflow: hidden;
  background: #f9f9f9; aspect-ratio: 1;
}
.card-image img {
  width: 100%; height: 100%; object-fit: contain;
  transition: transform .3s;
}
.product-card:hover .card-image img { transform: scale(1.04); }

.badge {
  position: absolute; top: 8px; left: 8px;
  padding: 3px 8px; border-radius: 20px; font-size: .72rem; font-weight: 700;
}
.badge-frete { background: var(--success); color: #fff; }
.badge-deal  { background: var(--danger); color: #fff; }

.card-body { padding: 12px; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.card-title {
  font-size: .88rem; line-height: 1.4; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card-price { display: flex; flex-direction: column; gap: 2px; margin-top: auto; }
.price-old   { font-size: .78rem; color: var(--text-muted); text-decoration: line-through; }
.price-current { font-size: 1.15rem; font-weight: 700; color: var(--text); }

.card-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.store-badge { display: flex; align-items: center; gap: 4px; font-size: .8rem; color: var(--text-muted); }
.store-logo-sm { height: 16px; width: auto; object-fit: contain; }
.store-logo-md { height: 24px; width: auto; object-fit: contain; }
.offers-count { font-size: .75rem; background: #e8f0fe; color: var(--accent); padding: 2px 8px; border-radius: 20px; }

.card-footer { padding: 10px 12px; border-top: 1px solid var(--border); }

/* ─── Buttons ────────────────────────────────────────────────────────────────  */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 10px 18px; border-radius: 8px; font-weight: 600; font-size: .9rem; cursor: pointer; border: none; text-decoration: none; transition: background .2s, transform .1s; }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); text-decoration: none; }
.btn-cta { background: var(--accent); color: #fff; width: 100%; justify-content: center; }
.btn-cta:hover { background: var(--accent-hover); text-decoration: none; }
.btn-sm { padding: 7px 14px; font-size: .82rem; }
.btn-filter { background: var(--text); color: #fff; padding: 8px 14px; border-radius: 6px; cursor: pointer; border: none; font-size: .85rem; }

/* ─── Search results header ─────────────────────────────────────────────────── */
.results-header { margin-bottom: 20px; }
.results-header h1 { font-size: 1.25rem; font-weight: 600; margin-bottom: 14px; }
.results-header h1 strong { color: var(--accent); }

/* ─── Filters bar ────────────────────────────────────────────────────────────  */
.filters-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: #fff; padding: 12px 16px; border-radius: 8px; box-shadow: var(--shadow);
}
.filters-bar select {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px;
  font-size: .88rem; background: #fff; cursor: pointer;
}
.filter-check { display: flex; align-items: center; gap: 6px; font-size: .88rem; cursor: pointer; }
.filter-preco { display: flex; align-items: center; gap: 8px; }
.filter-preco input {
  width: 90px; padding: 7px 10px; border: 1px solid var(--border);
  border-radius: 6px; font-size: .85rem;
}

/* ─── Empty state ────────────────────────────────────────────────────────────  */
.empty-state { text-align: center; padding: 60px 20px; }
.empty-icon { font-size: 3rem; margin-bottom: 16px; }
.empty-state h2 { font-size: 1.4rem; margin-bottom: 8px; }
.empty-state p { color: var(--text-muted); margin-bottom: 20px; }

/* ─── Pagination ─────────────────────────────────────────────────────────────  */
.pagination { display: flex; justify-content: center; gap: 8px; margin-top: 32px; flex-wrap: wrap; }
.page-btn { padding: 8px 14px; background: #fff; border-radius: 6px; font-size: .9rem; box-shadow: var(--shadow); }
.page-btn.active { background: var(--accent); color: #fff; }
.page-btn:hover { background: var(--accent); color: #fff; text-decoration: none; }

/* ─── Breadcrumb ─────────────────────────────────────────────────────────────  */
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: .82rem; color: var(--text-muted); margin-bottom: 16px; flex-wrap: wrap; }
.breadcrumb a { color: var(--accent); }

/* ─── Product Page ───────────────────────────────────────────────────────────  */
.product-layout { display: grid; grid-template-columns: 340px 1fr; gap: 32px; margin-bottom: 40px; }
@media (max-width: 768px) { .product-layout { grid-template-columns: 1fr; } }

.product-image-wrap {
  background: #fff; border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow); aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
}
.product-image-wrap img { max-height: 300px; object-fit: contain; }

.product-brand { font-size: .85rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.product-title { font-size: 1.4rem; font-weight: 700; line-height: 1.3; margin-bottom: 16px; }

.price-highlight { background: #f0f7ff; border-left: 4px solid var(--accent); padding: 14px 18px; border-radius: 0 8px 8px 0; margin-bottom: 16px; }
.price-label { font-size: .82rem; color: var(--text-muted); display: block; margin-bottom: 4px; }
.price-big { font-size: 2rem; font-weight: 800; color: var(--text); }

.offers-summary { font-size: .9rem; color: var(--text-muted); margin-bottom: 12px; }

/* ─── Price history chart ────────────────────────────────────────────────────  */
.price-history-chart { background: #fff; border-radius: 8px; padding: 16px; box-shadow: var(--shadow); margin: 16px 0; }
.price-history-chart h3 { font-size: .95rem; margin-bottom: 12px; }

/* ─── Offers Table ───────────────────────────────────────────────────────────  */
.offers-section { margin-bottom: 40px; }
.offers-section h2 { font-size: 1.2rem; font-weight: 700; margin-bottom: 16px; }
.offers-table-wrap { overflow-x: auto; border-radius: var(--radius); box-shadow: var(--shadow); }
.offers-table { width: 100%; border-collapse: collapse; background: #fff; }
.offers-table th { padding: 12px 16px; background: #f8f8f8; font-size: .83rem; text-align: left; color: var(--text-muted); border-bottom: 2px solid var(--border); white-space: nowrap; }
.offers-table td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.offer-row:last-child td { border-bottom: none; }
.offer-row.best-offer { background: #f0f7ff; }
.best-badge { display: inline-block; background: var(--success); color: #fff; font-size: .7rem; padding: 2px 8px; border-radius: 20px; margin-left: 8px; font-weight: 700; }
.offer-price strong { font-size: 1.1rem; font-weight: 700; }
.price-old-sm { display: block; font-size: .78rem; color: var(--text-muted); text-decoration: line-through; }
.rep-bar { height: 4px; background: #eee; border-radius: 4px; width: 80px; margin-top: 4px; }
.rep-fill { height: 100%; background: var(--success); border-radius: 4px; }
.stars { color: #f5a623; letter-spacing: -1px; font-size: 1rem; }

/* ─── Popular tags ───────────────────────────────────────────────────────────  */
.popular-section { padding: 32px 0; }
.popular-section h2 { margin-bottom: 14px; font-size: 1.1rem; }
.tags-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { background: #fff; border: 1px solid var(--border); padding: 6px 14px; border-radius: 20px; font-size: .85rem; color: var(--text); transition: all .15s; }
.tag:hover { background: var(--accent); color: #fff; border-color: var(--accent); text-decoration: none; }

/* ─── Sections ───────────────────────────────────────────────────────────────  */
.trending-section { padding: 24px 0 40px; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.section-header h2 { font-size: 1.2rem; }
.see-all { font-size: .88rem; color: var(--accent); }

/* ─── How it works ───────────────────────────────────────────────────────────  */
.how-section { background: #fff; padding: 48px 20px; margin-top: 16px; }
.how-section h2 { text-align: center; font-size: 1.4rem; margin-bottom: 32px; }
.steps-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 24px; max-width: 800px; margin: 0 auto; }
.step { text-align: center; }
.step-icon { font-size: 2.2rem; margin-bottom: 12px; }
.step h3 { font-size: 1.05rem; margin-bottom: 6px; }
.step p { color: var(--text-muted); font-size: .9rem; }

/* ─── Footer ─────────────────────────────────────────────────────────────────  */
.site-footer { background: var(--text); color: #aaa; margin-top: 48px; }
.footer-inner { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 32px; padding: 40px 20px 24px; }
.footer-brand .logo-compara { color: #fff; font-size: 1.2rem; font-weight: 800; }
.footer-brand .logo-ja      { color: var(--brand); font-size: 1.2rem; font-weight: 800; }
.footer-brand p { margin-top: 8px; font-size: .85rem; line-height: 1.5; }
.footer-links h4, .footer-legal h4 { color: #fff; font-size: .9rem; margin-bottom: 12px; }
.footer-links ul, .footer-legal ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.footer-links a, .footer-legal a { color: #aaa; font-size: .85rem; }
.footer-links a:hover, .footer-legal a:hover { color: var(--brand); text-decoration: none; }
.disclaimer { font-size: .75rem; margin-top: 12px; line-height: 1.5; color: #666; }
.footer-bottom { border-top: 1px solid #333; padding: 14px 20px; text-align: center; font-size: .8rem; }
.footer-bottom a { color: var(--brand); }

/* ─── Responsive ─────────────────────────────────────────────────────────────  */
@media (max-width: 640px) {
  .header-inner { gap: 10px; }
  .header-nav   { display: none; }
  .search-input--hero { padding: 14px 20px 14px 16px; font-size: 15px; }
  .search-btn--hero { position: static; border-radius: 10px; width: 100%; justify-content: center; margin-top: 10px; padding: 12px; }
  .search-form--hero .search-wrap { flex-direction: column; }
  .filters-bar  { flex-direction: column; align-items: flex-start; }
  .products-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .offers-table th:nth-child(2),
  .offers-table td:nth-child(2) { display: none; }
}
