* {
  text-decoration: none !important;
}
:root {
  --primary: #19bfd3;
  --accent: #ff5333;
  --success: #66b766;
  --ink: #0c0f14;
  --muted: #6b7280;
  --border: #e5e7eb;
  --bg: #fff;
  --bg-muted: #f6f7f9;
  --shadow-1: 0 8px 24px rgba(2, 6, 23, 0.06);
  --shadow-2: 0 12px 32px rgba(2, 6, 23, 0.08);
  --radius: 16px;
}
.brands-page {
  direction: rtl;
  background: radial-gradient(
      1200px 400px at 100% -100px,
      #e7fbff 0%,
      transparent 60%
    ),
    var(--bg-muted);
}
.container {
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: 16px;
}

/* === Hero / Controls === */
.brands-hero {
  position: relative;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}
.brands-hero::before {
  content: "";
  position: absolute;
  inset: auto -40px -60px auto;
  width: 380px;
  height: 380px;
  background: radial-gradient(
    closest-side,
    rgba(25, 191, 211, 0.25),
    transparent 70%
  );
  filter: blur(6px);
  pointer-events: none;
}
.hero-inner {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: end;
}
@media (max-width: 860px) {
  .hero-inner {
    grid-template-columns: 1fr;
  }
}
.title {
  margin: 0;
  padding: 22px 0 8px;
  font-size: 28px;
  font-weight: 900;
  color: #0c0f14;
}
.subtitle {
  margin: 0 0 18px;
  color: #4b5563;
}
.controls {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding: 0 0 18px;
}
.ctrl {
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 0 12px;
  box-shadow: var(--shadow-1);
}
.search {
  flex: 1;
  min-width: 220px;
}
.sort {
  width: 220px;
}

/* Custom inline sort (mobile) */
.sort-wrap {
  display: none;
  width: 100%;
}
.sort-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 0 12px;
  box-shadow: var(--shadow-1);
  font-weight: 800;
}
.sort-menu {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-2);
  overflow: hidden;
}
.sort-wrap[hidden] {
  display: none !important;
}
.mobile-sort-dock {
  display: none;
}
.sort-item {
  padding: 12px;
  cursor: pointer;
}
.sort-item:hover {
  background: var(--bg-muted);
}

/* === Grid === */
.section {
  padding: 24px 0;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}

/* === Brand Card === */
.brand-card {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
  border: 1px solid transparent;
  box-shadow: var(--shadow-1);
  background: linear-gradient(#fff, #fff) padding-box,
    linear-gradient(135deg, rgba(25, 191, 211, 0.6), rgba(255, 83, 51, 0.6))
      border-box;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.brand-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-2);
}
.brand-banner {
  position: relative;
  aspect-ratio: 16/6;
  background: #ecf5f7;
  display: block;
}
.brand-banner img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  transition: transform 0.6s ease;
}
.brand-card:hover .brand-banner img {
  transform: scale(1.03);
}
.badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: linear-gradient(45deg, var(--primary), #33d4e7);
  color: #fff;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  box-shadow: var(--shadow-2);
}

.brand-meta {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.brand-title {
  font-weight: 900;
  display: flex;
  align-items: center;
  gap: 8px;
}
.thumbs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.thumbs a {
  display: block;
}
.thumbs img {
  width: 100%;
  aspect-ratio: 1/1;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
  background-image: linear-gradient(
    90deg,
    #f0f3f6 0%,
    #fafcff 50%,
    #f0f3f6 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite linear;
}
@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

.card-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: auto;
}
@media (max-width: 520px) {
  .card-actions {
    grid-template-columns: 1fr;
  }
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  border-radius: 12px;
  padding: 0 12px;
  font-weight: 800;
  transition: transform 0.15s ease, box-shadow 0.15s ease,
    background-color 0.2s ease, color 0.2s ease;
}
.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-1);
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  filter: brightness(1.05);
  box-shadow: var(--shadow-2);
}
.btn-outline {
  background: #fff;
  border: 1px solid var(--border);
  color: #111;
}
.btn-outline:hover {
  background: var(--bg-muted);
  border-color: #d1d5db;
}

.empty {
  background: #fff;
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  color: #6b7280;
}

.helper {
  position: sticky;
  bottom: calc(14px + env(safe-area-inset-bottom));
  margin-top: 16px;
  z-index: 10;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  padding: 10px 14px;
  border-radius: 999px;
  box-shadow: var(--shadow-2);
  font-weight: 800;
}

