/**
 * Category Filters - Modular Styles
 *
 * Styles for all category filter modes:
 * - Pills (horizontal tags)
 * - Sidebar (vertical panel)
 * - Dropdown (single select)
 * - Dropdown Multi (multi-select with checkboxes)
 * - Cards (category grid)
 */

/* ============================================
   MODE 1: PILLS (Horizontal Tags)
   ============================================ */

.store-category-pills {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 1.5rem 0;
  padding: 0;
}

.store-category-pill {
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #4b5563;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 9999px; /* Fully rounded */
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  outline: none;
}

.store-category-pill:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
  color: #111827;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.store-category-pill:active {
  transform: translateY(0);
}

.store-category-pill.active {
  background: #111827;
  color: #fff;
  border-color: #111827;
  font-weight: 600;
}

.store-category-pill:focus-visible {
  outline: 2px solid #111827;
  outline-offset: 2px;
}

/* Mobile responsive */
@media (max-width: 640px) {
  .store-category-pills {
    gap: 0.5rem;
    margin: 1rem 0;
  }

  .store-category-pill {
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
  }
}

/* ============================================
   MODE 2: SIDEBAR (Vertical Panel)
   ============================================ */

.store-category-sidebar {
  width: 260px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 1.5rem;
  margin-right: 2rem;
  margin-bottom: 2rem;
  float: left;
  transition: all 0.3s ease;
}

.store-sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e5e7eb;
}

.store-sidebar-header h3 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: #111827;
}

.store-sidebar-toggle {
  display: none;
  background: none;
  border: none;
  padding: 0.25rem;
  cursor: pointer;
  color: #6b7280;
  transition: color 0.2s;
}

.store-sidebar-toggle:hover {
  color: #111827;
}

.store-sidebar-content {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.store-sidebar-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
  user-select: none;
}

.store-sidebar-option:hover {
  background: #f9fafb;
}

.store-sidebar-option input[type="checkbox"],
.store-sidebar-option input[type="radio"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  margin: 0;
  flex-shrink: 0;
}

.store-sidebar-option span {
  flex: 1;
  font-size: 0.875rem;
  color: #374151;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.store-category-count {
  font-size: 0.75rem;
  color: #9ca3af;
  font-weight: 500;
  margin-left: 0.5rem;
}

/* Sidebar collapsed state */
.store-category-sidebar.collapsed {
  width: 50px;
  padding: 1rem 0.5rem;
}

.store-category-sidebar.collapsed .store-sidebar-header h3,
.store-category-sidebar.collapsed .store-sidebar-content {
  display: none;
}

.store-category-sidebar.collapsed .store-sidebar-toggle {
  display: block;
}

/* Mobile sidebar */
@media (max-width: 1024px) {
  .store-category-sidebar {
    width: 100%;
    float: none;
    margin-right: 0;
  }

  .store-sidebar-toggle {
    display: block;
  }
}

@media (max-width: 640px) {
  .store-category-sidebar {
    padding: 1rem;
  }

  .store-sidebar-header {
    margin-bottom: 1rem;
  }
}

/* ============================================
   MODE 3: DROPDOWN (handled by existing styles)
   Uses .store-filters select from catalog-enhancements.css
   ============================================ */

/* ============================================
   MODE 4: DROPDOWN MULTI (Custom Dropdown)
   ============================================ */

.store-dropdown-multi {
  position: relative;
  display: inline-block;
}

.store-dropdown-button {
  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;
  white-space: nowrap;
}

.store-dropdown-button:hover {
  border-color: #9ca3af;
  background-color: #f9fafb;
}

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

.store-dropdown-content {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  min-width: 220px;
  max-height: 400px;
  overflow-y: auto;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.store-dropdown-content.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.store-dropdown-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: background 0.2s;
  user-select: none;
}

.store-dropdown-option:hover {
  background: #f9fafb;
}

.store-dropdown-option input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  margin: 0;
  flex-shrink: 0;
}

.store-dropdown-option span {
  font-size: 0.875rem;
  color: #374151;
}

.store-dropdown-apply {
  width: 100%;
  padding: 0.75rem 1rem;
  margin-top: 0.5rem;
  border: none;
  border-top: 1px solid #e5e7eb;
  background: #f9fafb;
  color: #111827;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  border-radius: 0 0 8px 8px;
}

.store-dropdown-apply:hover {
  background: #f3f4f6;
}

/* ============================================
   MODE 5: CARDS (Category Grid)
   ============================================ */

.store-category-cards {
  margin-bottom: 3rem;
}

.store-category-cards-header {
  font-size: 1.875rem;
  font-weight: 700;
  color: #111827;
  margin-bottom: 1.5rem;
  letter-spacing: -0.02em;
}

.store-category-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.store-category-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0;
}

.store-category-card:hover {
  border-color: #111827;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  transform: translateY(-4px);
}

.store-category-card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
}

.store-category-card-placeholder {
  width: 100%;
  height: 200px;
  background: linear-gradient(135deg, #f9fafb 0%, #e5e7eb 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  font-weight: 700;
  color: #9ca3af;
}

.store-category-card-info {
  padding: 1.25rem;
  text-align: center;
}

.store-category-card-info h3 {
  margin: 0 0 0.25rem 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: #111827;
}

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

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

  .store-category-card img,
  .store-category-card-placeholder {
    height: 150px;
  }

  .store-category-card-info {
    padding: 1rem;
  }

  .store-category-card-info h3 {
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  .store-category-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ============================================
   LAYOUT ADJUSTMENTS
   ============================================ */

/* When sidebar is active, adjust main content */
.store-main:has(.store-category-sidebar) .store-container {
  display: flex;
  flex-wrap: wrap;
}

.store-main:has(.store-category-sidebar) .store-products,
.store-main:has(.store-category-sidebar) .store-toolbar {
  flex: 1;
  min-width: 0; /* Prevent flex item overflow */
}

/* Clear floats */
.store-main:has(.store-category-sidebar)::after {
  content: "";
  display: table;
  clear: both;
}

/* ============================================
   ANIMATIONS
   ============================================ */

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

.store-category-pills,
.store-category-sidebar,
.store-category-cards {
  animation: slideIn 0.3s ease-out;
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

.store-category-pill:focus-visible,
.store-dropdown-button:focus-visible,
.store-category-card:focus-visible {
  outline: 2px solid #111827;
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .store-category-pill,
  .store-dropdown-button,
  .store-category-card {
    border-width: 2px;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .store-category-pill,
  .store-dropdown-content,
  .store-category-card,
  .store-category-pills,
  .store-category-sidebar,
  .store-category-cards {
    animation: none;
    transition: none;
  }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
  .store-category-pills,
  .store-category-sidebar,
  .store-dropdown-multi,
  .store-category-cards {
    display: none;
  }
}
