/* Remove all underlines from all elements */
* {
  text-decoration: none !important;
}

:root {
  --primary: #0d9488;
  --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;
}
.cats-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 === */
.cats-hero {
  position: relative;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}
.cats-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;
}
.sort-item {
  padding: 12px;
  cursor: pointer;
}
.sort-item:hover {
  background: var(--bg-muted);
}

/* Custom inline sort (mobile) */
/* removed inline-sort custom UI */

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

/* === Category Card === */
.cat-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(13, 148, 136, 0.45), rgba(255, 83, 51, 0.4))
      border-box;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.cat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-2);
}
.banner {
  position: relative;
  aspect-ratio: 16/6;
  background: #eef6f7;
}
.banner img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.6s ease;
}
.cat-card:hover .banner img {
  transform: scale(1.05);
}
.overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.1));
}

.cat-meta {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cat-title {
  font-weight: 900;
  font-size: 18px;
}
.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.count {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #374151;
}
.count svg {
  opacity: 0.7;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  border-radius: 12px;
  padding: 0 12px;
  font-weight: 800;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-outline {
  background: #fff;
  border: 1px solid var(--border);
  color: #111;
}
/* Shop-aligned focus and primary button styling */
.btn:focus-visible {
  outline: 2px solid rgba(13, 148, 136, 0.22);
  outline-offset: 2px;
}
.cat-card .btn-primary {
  background: linear-gradient(135deg, var(--primary), #0b7f75);
  color: #fff;
  border: 1px solid var(--primary);
  box-shadow: var(--shadow-1);
  transition: background-color 0.2s ease, box-shadow 0.2s ease,
    transform 0.2s ease;
}
.cat-card .btn-primary:hover {
  background: linear-gradient(135deg, #0b7f75, var(--primary));
  transform: translateY(-1px);
  box-shadow: var(--shadow-2);
}
.cat-card .btn-primary:active {
  transform: translateY(0) scale(0.99);
  box-shadow: var(--shadow-1);
}
.cat-card .btn-primary::after {
  content: "↗";
  font-size: 14px;
  line-height: 1;
  margin-inline-start: 6px;
}

/* Slightly smaller browse button inside category cards */
.cat-card .btn {
  height: 36px;
  padding: 0 10px;
  font-size: 14px;
}

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

/* Sticky counter */
.helper {
  position: sticky;
  bottom: calc(14px + env(safe-area-inset-bottom));
  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;
}

/* === Responsive (mobile-first tweaks) === */
@media (max-width: 640px) {
  .container {
    padding-inline: 12px;
  }
  .title {
    font-size: 22px;
    padding: 18px 0 6px;
  }
  .subtitle {
    font-size: 14px;
    margin-bottom: 14px;
  }
  /* Controls live inside header on mobile */
  .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;
  }
  .controls {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .ctrl {
    height: 42px;
  }
  .search {
    min-width: 0;
    width: 100%;
  }
  .sort {
    width: 100%;
  }
  .cats-hero {
    overflow: visible; /* allow native select to overflow */
  }
  /* Use custom list on mobile; hide native select */
  .sort-wrap {
    display: block;
    position: relative;
  }
  #sort {
    display: none;
  }
  /* dropdown full width under trigger inside header */
  .controls.in-header .sort-menu {
    position: absolute;
    right: 0;
    left: 0;
  }
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
  }
  .banner {
    aspect-ratio: 16/7; /* slightly taller on small screens */
  }
  .cat-title {
    font-size: 16px;
  }
  .pill {
    font-size: 12px;
    padding: 8px 12px;
  }
}

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