/* Reset básico */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #f9f9f9;
  color: #333;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  background: #0d6efd;
  color: white;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

header h1 {
  font-size: 1.8rem;
}

header nav button {
  background: #ffc107;
  border: none;
  padding: 0.5rem 1rem;
  font-weight: 700;
  cursor: pointer;
  border-radius: 5px;
  transition: background-color 0.3s ease;
}

header nav button:hover {
  background: #e0a800;
}

main {
  flex: 1;
  padding: 2rem;
  max-width: 1000px;
  margin: 0 auto;
  width: 100%;
}

.products {
  display: grid;
  gap: 2rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.product {
  background: white;
  padding: 1rem;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.product img {
  width: 180px;
  height: 150px;
  object-fit: contain;
  margin-bottom: 1rem;
}

.product h2 {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}

.price {
  font-weight: 700;
  color: #0d6efd;
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

.btn-buy {
  background: #0d6efd;
  color: white;
  border: none;
  padding: 0.6rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: background-color 0.3s ease;
}

.btn-buy:hover {
  background: #0846c5;
}

/* Modal carrinho e checkout */
aside {
  position: fixed;
  top: 0;
  right: 0;
  width: 320px;
  max-width: 100%;
  height: 100vh;
  background: white;
  box-shadow: -4px 0 8px rgb(0 0 0 / 0.1);
  padding: 1.5rem 1rem;
  overflow-y: auto;
  z-index: 1000;
  display: flex;
  flex-direction: column;
}

.hidden {
  display: none !important;
}

#cart-modal h2,
#checkout-modal h2 {
  margin-bottom: 1rem;
  font-size: 1.4rem;
}

#btn-close-cart,
#btn-close-checkout {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 2rem;
  background: none;
  border: none;
  cursor: pointer;
  color: #888;
  transition: color 0.2s ease;
}

#btn-close-cart:hover,
#btn-close-checkout:hover {
  color: #000;
}

#cart-items {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 1rem;
}

.cart-item {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.7rem;
  align-items: center;
}

.cart-item span {
  flex: 1;
}

.cart-item-quantity {
  width: 50px;
  text-align: center;
}

.cart-item-remove {
  background: transparent;
  border: none;
  color: #dc3545;
  font-weight: 700;
  cursor: pointer;
  margin-left: 8px;
}

#cart-total {
  font-weight: 700;
  font-size: 1.2rem;
  margin-bottom: 1rem;
  color: #0d6efd;
}

#btn-checkout {
  background: #198754;
  color: white;
  border: none;
  padding: 0.7rem;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

#btn-checkout:disabled {
  background: #a5d6a7;
  cursor: not-allowed;
}

#btn-checkout:hover:not(:disabled) {
  background: #145c32;
}

/* Formulário checkout */
form {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

form label {
  font-weight: 600;
}

form input,
form textarea,
form select {
  padding: 0.5rem;
  border-radius: 5px;
  border: 1px solid #ccc;
  font-size: 1rem;
  resize: vertical;
}

form button[type="submit"] {
  margin-top: 1rem;
  background: #0d6efd;
  color: white;
  padding: 0.7rem;
  font-weight: 700;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

form button[type="submit"]:hover {
  background: #0846c5;
}

/* Footer */
footer {
  background: #0d6efd;
  color: white;
  text-align: center;
  padding: 1rem 0;
  margin-top: auto;
}

/* Responsividade */
@media (max-width: 640px) {
  aside {
    width: 100%;
  }

  .products {
    grid-template-columns: 1fr;
  }
}
