/* =========================
   Variables & Base Styles
========================= */
:root {
  --color-bg: #f5fbff;
  --color-bg-alt: #eaf5ff;
  --color-text: #0f172a;
  --color-muted: #475569;
  --color-primary: #6293d3;
  --color-primary-600: #0b6def;
  --color-border: #dbeafe;
  --color-card: #ffffff;
  --color-special: hsl(0, 100%, 50%);
  --shadow-card: 0 10px 30px rgba(43,125,233,0.08);
}

body {
  margin: 0;
  font-family: system-ui, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
}

/* =========================
   Layout
========================= */
.layout {
  display: grid;
  grid-template-columns: 200px 1fr 260px;
  min-height: 100vh;
  gap: 1rem;
}

/* =========================
   Sidebar
========================= */
.sidebar,
.promo {
  padding: 1rem;
  border-radius: 8px;
}

.sidebar h2 {
  font-size: 1rem;
  margin-bottom: 1rem;
}

.sidebar ul {
  list-style: none;
  padding: 0;
}

.sidebar li {
  margin: 1rem 0;
}

.sidebar a {
  color: var(--color-text);
  text-decoration: none;
  transition: color 0.3s ease;
}

.sidebar a:hover,
.sidebar a:focus {
  color: var(--color-special);
}

.sidebar a:visited {
  color: var(--color-muted);
}

/* =========================
   Cart Button
========================= */
.cart-button {
  position: relative;
}

.cart-button:disabled {
  background-color: #ccc;
  cursor: not-allowed;
  opacity: 0.6;
}

.cart-count {
  color: red;
}

/* =========================
   Promo Section
========================= */
.promo-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.animation-promo {
  margin: 1rem 0;
  padding: 1rem;
  text-align: center;
  opacity: 0.8;
  animation: promoPulse 4s linear infinite alternate;
}

@keyframes promoPulse {
  0% { transform: scale(0.95); opacity: 1; }
  50% { transform: scale(1.0); opacity: 0.9; }
  100% { transform: scale(1.05); opacity: 1; }
}

