/* ==========================================================================
   DAVS FARM EQUIPMENT — EQUIPMENT CATALOG STYLES (EQUIPMENT.CSS)
   Aesthetic: Rugged, Heavy-Duty, Grounded Earth & Steel Industrial
   ========================================================================== */

.catalog-header {
  background-color: var(--steel-950);
  background-image: 
    linear-gradient(to right, rgba(8, 26, 16, 0.95) 0%, rgba(15, 23, 42, 0.9) 100%),
    url('https://images.unsplash.com/photo-1592982537447-7440770cbfc9?auto=format&fit=crop&w=1920&q=80');
  background-size: cover;
  background-position: center;
  color: #ffffff;
  padding: 3.5rem 0 3rem;
  border-bottom: 4px solid var(--forest-700);
}

.catalog-breadcrumbs {
  font-size: 0.85rem;
  font-family: var(--font-mono);
  color: #fbbf24;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.catalog-breadcrumbs a {
  color: #cbd5e1;
  transition: color 0.15s ease;
}

.catalog-breadcrumbs a:hover {
  color: #ffffff;
}

.catalog-title {
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 900;
  color: #ffffff;
  margin-bottom: 0.5rem;
}

.catalog-desc {
  color: #e2e8f0;
  font-size: 1.05rem;
  max-width: 650px;
  line-height: 1.6;
}

/* ==========================================================================
   CATALOG TOOLBAR & FILTERS
   Crucial: Position is relative so the filter bar SCROLLS naturally with page
   and never stays sticky over catalog content.
   ========================================================================== */

.catalog-toolbar-section {
  background-color: #ffffff;
  border-bottom: 1.5px solid var(--steel-200);
  padding: 1.25rem 0;
  box-shadow: var(--shadow-sm);
  position: relative;
  z-index: 10;
}

/* Mobile Filter Trigger Bar (Hidden on desktop) */
.mobile-filter-bar {
  display: none;
}

/* Catalog Filter Drawer (Visible always on desktop, collapsible on mobile) */
.catalog-filter-drawer {
  display: block;
}

.filter-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.search-and-controls {
  display: flex;
  gap: 0.85rem;
  align-items: center;
  flex-wrap: wrap;
}

.search-input-wrap {
  flex: 1;
  min-width: 250px;
  position: relative;
}

.search-input {
  width: 100%;
  height: 48px;
  padding: 0 1rem 0 2.5rem;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-sm);
  background-color: #f8fafc;
  font-size: 0.95rem;
  font-weight: 500;
  color: #0f172a;
  transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--forest-800);
  background-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(20, 56, 35, 0.15);
}

.search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
  pointer-events: none;
}

.select-control {
  height: 48px;
  padding: 0 2.25rem 0 1rem;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-sm);
  background-color: #f8fafc;
  font-size: 0.9rem;
  font-weight: 600;
  color: #0f172a;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23334155' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  appearance: none;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.select-control:focus {
  outline: none;
  border-color: var(--forest-800);
  background-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(20, 56, 35, 0.15);
}

