/* Base styles */
:root {
  --background: #f8f9fa;
  --card-background: #ffffff;
  --text-primary: #333333;
  --text-secondary: #6c757d;
  --border-color: #e9ecef;
  --primary-color: #0d6efd;
  --primary-hover: #0b5ed7;
  --input-background: #ffffff;
  --input-border: #ced4da;
}

.dark-theme {
  --background: #121212;
  --card-background: #1e1e1e;
  --text-primary: #ffffff;
  --text-secondary: #adb5bd;
  --border-color: #2d2d2d;
  --primary-color: #0d6efd;
  --primary-hover: #0b5ed7;
  --input-background: #2d2d2d;
  --input-border: #444444;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  background-color: var(--background);
  color: var(--text-primary);
  line-height: 1.5;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

/* Header */
header {
  margin-bottom: 2rem;
}

h1 {
  font-size: 2rem;
  font-weight: bold;
  margin-bottom: 0.5rem;
}

.subtitle {
  color: var(--text-secondary);
}

/* Filters */
.filters {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
}

.search-container {
  position: relative;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-secondary);
}

#search-input {
  width: 100%;
  padding: 0.75rem 0.75rem 0.75rem 2.5rem;
  border: 1px solid var(--input-border);
  border-radius: 0.375rem;
  background-color: var(--input-background);
  color: var(--text-primary);
}

#search-input::placeholder {
  color: var(--text-secondary);
}

.sort-container {
  width: 100%;
}

#sort-select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--input-border);
  border-radius: 0.375rem;
  background-color: var(--input-background);
  color: var(--text-primary);
  cursor: pointer;
}

/* Knives Grid - responsive grid for all screens */
.knives-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  width: 100%;
}

/* Knife Card */
.knife-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  background-color: var(--card-background);
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--border-color);
  position: relative;
  transition: transform 0.2s ease;
}

.knife-card:hover {
  transform: translateY(-4px);
}

.knife-image-container {
  position: relative;
  aspect-ratio: 4/3;
  overflow: hidden;
  background-color: #f0f0f0;
  width: 100%;
}

.knife-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

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

.sold-out-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(200, 0, 0, 0.85);
  color: white;
  padding: 5px 10px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.9em;
  z-index: 2;
}

.knife-content {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  text-align: center;
}

.knife-title {
  font-size: 1.25rem;
  font-weight: bold;
  margin-bottom: 0.5rem;
}

.knife-description {
  color: var(--text-secondary);
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

.knife-price {
  font-size: 1.25rem;
  font-weight: bold;
  margin-bottom: 1rem;
}

/* Buttons */
.buy-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 0.375rem;
  padding: 0.75rem 1rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  margin-top: auto;
  transition: background-color 0.2s;
}

.buy-button:hover {
  background-color: var(--primary-hover);
}

.buy-button.disabled {
  background-color: #888;
  cursor: not-allowed;
  pointer-events: none;
}

.external-link-icon {
  width: 16px;
  height: 16px;
}

/* No Results */
.no-results {
  text-align: center;
  padding: 3rem 0;
}

.no-results h3 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.no-results p {
  color: var(--text-secondary);
}

/* Hidden helper class */
.hidden {
  display: none;
}

/* Responsive adjustments */
@media (min-width: 640px) {
  .filters {
    flex-direction: row;
    align-items: center;
  }

  .search-container {
    width: 20rem;
  }

  .sort-container {
    width: auto;
  }

  #sort-select {
    width: 180px;
  }
}

@media (max-width: 639px) {
  .container {
    padding: 1rem;
  }

  .knife-title {
    font-size: 1.1rem;
  }

  .knife-price {
    font-size: 1.1rem;
  }

  .buy-button {
    padding: 0.6rem 0.8rem;
    font-size: 0.9rem;
  }

  /* Improve image display on mobile */
  .knife-image-container {
    aspect-ratio: 4 / 3;
  }
}