/* Seasonal banners */
.banner-winter { background: linear-gradient(to right, #74ebd5, #ACB6E5); }
.banner-spring { background: linear-gradient(to right, #a8e063, #56ab2f); }
.banner-shipping { background: linear-gradient(to right, #43cea2, #185a9d); }
.banner-sale { background: linear-gradient(to right, #ff4b1f, #ff9068); }
.banner-promo { background: linear-gradient(to right, #ff4b1f, #ff9068); }
.banner-new-arrivals { background: linear-gradient(to right, #b0624e, #0dad33); }

/* =========================
   Main Section
========================= */
.main > * {
  display: none;
}
.main > .active {
  display: block;
}

/* =========================
   Search Box
========================= */
.search-box {
  position: relative;
  width: 100%;
}

.search-box input {
  width: 90%;
  padding: 10px 10px 10px 35px;
  border: 1px solid var(--color-border);
  border-radius: 20px;
  font-size: 14px;
}

.search-box i {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-primary-600);
  font-size: 20px;
}

/* =========================
   Product Grid & Cards
========================= */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.5rem;
  align-items: start;
}

.product-card {
  background: var(--color-card);
  padding: 1rem;
  border-radius: 8px;
  box-shadow: var(--shadow-card);
  border: 2px dashed var(--color-primary-600);
  text-align: center;
  transition: transform 0.3s ease, background 0.3s ease;
}

.product-card img {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  background-color: #0f172a;
}

.product-card h2 {
  margin: 0.5rem 0;
}

.product-card p {
  margin: 0.5rem 0;
  color: var(--color-primary-600);
}

.product-card button {
  padding: 0.5rem 1rem;
  background: var(--color-primary-600);
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.product-card:hover {
  transform: translateY(-5px);
  background: linear-gradient(to bottom, var(--color-primary-600), var(--color-primary));
  color: #fff;
}

/* =========================
   Shopping Cart
========================= */
.shopping-cart {
  max-width: 600px;
  margin: 2rem auto;
  padding: 1.5rem;
  background-color: var(--color-card);
  border: 2px solid var(--color-border);
  border-radius: 8px;
  box-shadow: var(--shadow-card);
}

.shopping-cart h2 {
  margin-top: 0;
  color: var(--color-primary-600);
  text-align: center;
}

.cart-item {
  padding: 10px;
  border-bottom: 1px solid #ddd;
}
.cart-button {
  display: block;
  margin: 1rem auto;
  padding: 0.5rem 1rem;
  background: var(--color-primary-600);
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}
.cart-button:hover {
  background: var(--color-primary);
}
.cart-item img {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: 4px;
  margin-right: 10px;
}

/* =========================
   Product Card
========================= */
.product-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background-color: var(--color-card);
  border: 2px solid var(--color-border);
  border-radius: 8px;
  box-shadow: var(--shadow-card);
  transition: transform 0.3s ease-in-out;
}

/* =========================
   Pagination
========================= */
.pagination {
  display: flex;
  justify-content: space-between;
  margin: 20px 0;
}

.pagination button {
  padding: 8px 16px;
  color: var(--color-text);
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.pagination button:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.pagination button:not(:disabled):hover {
  background: var(--color-primary-600);
  color: #fff;
}

/* =========================
   Forms (Login/Register)
========================= */
form {
  max-width: 400px;
  margin: 20px auto;
  padding: 20px;
  background: var(--color-card);
  border-radius: 8px;
  box-shadow: var(--shadow-card);
}

form h3 {
  text-align: center;
  color: var(--color-primary-600);
  margin-bottom: 20px;
}

form a {
  display: block;
  text-align: center;
  margin-top: 10px;
  color: var(--color-primary-600);
  text-decoration: none;
}

form a:hover {
  text-decoration: underline;
}

form span a {
  color: red;
  text-decoration: none;
  font-size: 0.8em;
}

form span a:hover {
  text-decoration: underline;
}

form label {
  display: block;
  margin-bottom: 6px;
  font-weight: bold;
  color: var(--color-text);
}

form input,
form textarea,
form select {
  width: 90%;
  padding: 10px;
  margin-bottom: 15px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  transition: border 0.3s;
}

form input:focus,
form textarea:focus,
form select:focus {
  border-color: var(--color-primary-600);
  outline: none;
}

form button {
  width: 100%;
  padding: 12px;
  background: var(--color-primary-600);
  color: #fff;
  border: none;
  margin-top: 20px;
  border-radius: 4px;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.3s, transform 0.2s;
}

form button:hover {
  background: var(--color-primary);
  transform: scale(1.02);
}

/* =========================
   Footer
========================= */
footer {
  display: none;
}

/* =========================
   Responsive Design
========================= */

/* Tablet (≤1024px) */
@media (max-width: 1024px) {
  .layout {
    grid-template-columns: 180px 1fr;
  }

  .promo {
    display: none;
  }

  footer {
    display: block;
    background: var(--color-primary-600);
    color: #fff;
    padding: 0.5rem 1rem;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
  }

  .footer.navbar ul {
    display: flex;
    justify-content: space-between;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
  }

  .footer.navbar li {
    flex: 1;
    text-align: center;
  }

  .footer.navbar a {
    color: #fff;
    text-decoration: none;
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: color 0.3s ease;
  }

  .footer.navbar a i {
    font-size: 1rem;
    margin-bottom: 0.2rem;
  }

  .footer.navbar a:hover,
  .footer.navbar a:focus {
    color: var(--color-special);
  }
}

/* Mobile (≤768px) */
@media (max-width: 768px) {
  .layout {
    padding: 10px;
    margin: 10px;
    grid-template-columns: 1fr;
    grid-template-areas:
      "main"
      "promo";
  }

  .sidebar {
    display: none;
  }

  .promo {
    display: block;
  }

  .search-box {
    width: 95%;
  }

  .footer.navbar ul {
    flex-direction: row;
    justify-content: space-between;
  }

  .footer.navbar a {
    font-size: 0.7rem;
  }

  .footer.navbar a i {
    font-size: 0.8rem;
  }
}

/* Small Mobile (≤480px) */
@media (max-width: 480px) {
  .search-box input {
    font-size: 12px;
  }

  .search-box {
    width: 93%;
  }

  .product-card {
    padding: 0.5rem;
  }

  .product-card img {
    width: 100%;
    height: 200px;
  }

  .product-card h2 {
    font-size: 14px;
  }

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

  .product-card button {
    font-size: 12px;
    padding: 0.3rem 0.6rem;
  }

  .footer.navbar ul {
    flex-direction: row;
  }
}
