/* ============================================ */
/* SIDEBAR FILTER LAYOUT */
/* ============================================ */

.marketplace-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

/* ============================================ */
/* FILTER SIDEBAR */
/* ============================================ */

.filter-sidebar {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 1.5rem;
  height: fit-content;
  position: sticky;
  top: 100px;
  box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.1);
}

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

.filter-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.125rem;
  font-weight: 700;
  color: #1e293b;
  margin: 0;
}

.filter-title i {
  color: #8b4513;
  font-size: 1.25rem;
}

.clear-filters-btn {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.75rem;
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fecaca;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.clear-filters-btn:hover {
  background: #fecaca;
  transform: translateY(-1px);
}

.results-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  padding: 0.75rem;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.results-count {
  font-size: 1.25rem;
  font-weight: 700;
  color: #8b4513;
}

.results-text {
  font-size: 0.875rem;
  color: #64748b;
}

/* ============================================ */
/* FILTER GROUPS */
/* ============================================ */

.filter-group {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #f1f5f9;
}

.filter-group:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.filter-group-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

/* Radio Button Options */
.filter-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 6px;
  transition: all 0.3s ease;
}

.filter-option:hover {
  background: #f8fafc;
}

.filter-option input[type="radio"] {
  appearance: none;
  width: 16px;
  height: 16px;
  border: 2px solid #d1d5db;
  border-radius: 50%;
  position: relative;
  cursor: pointer;
  transition: all 0.3s ease;
}

.filter-option input[type="radio"]:checked {
  border-color: #8b4513;
  background: #8b4513;
}

.filter-option input[type="radio"]:checked::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 6px;
  height: 6px;
  background: white;
  border-radius: 50%;
}

.option-text {
  font-size: 0.875rem;
  color: #4b5563;
  font-weight: 500;
}

.filter-option input[type="radio"]:checked + .option-text {
  color: #8b4513;
  font-weight: 600;
}

/* Checkbox Options */
.filter-checkbox {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 6px;
  transition: all 0.3s ease;
}

.filter-checkbox:hover {
  background: #f8fafc;
}

.filter-checkbox input[type="checkbox"] {
  display: none;
}

.checkbox-mark {
  width: 16px;
  height: 16px;
  border: 2px solid #d1d5db;
  border-radius: 4px;
  position: relative;
  transition: all 0.3s ease;
}

.filter-checkbox input[type="checkbox"]:checked + .checkbox-mark {
  background: #8b4513;
  border-color: #8b4513;
}

.filter-checkbox input[type="checkbox"]:checked + .checkbox-mark::after {
  content: "✓";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 0.75rem;
  font-weight: bold;
}

.filter-checkbox
  input[type="checkbox"]:checked
  + .checkbox-mark
  + .option-text {
  color: #8b4513;
  font-weight: 600;
}

/* ============================================ */
/* PRICE FILTER */
/* ============================================ */

.price-filter {
  background: #f8fafc;
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  transition: all 0.3s ease;
}

.price-filter:hover {
  border-color: #cbd5e1;
  box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.05);
}

.price-inputs {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.75rem;
  align-items: center;
}

.price-inputs input[type="number"] {
  padding: 0.75rem 0.5rem;
  border: 2px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.875rem;
  color: #374151;
  background: white;
  transition: all 0.3s ease;
  width: 100%;
  font-weight: 500;
}

.price-inputs input[type="number"]:focus {
  outline: none;
  border-color: #8b4513;
  box-shadow: 0 0 0 3px rgba(139, 69, 19, 0.1);
  transform: translateY(-1px);
}

.price-inputs input[type="number"]:hover {
  border-color: #9ca3af;
}

.price-inputs input[type="number"]::placeholder {
  color: #9ca3af;
  font-weight: 400;
}

.price-separator {
  font-size: 0.875rem;
  color: #6b7280;
  font-weight: 600;
  text-align: center;
  padding: 0 0.25rem;
}

/* Price filter validation states */
.price-inputs input[type="number"]:invalid,
.price-inputs input[type="number"].error {
  border-color: #ef4444;
  background-color: #fef2f2;
  animation: shake 0.3s ease-in-out;
}

.price-inputs input[type="number"]:valid:not(:placeholder-shown):not(.error) {
  border-color: #10b981;
  background-color: #f0fdf4;
}

/* Shake animation for validation errors */
@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-4px);
  }
  75% {
    transform: translateX(4px);
  }
}

/* Currency prefix for better UX */
.price-inputs input[type="number"]:not(:placeholder-shown):before {
  content: "$";
  position: absolute;
  left: 0.5rem;
  color: #6b7280;
}

/* ============================================ */
/* PRODUCTS MAIN AREA */
/* ============================================ */

.products-main {
  min-height: 600px;
}

.sort-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding: 1rem;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.sort-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sort-group label {
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
}

.sort-select {
  padding: 0.5rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: white;
  color: #374151;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 180px;
}

.sort-select:focus {
  outline: none;
  border-color: #8b4513;
  box-shadow: 0 0 0 3px rgba(139, 69, 19, 0.1);
}

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

/* ============================================ */
/* RESPONSIVE DESIGN */
/* ============================================ */

@media (max-width: 1024px) {
  .marketplace-layout {
    grid-template-columns: 260px 1fr;
    gap: 1.5rem;
  }

  .filter-sidebar {
    padding: 1.25rem;
  }

  .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.25rem;
  }
}

@media (max-width: 768px) {
  .marketplace-layout {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .filter-sidebar {
    position: static;
    margin-bottom: 1rem;
    padding: 1rem;
  }

  .filter-header {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
  }

  .filter-group {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
  }

  .sort-controls {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
    text-align: center;
  }

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

@media (max-width: 480px) {
  .filter-sidebar {
    padding: 0.75rem;
    border-radius: 8px;
  }

  .filter-title {
    font-size: 1rem;
  }

  .clear-filters-btn {
    padding: 0.375rem 0.5rem;
    font-size: 0.7rem;
  }

  .results-info {
    padding: 0.5rem;
  }

  .results-count {
    font-size: 1rem;
  }

  .filter-group {
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
  }

  .filter-group-title {
    font-size: 0.8rem;
    margin-bottom: 0.75rem;
  }

  .filter-options {
    gap: 0.5rem;
  }

  .filter-option,
  .filter-checkbox {
    padding: 0.375rem;
  }

  .option-text {
    font-size: 0.8rem;
  }

  .products-grid {
    grid-template-columns: 1fr;
  }
}

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

.filter-option:focus-within,
.filter-checkbox:focus-within {
  outline: 2px solid #8b4513;
  outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
