@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap');

:root {
  --primary: #6c63ff;
  --accent: #ff6ec7;
  --bg: #f6f8ff;
  --text: #222;
  --card: #ffffffcc;
  --shadow: rgba(0,0,0,0.1);
}

[data-theme="dark"] {
  --primary: #8b80ff;
  --accent: #ff4081;
  --bg: #0f0f11;
  --text: #f4f4f4;
  --card: #1a1a1acc;
  --shadow: rgba(255,255,255,0.05);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Poppins", sans-serif;
  transition: all 0.3s ease;
}

body {
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  backdrop-filter: blur(12px);
  background: var(--card);
  border-bottom: 1px solid var(--shadow);
  padding: 1rem 2rem;
  box-shadow: 0 4px 15px var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
  animation: fadeSlideDown 0.6s ease;
}

@keyframes fadeSlideDown {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

h1 {
  font-size: 1.8rem;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 700;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

#theme-toggle {
  font-size: 1.4rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text);
  transition: transform 0.3s ease;
}
#theme-toggle:hover {
  transform: rotate(30deg);
}

#cart-btn {
  cursor: pointer;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  padding: 0.6rem 1.2rem;
  border-radius: 30px;
  font-weight: 600;
  box-shadow: 0 5px 20px var(--shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
#cart-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 8px 25px var(--accent);
}

/* Hero Section */
.hero {
  text-align: center;
  padding: 3rem 1rem;
  animation: fadeUp 0.8s ease;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}
.hero h2 { font-size: 2.2rem; color: var(--primary); font-weight: 700; }
.hero p { max-width: 600px; margin: 1rem auto; color: var(--text); }

/* Product Grid */
.products {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 2rem;
  padding: 2rem;
}

.product-card {
  background: var(--card);
  border-radius: 20px;
  box-shadow: 0 8px 25px var(--shadow);
  text-align: center;
  padding: 1.5rem;
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
  position: relative;
}
.product-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 12px 30px var(--accent);
}
.product-card img {
  width: 100%;
  border-radius: 15px;
  margin-bottom: 1rem;
  transition: transform 0.4s ease;
}
.product-card:hover img {
  transform: scale(1.05);
}
.price {
  color: var(--accent);
  font-weight: bold;
  font-size: 1.2rem;
  margin-bottom: 0.6rem;
}
.add-to-cart {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 25px;
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}
.add-to-cart:hover {
  transform: scale(1.1);
  box-shadow: 0 5px 15px var(--accent);
}

/* Cart Sidebar */
#cart-sidebar {
  position: fixed;
  top: 0;
  right: -400px;
  width: 350px;
  height: 100%;
  background: var(--card);
  box-shadow: -10px 0 25px rgba(0, 0, 0, 0.15);
  padding: 2rem;
  transition: right 0.4s ease;
  z-index: 200;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  animation: slideLeft 0.5s ease;
}
#cart-sidebar.active { right: 0; }
@keyframes slideLeft {
  from { right: -400px; opacity: 0; }
  to { right: 0; opacity: 1; }
}
#cart-items {
  list-style: none;
  flex-grow: 1;
  overflow-y: auto;
  margin-bottom: 1rem;
}
#cart-items li {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid #ddd;
  color: var(--text);
}
.cart-total { font-size: 1.2rem; margin-bottom: 1rem; }
#checkout-btn {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border: none;
  padding: 0.7rem;
  border-radius: 25px;
  color: white;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 0.5rem;
  box-shadow: 0 3px 10px var(--accent);
}
#checkout-btn:hover {
  transform: scale(1.05);
}
#close-cart {
  background: transparent;
  border: 1px solid var(--primary);
  padding: 0.5rem;
  border-radius: 25px;
  cursor: pointer;
  color: var(--text);
}

/* Overlay */
#overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.4);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease;
  z-index: 150;
}
#overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Checkout Modal */
#checkout-modal {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 300;
}
#checkout-modal.active { display: flex; }
.checkout-content {
  background: var(--card);
  padding: 2rem;
  border-radius: 20px;
  width: 90%;
  max-width: 400px;
  text-align: center;
  box-shadow: 0 10px 30px var(--shadow);
  animation: fadeUp 0.5s ease;
}
.checkout-content form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}
.checkout-content input {
  padding: 0.8rem;
  border-radius: 10px;
  border: 1px solid #ccc;
  background: var(--bg);
  color: var(--text);
}
.checkout-content button {
  padding: 0.7rem;
  border: none;
  border-radius: 25px;
  font-weight: 600;
  cursor: pointer;
}
.checkout-content button[type="submit"] {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  box-shadow: 0 5px 20px var(--accent);
}
.checkout-content button[type="button"] {
  background: transparent;
  border: 1px solid var(--primary);
  color: var(--primary);
}

footer {
  text-align: center;
  padding: 1rem;
  margin-top: 3rem;
  color: var(--text);
  backdrop-filter: blur(10px);
  background: var(--card);
  border-top: 1px solid var(--shadow);
}
.price {
    font-size: 18px;
    margin: 8px 0;
    font-weight: 600;
    display: flex;
    gap: 10px;
    align-items: center;
}

.new-price {
    color: #27ae60;       /* green fresh price */
    font-size: 20px;
    font-weight: 700;
}

.old-price {
    text-decoration: line-through;
    color: #888;
    font-size: 16px;
}