/* === Brand-specific polishing for Nike / اکتیو === */
.brand-card[data-name="نایک"],
.brand-card[data-name="nike"] {
  background: linear-gradient(#fff, #fff) padding-box,
    linear-gradient(135deg, #06b6d4, #10b981) border-box;
}
.brand-card[data-name="نایک"] .brand-banner,
.brand-card[data-name="nike"] .brand-banner {
  background: radial-gradient(
      600px 220px at 100% -60px,
      rgba(16, 185, 129, 0.18),
      transparent 60%
    ),
    linear-gradient(135deg, #e9fbff, #eefdf7);
}
.brand-card[data-name="نایک"] .btn-primary,
.brand-card[data-name="nike"] .btn-primary {
  background: linear-gradient(135deg, #06b6d4, #0ea5e9);
  color: #fff;
}

.brand-card[data-name="اکتیو"],
.brand-card[data-name="active"] {
  background: linear-gradient(#fff, #fff) padding-box,
    linear-gradient(135deg, #06b6d4, #10b981) border-box;
}
.brand-card[data-name="اکتیو"] .brand-banner,
.brand-card[data-name="active"] .brand-banner {
  background: radial-gradient(
      600px 220px at 100% -60px,
      rgba(16, 185, 129, 0.18),
      transparent 60%
    ),
    linear-gradient(135deg, #e9fbff, #eefdf7);
}
.brand-card[data-name="اکتیو"] .btn-primary,
.brand-card[data-name="active"] .btn-primary {
  background: linear-gradient(135deg, #06b6d4, #0ea5e9);
  color: #fff;
}

/* Subtle banner overlay for better contrast */
.brand-banner::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0) 0%,
    rgba(0, 0, 0, 0.03) 100%
  );
}

/* Typography and spacing tweaks inside card */
.brand-title a {
  font-size: 18px;
  color: #0c0f14;
}
.brand-meta {
  gap: 12px;
}

/* Thumb polish */
.thumbs img {
  border-radius: 12px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.thumbs a:hover img {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(2, 6, 23, 0.12);
}

/* Button shape */
.card-actions .btn {
  height: 42px;
  border-radius: 14px;
}
/* Small count badge next to brand name */
.brand-count {
  font-weight: 700;
  font-size: 12px;
  color: var(--muted);
  background: #f3f4f6;
  border-radius: 999px;
  padding: 2px 8px;
  line-height: 1.8;
}

/* === Responsive (mobile-first tweaks) === */
@media (max-width: 640px) {
  /* Controls live inside header on mobile */
  .brands-hero {
    overflow: visible;
  }
  .site-header .mobile-controls-host {
    padding: 8px 12px;
    background: #fff;
    box-shadow: var(--shadow-1);
    position: sticky;
    top: var(--header-height, 0px);
    z-index: 100;
  }
  .controls.in-header {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
  }
  .sort {
    position: relative;
    z-index: 101;
    background-color: #fff;
  }
  .container {
    padding-inline: 12px;
  }
  .title {
    font-size: 22px;
    padding: 18px 0 6px;
  }
  .subtitle {
    font-size: 14px;
    margin-bottom: 14px;
  }
  .controls {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .ctrl {
    height: 42px;
  }
  .search {
    min-width: 0;
    width: 100%;
  }
  .sort {
    width: 100%;
  }
  /* Use custom list on mobile; hide native select */
  .sort-wrap {
    display: block;
    position: relative;
  }
  #sort {
    display: none;
  }
  /* Make dropdown overlay expand full width under trigger inside header */
  .controls.in-header .sort-menu {
    position: absolute;
    right: 0;
    left: 0;
  }
  .brand-banner {
    aspect-ratio: 16/7; /* a bit taller on small screens */
  }
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
  }
  .brand-title {
    flex-wrap: wrap;
  }
  .brand-title a {
    font-size: 16px;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .brand-count {
    margin-top: 4px;
  }
  .thumbs {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }
  .pill {
    font-size: 12px;
    padding: 8px 12px;
  }
}

@media (max-width: 420px) {
  .grid {
    grid-template-columns: 1fr;
  }
  .thumbs {
    grid-template-columns: repeat(2, 1fr);
  }
  .brand-banner {
    aspect-ratio: 16/8;
  }
  .title {
    font-size: 20px;
  }
}

/* === Mobile fixed sort dock and bottom sheet === */
.mobile-sort-sheet {
  position: fixed;
  inset: 0 0 0 0;
  background: rgba(2, 6, 23, 0.35);
  backdrop-filter: blur(2px);
  z-index: 1000;
  display: grid;
  align-items: end;
}
.mobile-sort-sheet .sheet-panel {
  background: #fff;
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  box-shadow: var(--shadow-2);
  transform: translateY(100%);
  transition: transform 0.28s ease;
}
.mobile-sort-sheet.open .sheet-panel {
  transform: translateY(0);
}
.mobile-sort-sheet .sheet-title {
  margin: 0;
  font-size: 16px;
  font-weight: 900;
  padding: 10px 16px 0;
}
.mobile-sort-sheet .sheet-handle {
  width: 40px;
  height: 4px;
  background: #cbd5e1;
  border-radius: 999px;
  margin: 8px auto 0;
}
.mobile-sort-sheet .sheet-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0 0 10px;
}
.mobile-sort-sheet .sheet-item {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  cursor: pointer;
}
.mobile-sort-sheet .sheet-item:first-child {
  border-top: none;
}
.mobile-sort-sheet .sheet-item:hover {
  background: var(--bg-muted);
}

@media (max-width: 640px) {
  .mobile-sort-dock {
    display: grid;
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(10px + env(safe-area-inset-bottom));
    z-index: 999;
    place-items: center;
    pointer-events: none;
  }
  .mobile-sort-dock .dock-btn {
    pointer-events: auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 42px;
    border-radius: 999px;
    padding: 0 16px;
    background: #111827;
    color: #fff;
    box-shadow: var(--shadow-2);
    border: 0;
    font-weight: 800;
  }
  .mobile-sort-sheet .sheet-panel {
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
  }
}