.filter-btn-group {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.filter-btn {
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 1.25rem;
  font-size: 0.9rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.view-mode-buttons {
  display: flex;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  height: 48px;
  margin-left: auto;
}

.view-btn {
  background: #f8fafc;
  border: none;
  padding: 0 0.85rem;
  cursor: pointer;
  color: #475569;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.view-btn.active,
.view-btn:hover {
  background: var(--forest-800);
  color: #ffffff;
}

/* Category Filter Tabs: Short & Straight to the Point */
.category-filter-strip {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
  padding-top: 0.75rem;
  border-top: 1px solid var(--steel-100);
}

.category-filter-label {
  font-size: 0.825rem;
  font-weight: 800;
  color: #1e293b;
  text-transform: uppercase;
  margin-right: 0.25rem;
}

.filter-pill {
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.4rem 1rem;
  border-radius: var(--radius-full);
  background-color: #f1f5f9;
  color: #334155;
  border: 1.5px solid #e2e8f0;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.filter-pill:hover,
.filter-pill.active {
  background-color: var(--forest-800);
  color: #ffffff;
  border-color: var(--forest-800);
}

/* ==========================================================================
   MAIN CATALOG GRID & CARDS (EQUAL HEIGHTS & ALIGNMENT)
   ========================================================================== */

.catalog-content-section {
  padding: 3rem 0 5rem;
  background-color: var(--parchment-base);
}

.catalog-stats-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  font-size: 0.95rem;
  color: #334155;
  font-weight: 600;
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2rem;
  align-items: stretch;
}

/* List View Variant */
.catalog-grid.list-view {
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

.catalog-grid.list-view .equipment-card {
  flex-direction: row;
  align-items: stretch;
}

.catalog-grid.list-view .equipment-image-wrap {
  width: 340px;
  height: auto;
  min-height: 240px;
  flex-shrink: 0;
}

.catalog-grid.list-view .equipment-card-body {
  padding: 1.75rem;
}

.catalog-grid.list-view .equipment-card-title {
  min-height: auto;
  font-size: 1.35rem;
}

.catalog-grid.list-view .equipment-card-excerpt {
  min-height: auto;
  -webkit-line-clamp: 3;
}

.catalog-grid.list-view .equipment-card-footer {
  justify-content: flex-start;
  gap: 1rem;
}

.catalog-grid.list-view .equipment-card-footer .btn {
  flex: 0 0 auto;
  min-width: 150px;
}

/* Pagination */
.pagination-wrap {
  margin-top: 3.5rem;
  display: flex;
  justify-content: center;
}

.pagination {
  display: flex;
  gap: 0.5rem;
  list-style: none;
}

.pagination a, .pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 42px;
  padding: 0 0.85rem;
  border-radius: var(--radius-sm);
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  font-weight: 700;
  color: #1e293b;
  transition: all 0.15s ease;
}

.pagination a:hover, .pagination .active span {
  background: var(--forest-800);
  color: #ffffff;
  border-color: var(--forest-800);
}

/* ==========================================================================
   RESPONSIVE BREAKPOINTS (TABLET & MOBILE)
   ========================================================================== */

@media (max-width: 1024px) {
  .catalog-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
  }
}

@media (max-width: 768px) {
  /* Toolbar: Normal document flow (never sticky) */
  .catalog-toolbar-section {
    position: relative;
    padding: 1rem 0;
  }

  /* Mobile Filter Toggle Bar */
  .mobile-filter-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
  }

  .mobile-filter-toggle-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 48px;
    padding: 0 1rem;
    background-color: #ffffff;
    border: 1.5px solid var(--steel-300);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.925rem;
    font-weight: 700;
    color: var(--forest-900);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
  }

  .mobile-filter-toggle-btn:hover,
  .mobile-filter-toggle-btn.active {
    border-color: var(--forest-800);
    background-color: var(--forest-50);
  }

  .mobile-filter-btn-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }

  .mobile-filter-btn-right {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: var(--steel-600);
  }

  .mobile-filter-chevron {
    transition: transform 0.25s ease;
  }

  .mobile-filter-toggle-btn.active .mobile-filter-chevron {
    transform: rotate(180deg);
  }

  .filter-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: var(--amber-500);
    color: #ffffff;
    font-size: 0.72rem;
    font-family: var(--font-mono);
    font-weight: 800;
    padding: 0.15rem 0.45rem;
    border-radius: var(--radius-full);
  }

  .mobile-filter-quick-clear {
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.85rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--amber-600);
    border: 1.5px solid var(--amber-400);
    background-color: var(--amber-50);
    border-radius: var(--radius-sm);
    white-space: nowrap;
    text-decoration: none;
    transition: all 0.15s ease;
  }

  .mobile-filter-quick-clear:hover {
    background-color: var(--amber-500);
    color: #ffffff;
    border-color: var(--amber-500);
  }

  /* Collapsible Filter Section on Mobile */
  .catalog-filter-drawer {
    display: none;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1.5px dashed var(--steel-200);
    animation: drawerFadeIn 0.25s ease-out;
  }

  .catalog-filter-drawer.open {
    display: block;
  }

  @keyframes drawerFadeIn {
    from {
      opacity: 0;
      transform: translateY(-6px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .search-and-controls {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .search-input-wrap {
    min-width: 100%;
    width: 100%;
  }

  .select-control {
    width: 100%;
  }

  .filter-btn-group {
    display: flex;
    gap: 0.5rem;
    width: 100%;
  }

  .filter-btn {
    flex: 1;
    width: 100%;
  }

  .view-mode-buttons {
    display: none;
  }

  .category-filter-strip {
    padding-top: 0.75rem;
  }

  /* Catalog Grid on Mobile */
  .catalog-stats-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
    margin-bottom: 1.5rem;
  }

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

  .catalog-grid.list-view .equipment-card {
    flex-direction: column;
  }

  .catalog-grid.list-view .equipment-image-wrap {
    width: 100%;
    height: 220px;
    min-height: auto;
  }

  .catalog-grid.list-view .equipment-card-footer .btn {
    flex: 1 1 0;
    min-width: 0;
  }
}
