:root {
  --brands-green-dark: #0369a1;
  --brands-green-light: #38bdf8;
  --brands-text-primary: #333;
  --brands-spacing-sm: 12px;
  --brands-spacing-md: 20px;
  --brands-spacing-lg: 32px;
}

.brands-page .content {
  align-items: stretch;
}

.brands-container {
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: var(--brands-spacing-lg) 32px 64px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: var(--brands-spacing-lg);
  font-family: "Ubuntu", ui-sans-serif, system-ui, sans-serif;
}

.brands-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #fff;
  margin: -32px -32px 0;
  padding: 14px 32px;
  border-bottom: 1px solid #e5e7eb;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.brands-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brands-header-text {
  flex: 1;
  min-width: 0;
}

.brands-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.brands-total-badge {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(14, 165, 233, 0.22);
  background: #f0f9ff;
  color: var(--brands-green-dark);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.brands-header h1 {
  margin: 0;
  color: #111827;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
}

.brands-header p {
  margin: 0.25rem 0 0;
  color: #6b7280;
  font-size: 0.875rem;
  line-height: 1.4;
}

.brands-search-wrapper {
  position: relative;
  max-width: 400px;
  width: 100%;
}

.brands-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.brands-search {
  width: 100%;
  height: 38px;
  padding: 0 16px 0 41px;
  border: 1px solid #ddd;
  border-radius: 24px;
  font-size: 14px;
  color: var(--brands-text-primary);
  background: #fff;
  box-sizing: border-box;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  outline: none;
  appearance: none;
}

.brands-search::placeholder {
  color: #757575;
  opacity: 1;
}

.brands-search:focus {
  border-color: var(--brands-green-light);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}

.brands-search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: #9ca3af;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.brand-letter-section {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--brands-spacing-sm);
  margin-bottom: 24px;
}

.brand-letter-heading-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-letter-heading {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: #0284c7;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
}

.brand-letter-divider {
  flex: 1;
  height: 1px;
  background: #ececec;
}

.brands-grid {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: flex-start;
  gap: 16px;
}

.brand-card {
  position: relative;
  min-height: 150px;
  background: #fff;
  border: 1px solid #f3f4f6;
  border-radius: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  padding: 21px 13px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 7px;
  flex: 0 1 250px;
  max-width: 250px;
  width: 100%;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.3s, box-shadow 0.3s;
}

.brand-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

.brand-card-main {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
}

.brand-logo {
  width: 48px;
  height: 48px;
  border-radius: 24px;
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-logo-0 { background: #e0f2fe; color: #0369a1; }
.brand-logo-1 { background: #e3f2fd; color: #1565c0; }
.brand-logo-2 { background: #fff3e0; color: #e65100; }
.brand-logo-3 { background: #fce4ec; color: #c2185b; }
.brand-logo-4 { background: #f3e5f5; color: #6a1b9a; }
.brand-logo-5 { background: #e0f2fe; color: #075985; }

.brand-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--brands-text-primary);
  line-height: 1.3;
  word-break: break-word;
}

.brand-card-footer {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-top: 13px;
  margin-top: auto;
  border-top: 1px solid #f0f0f0;
}

.brand-count {
  font-size: 12px;
  font-weight: 500;
  color: #6b7280;
  background: #f3f4f6;
  padding: 2px 10px;
  border-radius: 12px;
  white-space: nowrap;
}

.brand-view-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--brands-text-primary);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

/* Stretch the View link over the whole card so the entire card is clickable */
.brand-view-link::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
}

.brands-no-results,
.brands-empty {
  margin: 0;
  text-align: center;
  color: #999;
  font-size: 16px;
  padding: 48px 0;
}

.brands-no-results {
  display: none;
}

@media (max-width: 1024px) {
  .brands-grid {
    gap: 14px;
  }
}

@media (max-width: 768px) {
  .brands-container {
    padding: var(--brands-spacing-md) 20px 48px;
  }

  .brands-header {
    margin: calc(-1 * var(--brands-spacing-md)) -20px 0;
    padding: 12px 20px;
  }

  .brands-header h1 {
    font-size: 1.25rem;
  }
}

@media (max-width: 47.99em) {
  .brands-container {
    padding-top: var(--brands-spacing-md);
    padding-left: 16px;
    padding-right: 16px;
  }

  .brands-header {
    top: 48px;
    margin: calc(-1 * var(--brands-spacing-md)) -16px 0;
    padding: 12px 16px;
  }

  .brands-header-top {
    display: none;
  }

  .brands-search-wrapper {
    max-width: none;
  }

  .brands-grid {
    gap: 12px;
  }

  .brand-letter-section {
    margin-bottom: 20px;
  }

  .brand-card {
    min-height: 148px;
    padding: 18px 12px;
    border-radius: 10px;
  }

  .brand-card-main {
    gap: 10px;
  }

  .brand-logo {
    width: 40px;
    height: 40px;
    font-size: 17px;
  }

  .brand-name {
    font-size: 13px;
  }

  .brand-letter-heading {
    width: 34px;
    height: 34px;
    border-radius: 6px;
    font-size: 16px;
  }

  .brand-view-link {
    font-size: 12px;
  }
}

@media (max-width: 640px) {
  .brands-grid {
    gap: 12px;
    justify-content: flex-start;
  }
}

@media (max-width: 360px) {
  .brands-grid {
    gap: 12px;
  }

  .brand-card {
    flex-basis: 100%;
    max-width: 200px;
  }
}
