* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #e63946;
  --dark: #1d1d1d;
  --gray: #f4f4f4;
  --text: #333;
  --border: #ddd;
}

body {
  font-family: 'Segoe UI', sans-serif;
  color: var(--text);
  background: #fff;
}

a { text-decoration: none; color: inherit; }

/* NAV */
nav {
  background: var(--dark);
  color: #fff;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-logo {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
}

.nav-links a {
  color: #ccc;
  font-size: 0.95rem;
  transition: color 0.2s;
}

.nav-links a:hover, .nav-links a.active {
  color: #fff;
}

.nav-cart {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: background 0.2s;
}

.nav-cart:hover { background: #c1121f; }

.cart-count {
  background: #fff;
  color: var(--primary);
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* HERO */
.hero {
  background: linear-gradient(rgba(0,0,0,0.65), rgba(0,0,0,0.65)),
              url('https://www.ipleiria.pt/wp-content/uploads/2022/05/cog-wheels-ga057b7357_4.jpg') center/cover no-repeat;
  color: #fff;
  padding: 5rem 2rem;
  text-align: center;
}

.hero h1 {
  font-size: 2.8rem;
  margin-bottom: 1rem;
}

.hero h1 span { color: var(--primary); }

.hero p {
  font-size: 1.1rem;
  color: #aaa;
  margin-bottom: 2rem;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  padding: 0.8rem 2rem;
  border-radius: 8px;
  font-size: 1rem;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
  display: inline-block;
}

.btn-primary:hover { background: #c1121f; }

/* FEATURES */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  padding: 3rem 2rem;
  background: var(--gray);
}

.feature {
  text-align: center;
  padding: 1.5rem;
}

.feature-icon {
  font-size: 2.5rem;
  margin-bottom: 0.8rem;
}

.feature h3 { margin-bottom: 0.4rem; }
.feature p { color: #666; font-size: 0.9rem; }

/* PRODUTOS GRID */
.section {
  padding: 3rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.section-title {
  font-size: 1.8rem;
  margin-bottom: 0.5rem;
}

.section-subtitle {
  color: #666;
  margin-bottom: 2rem;
}

.produtos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.5rem;
}

.produto-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
  background: #fff;
}

.produto-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}

.produto-img {
  width: 100%;
  height: 180px;
  background: var(--gray);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
}

.produto-info {
  padding: 1rem;
}

.produto-categoria {
  font-size: 0.75rem;
  color: var(--primary);
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 0.3rem;
}

.produto-nome {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.produto-descricao {
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 0.8rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.produto-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.produto-preco {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary);
}

.btn-add-cart {
  background: var(--dark);
  color: #fff;
  border: none;
  padding: 0.5rem 0.9rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.2s;
}

.btn-add-cart:hover { background: #444; }

/* FILTROS */
.filtros {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  align-items: center;
}

.filtro-btn {
  padding: 0.4rem 1rem;
  border: 2px solid var(--border);
  border-radius: 20px;
  background: #fff;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.filtro-btn:hover, .filtro-btn.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.search-bar {
  padding: 0.5rem 1rem;
  border: 2px solid var(--border);
  border-radius: 20px;
  font-size: 0.9rem;
  width: 260px;
  outline: none;
  transition: border-color 0.2s;
}

.search-bar:focus { border-color: var(--primary); }

/* CARRINHO */
.carrinho-container {
  max-width: 900px;
  margin: 2rem auto;
  padding: 0 2rem;
}

.carrinho-titulo {
  font-size: 1.8rem;
  margin-bottom: 1.5rem;
}

.carrinho-vazio {
  text-align: center;
  padding: 4rem 2rem;
  color: #888;
}

.carrinho-vazio .icon { font-size: 4rem; margin-bottom: 1rem; }

.carrinho-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 0.8rem;
  background: #fff;
}

.item-img {
  width: 70px;
  height: 70px;
  background: var(--gray);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  flex-shrink: 0;
}

.item-info { flex: 1; }
.item-nome { font-weight: 600; margin-bottom: 0.2rem; }
.item-preco { color: var(--primary); font-weight: 600; }

.qty-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.qty-btn {
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.qty-btn:hover { background: var(--gray); }

.qty-num {
  min-width: 30px;
  text-align: center;
  font-weight: 600;
}

.btn-remover {
  background: none;
  border: none;
  color: #999;
  cursor: pointer;
  font-size: 1.2rem;
  transition: color 0.2s;
  padding: 0.3rem;
}

.btn-remover:hover { color: var(--primary); }

.carrinho-resumo {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  margin-top: 1.5rem;
  background: var(--gray);
}

.resumo-linha {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.6rem;
  font-size: 0.95rem;
}

.resumo-total {
  font-size: 1.2rem;
  font-weight: 700;
  border-top: 2px solid var(--border);
  padding-top: 0.8rem;
  margin-top: 0.8rem;
  display: flex;
  justify-content: space-between;
}

.total-valor { color: var(--primary); }

/* CHECKOUT */
.checkout-container {
  max-width: 600px;
  margin: 2rem auto;
  padding: 0 2rem;
}

.form-group {
  margin-bottom: 1.2rem;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.7rem 1rem;
  border: 2px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--primary);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* MODAL PRODUTO */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.modal-overlay.open { display: flex; }

.modal {
  background: #fff;
  border-radius: 12px;
  max-width: 600px;
  width: 90%;
  padding: 2rem;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #999;
}

.modal-img {
  width: 100%;
  height: 200px;
  background: var(--gray);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 5rem;
  margin-bottom: 1rem;
}

.modal-nome { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.5rem; }
.modal-categoria { color: var(--primary); font-size: 0.85rem; font-weight: 600; margin-bottom: 0.8rem; }
.modal-descricao { color: #555; line-height: 1.6; margin-bottom: 1rem; }
.modal-preco { font-size: 1.8rem; font-weight: 700; color: var(--primary); margin-bottom: 0.5rem; }
.modal-stock { font-size: 0.85rem; color: #888; margin-bottom: 1.5rem; }

/* TOAST */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--dark);
  color: #fff;
  padding: 0.8rem 1.5rem;
  border-radius: 8px;
  font-size: 0.9rem;
  z-index: 999;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* FOOTER */
footer {
  background: var(--dark);
  color: #aaa;
  text-align: center;
  padding: 2rem;
  margin-top: 4rem;
  font-size: 0.9rem;
}

footer span { color: var(--primary); }

/* SUCESSO */
.sucesso-container {
  text-align: center;
  padding: 5rem 2rem;
  max-width: 600px;
  margin: 0 auto;
}

.sucesso-icon { font-size: 5rem; margin-bottom: 1rem; }
.sucesso-container h1 { font-size: 2rem; margin-bottom: 1rem; }
.sucesso-container p { color: #666; margin-bottom: 2rem; }

/* LOADING */
.loading {
  text-align: center;
  padding: 3rem;
  color: #888;
  font-size: 1rem;
}

@media (max-width: 600px) {
  .hero h1 { font-size: 1.8rem; }
  .nav-links { display: none; }
  .form-row { grid-template-columns: 1fr; }
  .search-bar { width: 100%; }
}
