:root {
  /* Color Variables */
  --primary-color: #007bff;
  --primary-hover: #0069d9;
  --success-color: #28a745;
  --danger-color: #dc3545;
  --text-dark: #333;
  --text-medium: #555;
  --text-light: #6c757d;
  --border-color: #ced4da;
  --light-bg: #f8f9fa;
  --light-hover: #e9ecef;
  --shadow-sm: 0 4px 15px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 10px 20px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 5px 25px rgba(0, 0, 0, 0.2);
  
  /* Spacing Variables */
  --space-xs: 5px;
  --space-sm: 10px;
  --space-md: 15px;
  --space-lg: 20px;
  --space-xl: 30px;
  --space-xxl: 40px;
  
  /* Typography */
  --font-heading: 'Playfair Display', serif;
  --font-body: 'Open Sans', sans-serif;
}

/* Base Reset */
* {
  box-sizing: border-box;
}

/* Product Grid Layout */
.product-grid {
  padding: var(--space-xxl) 0;
}

.section-title {
  text-align: center;
  font-family: 'Garde', 'Open Sans', sans-serif;
  font-size: 2.5rem;
  margin-bottom: var(--space-xxl);
  color: var(--text-dark);
  position: relative;
}

.section-title::after {
  content: '';
  display: block;
  width: 80px;
  height: 3px;
  background-color: var(--text-light);
  margin: var(--space-md) auto 0;
}

.products-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-xl);
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

/* Product Tile */
.product-tile {
  background-color: white;
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
}

.product-tile:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-md);
}

/* Product Image */
.product-image {
  position: relative;
  height: 240px;
  overflow: hidden;
  background-color: var(--light-bg);
}

.product-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

@media (prefers-reduced-motion: reduce) {
  .product-img {
    transition: none;
  }
}

.product-tile:hover .product-img {
  transform: scale(1.05);
}

.no-image {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
}

.no-image i {
  font-size: 3rem;
  margin-bottom: var(--space-sm);
  opacity: 0.3;
}

/* Badges */
.badge {
  position: absolute;
  padding: var(--space-xs) 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  z-index: 1;
}

.badge-new {
  top: var(--space-sm);
  right: var(--space-sm);
  background-color: var(--success-color);
  color: white;
}

.badge-discount {
  top: var(--space-sm);
  left: var(--space-sm);
  background-color: var(--danger-color);
  color: white;
}

/* Product Info */
.product-info {
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.product-title {
  font-family: var(--font-body);
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-dark);
  line-height: 1.3;
}

.product-code {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 12px;
}

.product-description {
  font-size: 0.95rem;
  color: var(--text-medium);
  line-height: 1.5;
  margin-bottom: var(--space-md);
  flex-grow: 1;
}

/* Product Price */
.product-price {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.original-price {
  font-size: 1rem;
  color: var(--text-light);
  text-decoration: line-through;
}

.sale-price {
  color: var(--danger-color);
}

/* Buttons */
.view-details, 
.add-to-cart {
  padding: var(--space-sm) var(--space-md);
  border: none;
  border-radius: 5px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background-color 0.3s, transform 0.2s;
  margin-bottom: var(--space-sm);
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.view-details {
  background-color: var(--light-bg);
  color: #495057;
  border: 1px solid var(--border-color);
}

.view-details:hover,
.view-details:focus {
  background-color: var(--light-hover);
  outline: 2px solid var(--primary-color);
}

.add-to-cart {
  background-color: var(--primary-color);
  color: white;
}

.add-to-cart:hover,
.add-to-cart:focus {
  background-color: var(--primary-hover);
  transform: translateY(-2px);
  outline: 2px solid var(--primary-hover);
}

.add-to-cart:active, 
.view-details:active {
  transform: translateY(1px);
}

/* Product Specs */
.product-specs {
  margin-top: var(--space-md);
  border-top: 1px solid #ebebeb;
  padding-top: var(--space-md);
  display: none;
}

.product-specs h4 {
  font-family: var(--font-body);
  font-size: 1rem;
  margin-bottom: var(--space-sm);
  color: var(--text-dark);
}

.product-specs ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.product-specs li {
  font-size: 0.9rem;
  padding: var(--space-xs) 0;
  border-bottom: 1px dotted #ebebeb;
}

.product-specs li:last-child {
  border-bottom: none;
}

.more-specs a {
  color: var(--primary-color);
  text-decoration: none;
}

.more-specs a:hover {
  text-decoration: underline;
}

/* No Products Message */
.no-products {
  text-align: center;
  padding: 60px var(--space-lg);
  background-color: var(--light-bg);
  border-radius: 10px;
  max-width: 600px;
  margin: 0 auto;
}

.no-products i {
  font-size: 4rem;
  color: var(--text-light);
  margin-bottom: var(--space-lg);
  opacity: 0.3;
}

.no-products h3 {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  margin-bottom: var(--space-sm);
  color: var(--text-dark);
}

.no-products p {
  font-size: 1.1rem;
  color: var(--text-light);
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  inset: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.5);
  animation: fadeIn 0.3s;
}

@media (prefers-reduced-motion: reduce) {
  .modal {
    animation: none;
  }
}

.modal-content {
  background-color: #fff;
  margin: 50px auto;
  padding: 0;
  border-radius: 10px;
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s;
}

.close {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  padding: var(--space-sm) var(--space-lg);
  cursor: pointer;
}

.close:hover,
.close:focus {
  color: var(--text-dark);
}

/* Modal Product */
.modal-product {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-xl);
  padding: var(--space-xl);
}

