/* Bakes by S - Sweet Treats Modern Design (Purple & Black theme) */
/*
  Product listing styles. Cards show a price badge, image and content.
  Quantity controls sit beside an add to bag button for quick actions.
  Grid adapts to different screen sizes using auto-fit.
*/

/* Theme variables */
:root {
  --bg: #0f0f12;
  --surface: #1a1a1f;
  --card-bg: #1e1e24;
  --text: #f7f7f9;
  --text-muted: #a8a8b3;
  --border: #2a2a30;
  --pink: #ff4da6;
  --pink-hover: #e63d94;
  --pink-light: rgba(255, 77, 166, 0.1);
  --radius: 16px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* Base styles */
html, body { 
  margin: 0; 
  padding: 0; 
  box-sizing: border-box;
}

*, *::before, *::after {
  box-sizing: inherit;
}

body {
  font-family: 'Poppins', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.6;
}

img { 
  display: block; 
  max-width: 100%; 
  height: auto;
}

main { 
  flex: 1; 
}

.container { 
  max-width: 1200px; 
  margin: 0 auto; 
  padding: 0 24px; 
}

.hero { 
  padding: 40px 0 32px; 
  text-align: center;
}

.hero h1 { 
  margin: 0 0 16px; 
  font-size: clamp(2rem, 4vw, 3rem); 
  font-weight: 700;
  background: linear-gradient(135deg, var(--text), var(--pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p { 
  margin: 0 0 32px; 
  color: var(--text-muted); 
  font-size: 1.1rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}


/* Products Section */
/* Wrapper for the products area with comfortable spacing. */
.products {
  padding: 24px 0 60px;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-top: 32px;
}
/* Auto-fit grid creates responsive columns without media queries. */

/* Product Cards */
/* Each card uses a dark background, subtle border and shadow for depth. */
.product-card {
  position: relative;
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

/* Price Badge */
.price-badge {
  position: absolute;
  top: 16px;
  left: 16px;
  background: var(--pink);
  color: #1a1a1a;
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.9rem;
  z-index: 2;
  box-shadow: 0 2px 10px rgba(255, 77, 166, 0.3);
}

/* Product Image */
.product-image {
  position: relative;
  height: 220px;
  overflow: hidden;
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.product-card:hover .product-image img {
  transform: scale(1.05);
}

/* Product Content */
.product-content {
  padding: 20px;
}

.product-content h3 {
  margin: 0 0 8px;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
}

.product-content p {
  margin: 0 0 20px;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

/* Product Controls */
.product-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* Quantity Control */
/* Container for the quantity label, buttons and number input. */
.quantity-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.quantity-control label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
}

.qty-wrapper {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.qty-btn {
  background: none;
  border: none;
  color: var(--text);
  padding: 8px 12px;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 600;
  transition: background-color 0.2s ease;
  user-select: none;
}

.qty-btn:hover {
  background: var(--pink-light);
  color: var(--pink);
}

.qty-input {
  background: none;
  border: none;
  color: var(--text);
  text-align: center;
  width: 50px;
  padding: 8px 4px;
  font-size: 0.95rem;
  font-weight: 600;
  outline: none;
}

.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Add to Cart Button */
/* Pink button with a cart icon. Hover adds a gentle lift effect. */
.add-to-bag-btn {
  background: var(--pink);
  border: none;
  color: #1a1a1a;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: all 0.3s ease;
  box-shadow: 0 2px 10px rgba(255, 77, 166, 0.3);
}

.add-to-bag-btn:hover {
  background: var(--pink-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(255, 77, 166, 0.4);
}

.add-to-bag-btn:active {
  transform: translateY(0);
}


/* Responsive Design */
/* Tablet adjustments: reduce padding and tighten grid spacing. */
@media (max-width: 768px) {
  .container {
    padding: 0 16px;
  }
  
  .hero {
    padding: 24px 0;
  }
  
  .hero h1 {
    font-size: 2rem;
  }
  
  .hero p {
    font-size: 1rem;
    margin-bottom: 24px;
  }
  
  
  .products-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin-top: 24px;
  }
  
  .product-content {
    padding: 16px;
  }
  
  .product-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  
  .quantity-control {
    justify-content: center;
  }
  
  .add-to-bag-btn {
    width: 100%;
    height: 44px;
  }
}

@media (max-width: 480px) {
  .products-grid {
    grid-template-columns: 1fr;
  }
}