/**
 * Catalog Enhancements - Professional Shopify-Inspired Design
 *
 * Styles for search, sort, and filter functionality
 */

/* ============================================
   Toolbar - Professional Layout
   ============================================ */

.store-toolbar {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  align-items: center;
}

@media (max-width: 768px) {
  .store-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
}

/* ============================================
   Search Input - Shopify Style
   ============================================ */

.store-search {
  flex: 1;
  min-width: 250px;
}

.store-search input[type="search"] {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.75rem;
  font-size: 0.875rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
  color: #111827;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="%236b7280" stroke-width="2"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.35-4.35"/></svg>');
  background-repeat: no-repeat;
  background-position: 0.75rem center;
  background-size: 20px 20px;
}

.store-search input[type="search"]:focus {
  outline: none;
  border-color: #111827;
  box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.1);
}

.store-search input[type="search"]::placeholder {
  color: #9ca3af;
}

/* Remove default search cancel button in Chrome */
.store-search input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
  height: 16px;
  width: 16px;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="%239ca3af" stroke-width="2"><path d="M18 6L6 18M6 6l12 12"/></svg>');
  background-size: 16px 16px;
  cursor: pointer;
}

/* ============================================
   Filter Dropdowns - Professional Style
   ============================================ */

.store-filters {
  display: flex;
  gap: 0.75rem;
}

.store-filters select {
  padding: 0.75rem 2.5rem 0.75rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
  color: #111827;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  appearance: none;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="%23111827" stroke-width="2"><path d="m6 9 6 6 6-6"/></svg>');
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 20px 20px;
  min-width: 180px;
}

.store-filters select:hover {
  border-color: #9ca3af;
  background-color: #f9fafb;
}

.store-filters select:focus {
  outline: none;
  border-color: #111827;
  box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.1);
}

@media (max-width: 768px) {
  .store-filters {
    width: 100%;
    flex-direction: column;
  }

  .store-filters select {
    width: 100%;
  }
}

/* ============================================
   Results Count
   ============================================ */

.store-results-count {
  margin: 1rem 0 -0.5rem 0;
}

.store-results-count p {
  color: #6b7280;
  font-size: 0.875rem;
  font-weight: 500;
  margin: 0;
}

/* ============================================
   Empty State - Professional
   ============================================ */

.store-empty {
  text-align: center;
  padding: 4rem 2rem;
  background: #f9fafb;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
}

.store-empty svg {
  margin: 0 auto 1.5rem;
  opacity: 0.5;
}

.store-empty h3 {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #111827;
  margin: 0 0 0.5rem 0;
}

.store-empty p {
  color: #6b7280;
  margin: 0;
  font-size: 0.875rem;
}

/* ============================================
   Loading State Enhancement
   ============================================ */

.store-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 0;
  min-height: 400px;
}

.store-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #e5e7eb;
  border-top-color: #111827;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 1rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.store-loading p {
  color: #6b7280;
  font-size: 0.875rem;
  font-weight: 500;
}

/* ============================================
   Enhanced Product Grid
   ============================================ */

.store-products {
  margin-top: 2rem;
}

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

@media (max-width: 768px) {
  .store-products-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.5rem;
  }
}

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

/* ============================================
   Active Filter Indicators
   ============================================ */

.store-filters select.active {
  background-color: #f3f4f6;
  border-color: #111827;
  font-weight: 600;
}

.store-search input[type="search"].active {
  background-color: #f3f4f6;
  border-color: #111827;
}

/* ============================================
   Filter Pills (Optional Enhancement)
   ============================================ */

.store-active-filters {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 1rem 0;
}

.store-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.75rem;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 0.875rem;
  color: #111827;
  font-weight: 500;
}

.store-filter-pill button {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: #6b7280;
  display: flex;
  align-items: center;
  transition: color 0.2s;
}

.store-filter-pill button:hover {
  color: #111827;
}

/* ============================================
   Smooth Transitions for Product Grid Updates
   ============================================ */

.store-products-grid {
  animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================
   Toolbar on Mobile - Stack Layout
   ============================================ */

@media (max-width: 640px) {
  .store-toolbar {
    gap: 0.75rem;
  }

  .store-search {
    order: 1;
    width: 100%;
  }

  .store-filters {
    order: 2;
    width: 100%;
  }

  .store-results-count {
    order: 3;
  }
}

/* ============================================
   Focus Visible for Accessibility
   ============================================ */

.store-search input[type="search"]:focus-visible,
.store-filters select:focus-visible {
  outline: 2px solid #111827;
  outline-offset: 2px;
}

/* ============================================
   Dark Mode Support (Optional)
   ============================================ */

@media (prefers-color-scheme: dark) {
  .store-search input[type="search"],
  .store-filters select {
    background-color: #1f2937;
    border-color: #374151;
    color: #f9fafb;
  }

  .store-search input[type="search"]::placeholder {
    color: #9ca3af;
  }

  .store-empty {
    background-color: #1f2937;
    border-color: #374151;
  }

  .store-empty h3 {
    color: #f9fafb;
  }

  .store-empty p {
    color: #9ca3af;
  }
}

/* ============================================
   Print Styles
   ============================================ */

@media print {
  .store-toolbar,
  .store-results-count {
    display: none;
  }
}