.modal-image {
  background-color: var(--light-bg);
  border-radius: 8px;
  overflow: hidden;
  height: 400px;
}

.modal-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal-info h2 {
  font-family: var(--font-heading);
  font-size: 2rem;
  margin-bottom: var(--space-sm);
  color: var(--text-dark);
}

.modal-sku {
  color: var(--text-light);
  margin-bottom: var(--space-lg);
  font-size: 0.9rem;
}

.modal-price {
  margin-bottom: var(--space-xl);
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.discount-badge {
  background-color: var(--danger-color);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
}

.modal-description {
  margin-bottom: var(--space-xl);
}

.modal-description h3,
.modal-specs h3 {
  font-family: var(--font-body);
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: var(--space-md);
  color: var(--text-dark);
}

.modal-description p {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-medium);
}

.specs-table {
  width: 100%;
  border-collapse: collapse;
}

.specs-table tr {
  border-bottom: 1px solid #ebebeb;
}

.specs-table tr:last-child {
  border-bottom: none;
}

.specs-table td {
  padding: var(--space-sm) 0;
  font-size: 0.95rem;
}

.specs-table .spec-key {
  font-weight: 600;
  width: 40%;
  color: var(--text-dark);
}

.specs-table .spec-value {
  color: var(--text-medium);
}

/* Quantity Selector */
.modal-actions {
  display: flex;
  gap: var(--space-lg);
  align-items: center;
  margin-top: var(--space-xl);
}

.quantity-selector {
  display: flex;
  align-items: center;
  border: 1px solid var(--border-color);
  border-radius: 5px;
  overflow: hidden;
}

.quantity-selector button {
  background: none;
  border: none;
  padding: var(--space-sm) var(--space-md);
  cursor: pointer;
  font-size: 1.2rem;
  color: #495057;
  transition: background-color 0.2s;
}

.quantity-selector button:hover,
.quantity-selector button:focus {
  background-color: var(--light-bg);
  outline: none;
}

.quantity-selector input {
  border: none;
  width: 60px;
  text-align: center;
  font-size: 1rem;
  padding: var(--space-sm);
  border-inline: 1px solid var(--border-color);
}

/* Remove number input spinners */
.quantity-selector input[type="number"]::-webkit-inner-spin-button,
.quantity-selector input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.quantity-selector input[type="number"] {
  -moz-appearance: textfield;
}

.btn-large {
  padding: 12px 25px;
  font-size: 1rem;
  flex: 1;
}

.btn-success {
  background-color: var(--success-color) !important;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideIn {
  from { 
    transform: translateY(-50px);
    opacity: 0;
  }
  to { 
    transform: translateY(0);
    opacity: 1;
  }
}

/* Notifications */
.notification {
  position: fixed;
  top: var(--space-lg);
  right: var(--space-lg);
  background: white;
  padding: var(--space-md) var(--space-lg);
  border-radius: 8px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  transform: translateX(400px);
  transition: transform 0.3s ease;
  z-index: 2000;
  max-width: 350px;
  font-family: var(--font-body);
}

.notification.show {
  transform: translateX(0);
}

.notification-success {
  border-inline-start: 4px solid var(--success-color);
}

.notification-success i {
  color: var(--success-color);
}

.notification-error {
  border-inline-start: 4px solid var(--danger-color);
}

.notification-error i {
  color: var(--danger-color);
}

.notification-info {
  border-inline-start: 4px solid var(--primary-color);
}

.notification-info i {
  color: var(--primary-color);
}

/* Cart Count Badge */
.cart-count {
  position: absolute;
  top: -8px;
  right: -8px;
  background-color: var(--danger-color);
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
}

/* Cart Button */
.cart-button {
  position: fixed;
  right: var(--space-lg);
  bottom: var(--space-lg);
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: var(--primary-color);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: transform 0.3s, background-color 0.3s;
  z-index: 100;
}

.cart-button:hover,
.cart-button:focus {
  transform: scale(1.1);
  background-color: var(--primary-hover);
  outline: 2px solid white;
}

.cart-button i {
  font-size: 1.5rem;
}

/* Filter and Sort Controls */
.product-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-xl);
  max-width: 1200px;
  margin-inline: auto;
  padding: 0 var(--space-lg);
  gap: var(--space-lg);
}

