/**
 * BRAKEMATIC, LDA — Catalog & Product Styles
 */

/* ==========================================================================
   Catalog Page Layout
   ========================================================================== */

.catalog-header {
  margin-bottom: var(--space-8);
}

.catalog-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-8);
}

@media (min-width: 992px) {
  .catalog-layout {
    grid-template-columns: 280px 1fr;
    gap: var(--space-8);
  }
}

/* ==========================================================================
   Search & Filter Bar (Top Toolbar)
   ========================================================================== */

.catalog-toolbar {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  padding: var(--space-4);
  background-color: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

@media (min-width: 640px) {
  .catalog-toolbar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.search-box {
  position: relative;
  flex: 1 1 auto;
  max-width: 100%;
}

@media (min-width: 640px) {
  .search-box {
    max-width: 420px;
  }
}

.search-input {
  width: 100%;
  height: 44px;
  padding: 0 var(--space-4) 0 42px;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--text);
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.search-input:focus {
  border-color: var(--brand-blue);
  outline: none;
  box-shadow: var(--focus-ring);
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

.catalog-toolbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  justify-content: space-between;
}

.filter-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  height: 44px;
  padding: 0 var(--space-4);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--brand-blue);
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

@media (min-width: 992px) {
  .filter-toggle-btn {
    display: none;
  }
}

.sort-select-wrapper {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: 600;
}

.sort-select {
  height: 44px;
  padding: 0 var(--space-4);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--brand-blue);
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
}

/* ==========================================================================
   Filter Sidebar (Desktop & Mobile Drawer)
   ========================================================================== */

.filter-sidebar {
  background-color: var(--surface);
}

@media (max-width: 991px) {
  .filter-sidebar {
    position: fixed;
    top: 0;
    left: -320px;
    width: 300px;
    max-width: 85vw;
    height: 100vh;
    z-index: 1050;
    overflow-y: auto;
    padding: var(--space-5);
    box-shadow: var(--shadow-lg);
    transition: left var(--transition-normal);
  }

  body.filters-open .filter-sidebar {
    left: 0;
  }

  body.filters-open .filter-backdrop {
    opacity: 1;
    visibility: visible;
  }
}

.filter-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 48, 109, 0.45);
  z-index: 1040;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

.filter-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-3);
  border-bottom: 2px solid var(--border);
}

.filter-sidebar-title {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--brand-blue);
}

.filter-close-btn {
  display: block;
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--text-muted);
  cursor: pointer;
}

@media (min-width: 992px) {
  .filter-close-btn {
    display: none;
  }
}

.filter-group {
  margin-bottom: var(--space-6);
  border-bottom: 1px solid var(--border);
  padding-bottom: var(--space-5);
}

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

.filter-group-title {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--brand-blue);
  margin-bottom: var(--space-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.filter-options-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.filter-option {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

.filter-option input[type="radio"],
.filter-option input[type="checkbox"] {
  accent-color: var(--brand-blue);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.filter-option:hover {
  color: var(--brand-blue);
}

.filter-clear-btn {
  background: none;
  border: none;
  color: var(--brand-blue);
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

.filter-clear-btn:hover {
  color: var(--brand-yellow-hover);
}

/* ==========================================================================
   Active Filters & Results Counter
   ========================================================================== */

.catalog-status-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border);
  font-size: var(--text-sm);
}

.results-count {
  font-weight: 600;
  color: var(--text-muted);
}

.results-count strong {
  color: var(--brand-blue);
}

.active-filters-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 3px 8px;
  background-color: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: var(--text-xs);
  color: var(--brand-blue);
  font-weight: 600;
}

.filter-pill-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-weight: 700;
  padding: 0 2px;
  display: flex;
  align-items: center;
}

.filter-pill-remove:hover {
  color: var(--state-error);
}

/* ==========================================================================
   Product Grid & Product Cards
   ========================================================================== */

.product-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
}

@media (min-width: 600px) {
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1200px) {
  .product-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.product-card {
  display: flex;
  flex-direction: column;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.product-card:hover {
  border-color: var(--brand-blue);
  box-shadow: var(--shadow-sm);
}

.product-card-img-wrap {
  width: 100%;
  aspect-ratio: 4 / 3;
  background-color: var(--surface-muted);
  border-bottom: 1px solid var(--border);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  overflow: hidden;
}

.product-card-img-wrap img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform var(--transition-fast);
}

.product-card:hover .product-card-img-wrap img {
  transform: scale(1.02);
}

.product-card-badge {
  position: absolute;
  top: 10px;
  left: 10px;
}

.product-card-body {
  display: flex;
  flex-direction: column;
  padding: var(--space-5);
  flex-grow: 1;
}

.product-card-ref {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--brand-blue);
  margin-bottom: var(--space-1);
}

.product-card-title {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--brand-blue);
  line-height: var(--leading-snug);
  margin-bottom: var(--space-2);
}

.product-card-title a {
  color: inherit;
  text-decoration: none;
}

.product-card-title a:hover {
  color: var(--brand-blue-hover);
  text-decoration: underline;
}

.product-card-apps {
  font-size: var(--text-xs);
  color: var(--text-muted);
  line-height: var(--leading-normal);
  margin-bottom: var(--space-4);
  flex-grow: 1;
}

.product-card-apps strong {
  color: var(--text);
}

.product-card-footer {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}

.product-card-footer .btn {
  flex: 1 1 50%;
  padding: 0.5rem 0.75rem;
  font-size: var(--text-xs);
}

/* ==========================================================================
   Product Detail Page
   ========================================================================== */

.product-detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-8);
  margin-bottom: var(--space-12);
}

@media (min-width: 992px) {
  .product-detail-grid {
    grid-template-columns: 1fr 1.1fr;
    gap: var(--space-12);
  }
}

.product-gallery {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.product-main-image {
  background-color: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-6);
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 4 / 3;
}

.product-main-image img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.product-info-panel {
  display: flex;
  flex-direction: column;
}

.product-detail-ref {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.product-detail-title {
  font-size: var(--text-2xl);
  font-weight: 800;
  color: var(--brand-blue);
  line-height: var(--leading-tight);
  margin-bottom: var(--space-3);
}

@media (min-width: 768px) {
  .product-detail-title {
    font-size: var(--text-3xl);
  }
}

.product-detail-desc {
  font-size: var(--text-base);
  color: var(--text);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-6);
}

.product-quote-action-box {
  background-color: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  margin-top: var(--space-6);
  margin-bottom: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

@media (min-width: 640px) {
  .product-quote-action-box {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.quote-action-qty {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--brand-blue);
}
