/*
    File: brands.css
    Purpose: Styles for brands page including brand grid and product listings
    Contains: Brand cards, grid layout, hover effects, responsive design
    FIX: Added styles for the `.page-header` and `.page-header-content` to center the heading and apply a consistent design, fixing the alignment issue.
*/

/* ========================================
   PAGE HEADER
   ======================================== */

.page-header {
  background: linear-gradient(135deg, #1a1a1a 0%, #333333 100%);
  padding: var(--spacing-xxl) 0;
  text-align: center;
  color: var(--light-bg);
}

.page-header-content h1 {
  font-family: var(--font-heading);
  font-size: 48px;
  font-weight: 900;
  margin-bottom: var(--spacing-sm);
  text-transform: uppercase;
}

.page-header-content p {
  font-size: 18px;
  color: rgba(255, 255, 255, 0.8);
}

/* ========================================
   BRANDS SECTION
   ======================================== */

.brands-section {
  padding: var(--spacing-xxl) 0;
  background-color: #f5f5f5;
}

.brands-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--spacing-md);
}

.section-header {
  text-align: center;
  margin-bottom: var(--spacing-xxl);
}

.section-header h2 {
  font-family: var(--font-heading);
  font-size: 42px;
  font-weight: 900;
  color: var(--text-dark);
  margin-bottom: var(--spacing-sm);
  text-transform: uppercase;
}

.section-header p {
  font-size: 18px;
  color: var(--text-light);
}

/* ========================================
   BRANDS GRID
   ======================================== */

.brands-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: var(--spacing-xl);
  min-height: 400px;
}

/* Brand Card */
.brand-card {
  background-color: var(--light-bg);
  border-radius: var(--radius-lg);
  padding: var(--spacing-xl);
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.brand-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(
    90deg,
    var(--primary-color),
    var(--secondary-color)
  );
  transform: scaleX(0);
  transition: transform var(--transition-normal);
}

.brand-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-lg);
}

.brand-card:hover::before {
  transform: scaleX(1);
}

.brand-logo {
  width: calc(100% + calc(2 * var(--spacing-xl)));
  height: 160px;
  margin: calc(-1 * var(--spacing-xl)) calc(-1 * var(--spacing-xl)) var(--spacing-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #f5f5f5;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  overflow: hidden;
}

.brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 16px;
}

.brand-logo-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  font-weight: 900;
  color: var(--primary-color);
  background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
}

.brand-card h3 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: var(--spacing-sm);
}

.brand-card p {
  font-size: 14px;
  color: var(--text-light);
  margin-bottom: var(--spacing-md);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.brand-product-count {
  display: inline-block;
  padding: var(--spacing-xs) var(--spacing-md);
  background-color: var(--primary-color);
  color: var(--light-bg);
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
}

/* Loading Spinner */
.loading-spinner {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--spacing-xxl);
  color: var(--text-light);
}

.loading-spinner p {
  font-size: 18px;
}

/* ========================================
   BRAND PRODUCTS SECTION
   ======================================== */

.brand-products-section {
  padding: var(--spacing-xxl) 0;
  background-color: var(--light-bg);
}

.brand-products-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--spacing-md);
}

/* Brand Header */
.brand-header {
  margin-bottom: var(--spacing-xxl);
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-sm) var(--spacing-lg);
  background-color: #f5f5f5;
  color: var(--text-dark);
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 16px;
  transition: var(--transition-normal);
  margin-bottom: var(--spacing-lg);
}

.back-btn:hover {
  background-color: var(--primary-color);
  color: var(--light-bg);
}

