:root {
  --primary-color: #4f46e5; /* Indigo */
  --primary-hover: #4338ca;
  --bg-color: #f3f4f6; /* Light Gray */
  --card-bg: rgba(255, 255, 255, 0.85); /* Glassmorphism effect */
  --text-main: #1f2937;
  --text-muted: #6b7280;
  --danger-color: #ef4444;
  --danger-hover: #dc2626;
  --success-color: #10b981;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body {
  background: linear-gradient(135deg, #e0e7ff 0%, #ede9fe 100%);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  position: sticky;
  top: 0;
  z-index: 10;
}

.logo {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary-color);
  text-decoration: none;
  letter-spacing: -0.5px;
}

nav a {
  text-decoration: none;
  color: var(--text-main);
  font-weight: 500;
  margin-left: 1.5rem;
  transition: color 0.2s ease;
  position: relative;
}

nav a:hover {
  color: var(--primary-color);
}

.cart-link {
  position: relative;
}

.cart-count {
  position: absolute;
  top: -8px;
  right: -12px;
  background-color: var(--danger-color);
  color: white;
  font-size: 0.75rem;
  font-weight: bold;
  border-radius: 999px;
  padding: 0.1rem 0.4rem;
  min-width: 20px;
  text-align: center;
  transition: transform 0.2s ease;
}

.cart-count.bounce {
  transform: scale(1.3);
}

main {
  flex: 1;
  padding: 2rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

h1 {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 2rem;
  text-align: center;
  background: -webkit-linear-gradient(45deg, var(--primary-color), #9333ea);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Auth Pages */
.auth-container {
  max-width: 400px;
  margin: 4rem auto;
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  padding: 2rem;
  border-radius: 16px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  font-size: 0.9rem;
}

.form-group input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: rgba(255, 255, 255, 0.9);
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

.btn {
  display: inline-block;
  width: 100%;
  padding: 0.75rem 1.5rem;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
  text-align: center;
}

.btn:hover {
  background-color: var(--primary-hover);
}

.btn:active {
  transform: translateY(1px);
}

.auth-toggle {
  text-align: center;
  margin-top: 1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  cursor: pointer;
}

.auth-toggle:hover {
  color: var(--primary-color);
  text-decoration: underline;
}

/* Products Grid */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 2rem;
}

.product-card {
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.5);
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.15);
}

.product-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.product-info {
  padding: 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.product-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.product-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
  flex: 1;
  margin-bottom: 1rem;
}

.product-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
}

.product-price {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--primary-color);
}

.btn-add {
  padding: 0.5rem 1rem;
  width: auto;
}

/* Cart Page */
.cart-container {
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.5);
}

.cart-item {
  display: flex;
  align-items: center;
  padding: 1rem 0;
  border-bottom: 1px solid #e5e7eb;
}

.cart-item:last-child {
  border-bottom: none;
}

.cart-item-img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  margin-right: 1.5rem;
}

.cart-item-details {
  flex: 1;
}

.cart-item-title {
  font-weight: 700;
  font-size: 1.1rem;
}

.cart-item-price {
  color: var(--primary-color);
  font-weight: 600;
}

.cart-item-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.qty-btn {
  background: #e5e7eb;
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.qty-btn:hover {
  background: #d1d5db;
}

.cart-item-qty {
  font-weight: 600;
  min-width: 20px;
  text-align: center;
}

.btn-remove {
  background-color: transparent;
  color: var(--danger-color);
  border: 1px solid var(--danger-color);
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
  width: auto;
}

.btn-remove:hover {
  background-color: var(--danger-color);
  color: white;
}

.cart-summary {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 2px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cart-total-label {
  font-size: 1.25rem;
  font-weight: 600;
}

.cart-total-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary-color);
}

.empty-cart {
  text-align: center;
  padding: 3rem 0;
  color: var(--text-muted);
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 50;
}

.toast {
  background: var(--text-main);
  color: white;
  padding: 1rem 1.5rem;
  border-radius: 8px;
  margin-top: 0.5rem;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  opacity: 0;
  transform: translateY(20px);
  animation: toastIn 0.3s forwards, toastOut 0.3s 3s forwards;
}

@keyframes toastIn {
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toastOut {
  to { opacity: 0; transform: translateY(-20px); }
}

@media (max-width: 768px) {
  .cart-item {
    flex-direction: column;
    align-items: flex-start;
  }
  .cart-item-img {
    margin-bottom: 1rem;
  }
  .cart-item-actions {
    margin-top: 1rem;
    width: 100%;
    justify-content: space-between;
  }
}