.product-search {
  position: relative;
  flex: 1;
  max-width: 300px;
}

.product-search input {
  width: 100%;
  padding: var(--space-sm) 40px var(--space-sm) var(--space-md);
  border: 1px solid var(--border-color);
  border-radius: 5px;
  font-family: var(--font-body);
}

.product-search input:focus {
  outline: 2px solid var(--primary-color);
}

.product-search i {
  position: absolute;
  inset-inline-end: var(--space-md);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
}

.product-sort {
  display: flex;
  align-items: center;
}

.product-sort label {
  margin-inline-end: var(--space-sm);
  font-size: 0.9rem;
  color: #495057;
  font-family: var(--font-body);
}

.product-sort select {
  padding: 8px 30px 8px 15px;
  border: 1px solid var(--border-color);
  border-radius: 5px;
  background-color: white;
  cursor: pointer;
  font-family: var(--font-body);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 8 8'%3E%3Cpath fill='%236c757d' d='M0 0l4 4 4-4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 15px center;
  background-size: 8px;
}

.product-sort select:focus {
  outline: 2px solid var(--primary-color);
}

/* Category Filtering */
.category-filter {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.category-filter label {
  font-weight: 600;
  color: var(--text-dark);
  white-space: nowrap;
}

.category-filter select {
  padding: var(--space-sm) 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  background-color: white;
  cursor: pointer;
  min-width: 150px;
}

.category-buttons {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
  justify-content: center;
}

.category-btn {
  padding: var(--space-sm) var(--space-lg);
  border: 2px solid var(--primary-color);
  background-color: white;
  color: var(--primary-color);
  border-radius: 25px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
}

.category-btn:hover,
.category-btn:focus,
.category-btn.active {
  background-color: var(--primary-color);
  color: white;
  outline: none;
}

.product-category,
.modal-category {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  color: #666;
  font-size: 0.75rem;
  margin-bottom: 8px;
}

.modal-category {
  font-size: 0.875rem;
  margin-bottom: var(--space-sm);
}

.product-category i,
.modal-category i {
  font-size: 0.625rem;
}

/* Loading Spinner */
.loading-spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid rgba(255,255,255,.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 1s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .loading-spinner {
    animation: none;
    border-top-color: transparent;
  }
}

/* Responsive Design */
@media (max-width: 992px) {
  .products-container {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
}

@media (max-width: 768px) {
  .section-title {
    font-size: 2rem;
  }
  
  .products-container {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: var(--space-lg);
  }
  
  .product-image {
    height: 200px;
  }
  
  .modal-product {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
    padding: var(--space-lg);
  }
  
  .modal-image {
    height: 250px;
  }
  
  .modal-actions {
    flex-direction: column;
    width: 100%;
  }
  
  .quantity-selector {
    width: 100%;
    justify-content: center;
  }
  
  .btn-large {
    width: 100%;
  }
  
  .notification {
    top: auto;
    bottom: var(--space-lg);
    right: var(--space-sm);
    left: var(--space-sm);
    max-width: none;
  }

  .product-controls {
    flex-direction: column;
    gap: var(--space-md);
  }
  
  .category-filter,
  .product-search,
  .product-sort {
    width: 100%;
  }
  
  .category-buttons {
    justify-content: flex-start;
  }
  
  .category-btn {
    padding: 8px 16px;
    font-size: 14px;
  }
}

@media (max-width: 576px) {
  .products-container {
    grid-template-columns: 1fr;
  }
  
  .section-title {
    font-size: 1.8rem;
  }
  
  .modal-content {
    margin: var(--space-md);
    width: calc(100% - var(--space-md) * 2);
  }
  
  .product-title {
    font-size: 1.1rem;
  }
  
  .product-price {
    font-size: 1.1rem;
  }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  :root {
    --text-dark: #f8f9fa;
    --text-medium: #e9ecef;
    --text-light: #adb5bd;
    --border-color: #495057;
    --light-bg: #343a40;
    --light-hover: #495057;
  }

  .product-tile,
  .modal-content,
  .notification {
    background-color: #212529;
    color: var(--text-medium);
  }

  .product-tile {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  }

  .view-details {
    background-color: #495057;
    color: var(--text-medium);
    border-color: var(--border-color);
  }

  .product-specs,
  .specs-table tr {
    border-color: #495057;
  }
}