/* ============================================
   Shop & Product – Al Majd eCommerce
   Uses existing brand colors (--primary, --cream, etc.)
   ============================================ */

/* --- Shop Hero --- */
.shop-hero {
  padding: 2rem 0 2.5rem;
  background: var(--cream-warm);
  border-bottom: 1px solid var(--gray-200);
}

.shop-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
  color: var(--gray-900);
  margin: 0 0 0.5rem;
  letter-spacing: var(--letter-spacing-tight);
}

.shop-subtitle {
  color: var(--gray-600);
  margin: 0 0 1.5rem;
  font-size: 0.95rem;
}

.shop-search-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: 420px;
  padding: 0.75rem 1rem;
  background: var(--cream);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.shop-search-bar:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(196, 30, 58, 0.15);
}

.shop-search-bar i {
  color: var(--gray-400);
  font-size: 1rem;
}

.shop-search-bar input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 1rem;
  color: var(--gray-800);
  outline: none;
}

.shop-search-bar input::placeholder {
  color: var(--gray-400);
}

/* --- Shop Layout --- */
.shop-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 2rem;
  padding: 2rem 0 3rem;
  align-items: start;
}

/* --- Filters Sidebar --- */
.shop-filters {
  position: sticky;
  top: 100px;
  padding: 1.25rem;
  background: var(--cream-warm);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.filters-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.filters-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-800);
  margin: 0;
}

.filters-close {
  display: none;
  background: none;
  border: none;
  padding: 0.25rem;
  cursor: pointer;
  color: var(--gray-500);
  font-size: 1.25rem;
}

.filter-group {
  margin-bottom: 1.25rem;
}

.filter-group h4 {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 0.5rem;
}

.filter-options {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.filter-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  padding: 0.35rem 0;
  font-size: 0.9rem;
  color: var(--gray-700);
  transition: color var(--transition);
}

.filter-option:hover {
  color: var(--primary);
}

.filter-option input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

.price-range {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.price-range input {
  flex: 1;
  padding: 0.5rem;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 0.9rem;
  background: var(--cream);
  color: var(--gray-800);
}

.price-range input:focus {
  outline: none;
  border-color: var(--primary);
}

.price-range span {
  color: var(--gray-400);
}

/* --- Shop Toolbar --- */
.shop-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.filters-toggle {
  display: none;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--cream-warm);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 0.9rem;
  color: var(--gray-700);
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}

.filters-toggle:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.shop-sort {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.shop-sort label {
  font-size: 0.9rem;
  color: var(--gray-600);
}

.shop-sort select {
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 0.9rem;
  background: var(--cream);
  color: var(--gray-800);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2378716C' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
}

.shop-sort select:focus {
  outline: none;
  border-color: var(--primary);
}

.product-count {
  font-size: 0.9rem;
  color: var(--gray-500);
  margin-left: auto;
}

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

/* --- Product Card --- */
.product-card {
  background: var(--cream-warm);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.product-card-link {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.product-card-image {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--gray-100);
}

.product-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

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

.product-card-body {
  padding: 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.product-card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--gray-800);
  margin: 0 0 0.5rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-card-rating {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-bottom: 0.5rem;
}

.product-card-rating i {
  font-size: 0.75rem;
  color: var(--gray-400);
}

.product-card-rating i.filled {
  color: #EAB308;
}

.product-card-price {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0 0 0.5rem;
}

.product-card-desc {
  font-size: 0.8rem;
  color: var(--gray-500);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* --- Skeleton Loading --- */
.product-card-skeleton .product-card-image {
  background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
}

.product-card-skeleton .product-card-body {
  padding: 1rem;
}

.skeleton-line {
  height: 0.75rem;
  background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: 4px;
  margin-bottom: 0.5rem;
}

.skeleton-line.short {
  width: 40%;
}

.skeleton-line.medium {
  width: 70%;
}

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* --- Products Empty --- */
.products-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 2rem;
  color: var(--gray-500);
}

.products-empty i {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.products-empty p {
  margin: 0;
  font-size: 1rem;
}

/* --- Filters Overlay (Mobile) --- */
.filters-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition), visibility var(--transition);
}

.filters-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* --- Product Detail Page --- */
.product-main {
  padding: 2rem 0 4rem;
}

.breadcrumb {
  font-size: 0.9rem;
  color: var(--gray-500);
  margin-bottom: 1.5rem;
}

.breadcrumb a {
  color: var(--gray-600);
}

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

.product-detail {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.85fr);
  gap: 2.5rem;
  margin-bottom: 3rem;
}

.product-gallery {
  position: sticky;
  top: 100px;
}

.product-image-main {
  aspect-ratio: 1;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
}

.product-image-main img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.product-image-main:hover img {
  transform: scale(1.03);
}

.product-info .product-category {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.product-info .product-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  color: var(--gray-900);
  margin: 0 0 0.75rem;
  line-height: 1.25;
}

.product-info .product-rating {
  margin-bottom: 0.75rem;
}

.product-info .product-rating i {
  font-size: 0.9rem;
  color: var(--gray-400);
}

.product-info .product-rating i.filled {
  color: #EAB308;
}

.product-info .product-description {
  font-size: 1rem;
  line-height: 1.65;
  color: var(--gray-600);
  margin: 0 0 1.5rem;
}

.btn-add-cart {
  padding: 0.875rem 1.5rem;
  font-size: 1rem;
}

/* --- Related Products --- */
.related-products h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gray-900);
  margin: 0 0 1.25rem;
}

.related-products .products-grid {
  grid-template-columns: repeat(2, 1fr);
}

/* --- Responsive: Tablet --- */
@media (min-width: 640px) {
  .products-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
  }

  .related-products .products-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 768px) {
  .shop-layout {
    grid-template-columns: 260px 1fr;
  }
}

/* --- Responsive: Desktop --- */
@media (min-width: 1024px) {
  .products-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
  }

  .related-products .products-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* --- Responsive: Mobile --- */
@media (max-width: 767px) {
  .shop-hero {
    padding: 1.5rem 0 2rem;
  }

  .shop-layout {
    grid-template-columns: 1fr;
    padding: 1.5rem 0 5rem;
  }

  .shop-filters {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(320px, 85vw);
    z-index: 101;
    border-radius: 0;
    border-left: 1px solid var(--gray-200);
    transform: translateX(100%);
    transition: transform var(--transition);
    overflow-y: auto;
  }

  .shop-filters.open {
    transform: translateX(0);
  }

  .filters-close {
    display: block;
  }

  .filters-toggle {
    display: flex;
  }

  .filters-overlay {
    display: block;
  }

  .product-detail {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .product-gallery {
    position: static;
  }
}

/* Touch-friendly buttons */
@media (hover: none) {
  .product-card:hover {
    transform: none;
  }

  .product-card:active {
    transform: scale(0.98);
  }

  .btn,
  .filter-option,
  .filters-toggle {
    min-height: 44px;
  }
}
