* {
  text-decoration: none !important;
}
:root {
  --primary: #19bfd3;
  --accent: #ff5333;
  --success: #66b766;
  --ink: #0c0f14;
  --muted: #6b7280;
  --border: #e5e7eb;
  --bg: #fff;
  --bg-muted: #f6f7f9;
  --radius: 16px;
  --shadow-1: 0 8px 24px rgba(2, 6, 23, 0.06);
  --shadow-2: 0 12px 32px rgba(2, 6, 23, 0.08);
}
.cat-detail {
  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 ===== */
.hero {
  position: relative;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}
.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);
}
.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;
  flex-wrap: wrap;
  align-items: center;
  padding: 0 0 18px;
}
.ctrl {
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 0 12px;
  box-shadow: var(--shadow-1);
}
.search {
  flex: 1;
  min-width: 220px;
}

/* ===== Subcategories strip ===== */
.subcats {
  padding: 18px 0;
}
.subgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.subcard {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-1);
}
.subthumb {
  width: 100%;
  aspect-ratio: 1/1;
  background: #f8fafc;
}
.subthumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.subname {
  padding: 8px 10px;
  font-weight: 800;
}

/* ===== Layout ===== */
.page {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 18px;
  padding: 10px 0 24px;
}
@media (max-width: 980px) {
  .page {
    grid-template-columns: 1fr;
  }
}

/* ===== Filters ===== */
.filters {
  position: sticky;
  top: 12px;
}
.panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-1);
  overflow: hidden;
}
.panel + .panel {
  margin-top: 12px;
}
.panel h3 {
  margin: 0;
  padding: 12px 14px;
  font-size: 15px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.panel .body {
  padding: 12px 14px;
}
.filter-search {
  width: 100%;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0 10px;
  margin-bottom: 10px;
}
.checklist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
}
.checklist li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.muted {
  color: var(--muted);
  font-size: 13px;
}

/* ===== Sort + Grid ===== */
.sortbar {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-1);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sortbar .links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.sortbar a {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: #111;
  text-decoration: none;
}
.sortbar a.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-1);
  display: flex;
  flex-direction: column;
}
.thumb {
  position: relative;
  aspect-ratio: 1/1;
  overflow: hidden;
}
.first-image,
.second-image {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transition: opacity 0.25s ease;
}
.second-image {
  opacity: 0;
}
.card:hover .second-image {
  opacity: 1;
}
.card h3 {
  margin: 10px 10px 6px;
  font-size: 14px;
  line-height: 1.6;
  height: 44px;
  overflow: hidden;
}
.meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 10px 12px;
}
.price .real-price {
  color: #6b7280;
  text-decoration: line-through;
  font-size: 12px;
}
.price .off-price {
  font-weight: 900;
}

/* ===== Pagination ===== */
.pagination {
  margin-top: 16px;
  display: flex;
  justify-content: center;
}
.pagination ul {
  display: flex;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  text-decoration: none;
  color: #111;
}

/* ===== Responsive (mobile-first tweaks) ===== */
@media (max-width: 640px) {
  .container {
    padding-inline: 12px;
  }
  .hero {
    overflow: visible; /* prevent clipping of children */
  }
  .hero-inner {
    position: relative;
    z-index: 1; /* ensure content sits above decorative layers */
  }
  .hero::before {
    z-index: 0; /* push the glow behind content */
  }
  .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: 40px;
  }
  .search {
    min-width: 0;
    width: 100%;
  }
  .subgrid {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }
  .page {
    grid-template-columns: 1fr;
  }
  .filters {
    position: static;
  }
  .panel {
    position: relative;
    z-index: 1;
  }
  .sortbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    position: relative;
    z-index: 2; /* above panels and cards */
  }
  .sortbar .links {
    gap: 8px;
  }
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
  }
  .card h3 {
    font-size: 13px;
    height: 40px;
  }
  .pagination ul {
    flex-wrap: wrap;
    justify-content: center;
  }
}

@media (max-width: 420px) {
  .subgrid {
    grid-template-columns: repeat(2, 1fr);
  }
  .grid {
    grid-template-columns: 1fr;
  }
  .title {
    font-size: 20px;
  }
}