.brand-info {
  text-align: center;
  padding: var(--spacing-xl);
  background: linear-gradient(135deg, #1a1a1a 0%, #333333 100%);
  border-radius: var(--radius-lg);
  color: var(--light-bg);
}

.brand-info h2 {
  font-family: var(--font-heading);
  font-size: 48px;
  font-weight: 900;
  margin-bottom: var(--spacing-sm);
  text-transform: uppercase;
}

.brand-info p {
  font-size: 18px;
  color: rgba(255, 255, 255, 0.8);
}

/* Products Toolbar */
.products-toolbar {
  background-color: #f5f5f5;
  padding: var(--spacing-md) var(--spacing-lg);
  border-radius: var(--radius-lg);
  margin-bottom: var(--spacing-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.results-count {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-dark);
}

.sort-control {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.sort-control label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dark);
  white-space: nowrap;
}

.sort-control select {
  padding: var(--spacing-xs) var(--spacing-md);
  border: 1px solid #e0e0e0;
  border-radius: var(--radius-md);
  font-size: 14px;
  background-color: var(--light-bg);
  cursor: pointer;
}

/* Products Grid */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--spacing-lg);
  min-height: 400px;
}

/* No Products Message */
.no-products {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--spacing-xxl);
}

.no-products h3 {
  font-size: 24px;
  margin-bottom: var(--spacing-sm);
  color: var(--text-dark);
}

.no-products p {
  font-size: 16px;
  color: var(--text-light);
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

/* iPad Specific Styles (769px to 1024px) */
@media screen and (min-width: 769px) and (max-width: 1024px) {
  .brands-section {
    overflow: hidden;
  }

  .section-container {
    max-width: 100%;
    padding: 0 var(--spacing-lg);
    box-sizing: border-box;
  }

  .page-header-content h1 {
    font-size: 42px;
  }

  .brands-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-lg);
  }

  .brand-card {
    padding: var(--spacing-xl);
  }

  .brand-logo {
    width: calc(100% + calc(2 * var(--spacing-xl)));
    height: 150px;
  }

  .brand-info {
    max-width: 100%;
    padding: 0 var(--spacing-lg);
  }

  .brand-info h2 {
    font-size: 42px;
  }

  .brand-info p {
    font-size: 16px;
  }

  .products-toolbar {
    padding: var(--spacing-md);
  }

  .products-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: var(--spacing-md);
  }
}

@media screen and (max-width: 1024px) {
  .brands-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: var(--spacing-lg);
  }

  .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }
}

@media screen and (max-width: 768px) {
  .section-header h2,
  .page-header-content h1 {
    font-size: 32px;
  }

  .brands-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: var(--spacing-md);
  }

  .brand-card {
    padding: var(--spacing-lg);
  }

  .brand-logo {
    width: calc(100% + calc(2 * var(--spacing-lg)));
    height: 130px;
    margin: calc(-1 * var(--spacing-lg)) calc(-1 * var(--spacing-lg)) var(--spacing-md);
  }

  .brand-card h3 {
    font-size: 18px;
  }

  .brand-info h2 {
    font-size: 36px;
  }

  .products-toolbar {
    flex-direction: column;
    gap: var(--spacing-md);
    align-items: flex-start;
  }

  .sort-control {
    width: 100%;
  }

  .sort-control select {
    flex: 1;
  }

  .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: var(--spacing-md);
  }
}

@media screen and (max-width: 480px) {
  .section-header h2,
  .page-header-content h1 {
    font-size: 28px;
  }

  .brands-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: var(--spacing-sm);
  }

  .brand-card {
    padding: var(--spacing-md);
  }

  .brand-logo {
    width: calc(100% + calc(2 * var(--spacing-md)));
    height: 110px;
    margin: calc(-1 * var(--spacing-md)) calc(-1 * var(--spacing-md)) var(--spacing-sm);
  }

  .brand-card h3 {
    font-size: 16px;
  }

  .brand-info h2 {
    font-size: 28px;
  }

  .brand-info p {
    font-size: 16px;
  }

  .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: var(--spacing-sm);
  }
}

/* ========================================
   ANIMATIONS
   ======================================== */

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.brand-card {
  animation: fadeInUp 0.6s ease forwards;
}
