* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: Arial, sans-serif;
}

body {
  background-color: #f4f4f4;
  color: #333;
}

header {
  background-color: #222;
}

.header-top {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 15px 30px;
}

.logo {
  color: white;
  font-size: 24px;
  font-weight: bold;
  white-space: nowrap;
}

.search-bar {
  flex: 1;
  display: flex;
}

.search-bar input {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 3px 0 0 3px;
  font-size: 14px;
}

.search-bar button {
  padding: 10px 20px;
  background-color: #ff9900;
  color: white;
  border: none;
  border-radius: 0 3px 3px 0;
  cursor: pointer;
}

nav {
  white-space: nowrap;
}

nav a {
  color: white;
  text-decoration: none;
  margin-left: 20px;
  font-size: 16px;
}

nav a:hover {
  color: #ff9900;
}

footer {
  background-color: #222;
  color: white;
  margin-top: 40px;
}

.footer-columns {
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
  padding: 40px 30px;
  gap: 20px;
}

.footer-col h4 {
  margin-bottom: 15px;
  color: #ccc;
  font-size: 14px;
}

.footer-col a {
  display: block;
  color: white;
  text-decoration: none;
  margin-bottom: 10px;
  font-size: 14px;
}

.footer-col a:hover {
  color: #ff9900;
}

.footer-bottom {
  text-align: center;
  padding: 15px;
  border-top: 1px solid #444;
  font-size: 14px;
}

main {
  padding: 30px;
}

main h1 {
  margin-bottom: 20px;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

.product-card {
  background-color: white;
  border-radius: 8px;
  padding: 15px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  text-align: center;
}

.product-card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 5px;
}

.product-card h3 {
  margin: 10px 0 5px;
}

.product-card p {
  color: #666;
  font-size: 14px;
  margin-bottom: 10px;
}

.product-card .price {
  font-weight: bold;
  color: #222;
  font-size: 18px;
}

.product-card button {
  margin-top: 10px;
  padding: 8px 16px;
  background-color: #ff9900;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}

.product-card button:hover {
  background-color: #e68a00;
}

.auth-box {
  max-width: 350px;
  margin: 50px auto;
  background-color: white;
  padding: 30px;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  text-align: center;
}

.auth-box input {
  width: 100%;
  padding: 10px;
  margin-bottom: 15px;
  border: 1px solid #ccc;
  border-radius: 5px;
  font-size: 14px;
}

.auth-box button {
  width: 100%;
  padding: 10px;
  background-color: #ff9900;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 16px;
}

.auth-box button:hover {
  background-color: #e68a00;
}

#toggle-text {
  margin-top: 15px;
  font-size: 14px;
}

#toggle-text a {
  color: #ff9900;
  text-decoration: none;
}

.cart-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: white;
  padding: 15px;
  margin-bottom: 10px;
  border-radius: 5px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

#checkout-btn {
  margin-top: 20px;
  padding: 10px 20px;
  background-color: #ff9900;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 16px;
}

#checkout-btn:hover {
  background-color: #e68a00;
}

.product-details {
  display: flex;
  gap: 30px;
  background-color: white;
  padding: 30px;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  max-width: 800px;
}

.product-details img {
  width: 300px;
  height: 300px;
  object-fit: cover;
  border-radius: 5px;
}

.product-info {
  flex: 1;
}

.product-info h1 {
  margin-bottom: 10px;
}

.product-info p {
  color: #666;
  margin-bottom: 10px;
}

.product-info .price {
  font-size: 24px;
  font-weight: bold;
  color: #222;
  margin-bottom: 15px;
}

.product-info button {
  padding: 10px 20px;
  background-color: #ff9900;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 16px;
}

.product-info button:hover {
  background-color: #e68a00;
}

/* header: user name + cart count */
.nav-user {
  color: #ff9900;
  margin-left: 20px;
  font-size: 16px;
}

.cart-count {
  display: inline-block;
  background-color: #ff9900;
  color: white;
  font-size: 12px;
  font-weight: bold;
  min-width: 18px;
  padding: 1px 6px;
  margin-left: 5px;
  border-radius: 10px;
  text-align: center;
}

/* tablet + mobile */
@media (max-width: 768px) {
  .header-top {
    flex-wrap: wrap;
    padding: 12px 15px;
    gap: 10px;
  }

  .logo {
    order: 1;
    font-size: 20px;
  }

  nav {
    order: 2;
    margin-left: auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
  }

  nav a,
  .nav-user {
    margin-left: 0;
    font-size: 14px;
  }

  .search-bar {
    order: 3;
    flex: 1 1 100%;
  }
}

/* phone */
@media (max-width: 600px) {
  main {
    padding: 15px;
  }

  main h1 {
    font-size: 22px;
    margin-bottom: 15px;
  }

  .product-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .product-card {
    padding: 10px;
  }

  .product-card img {
    height: 130px;
  }

  .product-card h3 {
    font-size: 15px;
  }

  .product-card p {
    font-size: 12px;
  }

  .product-card .price {
    font-size: 16px;
  }

  .product-card button {
    width: 100%;
  }

  .product-details {
    flex-direction: column;
    padding: 15px;
    gap: 15px;
  }

  .product-details img {
    width: 100%;
    height: 250px;
  }

  .cart-item {
    flex-wrap: wrap;
    gap: 8px;
  }

  #checkout-btn {
    width: 100%;
  }

  .auth-box {
    margin: 20px auto;
    padding: 20px;
  }

  .footer-columns {
    justify-content: flex-start;
    padding: 25px 15px;
  }

  .footer-col {
    width: calc(50% - 10px);
  }
}