* {
  box-sizing: border-box;
}

body {
  font-family: "Inter", Arial, sans-serif;
  margin: 0;
  padding: 0;
  background: #f9f9f9;
  color: #222;
  min-height: 100vh;
  font-size: 16px;
}

/* ==================== HEADER ==================== */
header {
  background: #222;
  color: #fff;
  padding: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

header h1 {
  margin: 0;
  font-size: 1.5rem;
}

header h1 a {
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  letter-spacing: 1px;
}

header nav {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

header nav a {
  color: #fff;
  text-decoration: none;
  font-size: 0.95rem;
  opacity: 0.85;
  transition: opacity 0.2s;
}

header nav a:hover {
  opacity: 1;
}

/* Hamburger Menu */
.menu-toggle {
  display: none;
  flex-direction: column;
  background: transparent;
  border: none;
  cursor: pointer;
  gap: 0.4rem;
  padding: 0.5rem;
}

.menu-toggle span {
  width: 25px;
  height: 3px;
  background: #fff;
  border-radius: 2px;
  transition: all 0.3s ease;
}

.menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(8px, 8px);
}

.menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -7px);
}

/* ==================== FOOTER ==================== */
footer {
  background: #222;
  color: #fff;
  padding: 2rem 1.5rem;
  text-align: center;
  font-size: 0.9rem;
  margin-top: auto;
}

/* ==================== MAIN CONTENT ==================== */
main {
  padding: 2rem 1rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  min-height: 60vh;
}

/* ==================== FORMS ==================== */
form input,
form select,
form textarea {
  padding: 0.7rem;
  margin-bottom: 1rem;
  width: 100%;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
  background: #fafbfc;
  transition: border 0.2s;
  font-family: inherit;
}

form input:focus,
form select:focus,
form textarea:focus {
  border: 1.5px solid #007bff;
  outline: none;
}

/* ==================== BUTTONS ==================== */
button,
input[type="submit"],
.button {
  display: inline-block;
  padding: 0.7rem 1.2rem;
  margin: 0.5rem 0.5rem 0.5rem 0;
  border-radius: 5px;
  border: none;
  background: #007bff;
  color: #fff;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.2s;
  text-decoration: none;
  text-align: center;
}

button:hover,
input[type="submit"]:hover,
.button:hover {
  background: #0056b3;
}

button:active,
input[type="submit"]:active {
  transform: scale(0.98);
}

/* ==================== LINKS ==================== */
a {
  color: #007bff;
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: #0056b3;
  text-decoration: underline;
}

/* ==================== TABLES ==================== */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

table thead {
  background: #f5f5f5;
}

th,
td {
  padding: 0.75rem;
  text-align: left;
  border: 1px solid #eee;
}

th {
  font-weight: 600;
  background: #f5f5f5;
}

tbody tr:hover {
  background: #fafbfc;
}

/* ==================== PRODUCTS GRID ==================== */
.products {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.product {
  background: #fff;
  border-radius: 10px;
  border: 1px solid #eee;
  padding: 1.2rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  transition:
    box-shadow 0.2s,
    transform 0.2s;
  display: flex;
  flex-direction: column;
}

.product:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.product img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  margin-bottom: 0.5rem;
}

.product h3 {
  margin: 0.5rem 0;
  font-size: 0.95rem;
}

.product p {
  font-size: 0.9rem;
  color: #666;
  margin: 0;
}

.product .price {
  font-size: 1.2rem;
  font-weight: 600;
  color: #007bff;
  margin: 0.5rem 0;
}

.product button {
  margin-top: auto;
  width: 100%;
}

/* ==================== CARDS ==================== */
.card {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.center {
  text-align: center;
}

.center .button {
  display: block;
  margin: 0.5rem auto;
}

/* ==================== LISTS ==================== */
ul,
ol {
  margin: 1rem 0;
  padding-left: 1.5rem;
}

li {
  margin-bottom: 0.5rem;
}

/* ==================== CART & CHECKOUT ==================== */
.cart-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.cart-actions .button {
  flex: 1;
  min-width: 150px;
  margin: 0;
}

/* ==================== HR ==================== */
hr {
  border: none;
  border-top: 1px solid #eee;
  margin: 1.5rem 0;
}

/* ==================== ERROR/SUCCESS MESSAGES ==================== */
.error {
  color: #dc3545;
  background: #f8d7da;
  padding: 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
  border-left: 4px solid #dc3545;
}

.success {
  color: #155724;
  background: #d4edda;
  padding: 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
  border-left: 4px solid #28a745;
}

/* ==================== MEDIA QUERIES ==================== */

/* Tablet (768px and below) */
@media (max-width: 768px) {
  .header-container {
    padding: 1rem;
  }

  header h1 {
    font-size: 1.2rem;
  }

  .menu-toggle {
    display: flex;
  }

  header nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: #1a1a1a;
    padding: 1rem;
    gap: 0;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  }

  header nav.active {
    display: flex;
  }

  header nav a {
    padding: 0.75rem 0;
    border-bottom: 1px solid #333;
  }

  header nav a:last-child {
    border-bottom: none;
  }

  main {
    padding: 1.5rem 1rem;
  }

  .products {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
  }

  .card {
    padding: 1.2rem;
  }

  table {
    font-size: 0.9rem;
  }

  th,
  td {
    padding: 0.5rem;
  }

  form input,
  form select,
  form textarea {
    font-size: 16px; /* Prevents zoom on iOS */
  }
}

/* Mobile (480px and below) */
@media (max-width: 480px) {
  body {
    font-size: 14px;
  }

  .header-container {
    padding: 0.75rem;
  }

  header h1 {
    font-size: 1rem;
  }

  header h1 a {
    letter-spacing: 0;
  }

  main {
    padding: 1rem 0.75rem;
  }

  .products {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.75rem;
  }

  .product {
    padding: 0.75rem;
  }

  .product h3 {
    font-size: 0.85rem;
  }

  .product p {
    font-size: 0.8rem;
  }

  .card {
    padding: 1rem;
  }

  .card h2 {
    font-size: 1.3rem;
  }

  button,
  input[type="submit"],
  .button {
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    width: 100%;
  }

  table {
    font-size: 0.85rem;
    overflow-x: auto;
    display: block;
  }

  table thead {
    display: none;
  }

  table tbody,
  table tr,
  table td {
    display: block;
    width: 100%;
  }

  table tr {
    margin-bottom: 1rem;
    border: 1px solid #eee;
  }

  table td {
    padding: 0.5rem;
    padding-left: 40%;
    position: relative;
    text-align: left;
  }

  table td::before {
    content: attr(data-label);
    position: absolute;
    left: 0.5rem;
    font-weight: 600;
    width: 35%;
  }

  form input,
  form select,
  form textarea {
    margin-bottom: 0.75rem;
  }

  ul,
  ol {
    padding-left: 1rem;
  }

  li {
    margin-bottom: 0.25rem;
  }
}

/* Extra small (360px and below) */
@media (max-width: 360px) {
  body {
    font-size: 13px;
  }

  header h1 {
    font-size: 0.9rem;
  }

  main {
    padding: 0.75rem 0.5rem;
  }

  .products {
    grid-template-columns: repeat(2, 1fr);
  }

  .product {
    padding: 0.5rem;
  }

  button,
  input[type="submit"],
  .button {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
  }
}
