/* ============================================================
   Search Results v2 — Design System
   Lime hero, tabs, filters, rich cards, infinite scroll
   ============================================================ */

/* --- Hero --- */
.search-hero {
  background: #CCEA4A;
  border-radius: 16px;
  padding: 40px;
  margin-top: 24px;
  margin-bottom: 24px;
}
.search-hero__eyebrow {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  background: #000;
  color: #fff;
  padding: 4px 14px;
  border-radius: 999px;
  margin-bottom: 12px;
}
.search-hero__title {
  font-size: 32px;
  font-weight: 800;
  line-height: 1.2;
  margin: 0 0 6px;
  color: #000;
}
.search-hero__subtitle {
  font-size: 14px;
  opacity: 0.6;
  margin: 0;
  color: #000;
}

/* --- Tabs --- */
.search-tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px dotted #e5e7eb;
  padding-bottom: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.search-tab {
  font-size: 13px;
  font-weight: 600;
  padding: 7px 18px;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #374151;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.search-tab:hover {
  background: #f5f5f5;
}
.search-tab--active,
.search-tab--active:hover {
  background: #000;
  color: #fff;
  border-color: #000;
}

/* --- Filters --- */
.search-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  border-bottom: 1px dotted #e5e7eb;
  padding-bottom: 12px;
  margin-bottom: 20px;
}
#styleFilters {
  display: contents;
}
.search-filter-pill {
  font-size: 12px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  background: #f5f5f5;
  color: #374151;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.search-filter-pill:hover {
  background: #e5e7eb;
}
.search-filter-pill--active,
.search-filter-pill--active:hover {
  background: #000;
  color: #CCEA4A;
  border-color: #000;
}
.search-filter-count {
  opacity: 0.5;
  font-size: 11px;
}
.search-filter-sep {
  width: 1px;
  height: 22px;
  background: #e2e8f0;
  flex-shrink: 0;
}
.search-free-toggle {
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid #16a34a;
  background: #16a34a;
  color: #fff;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.search-free-toggle:hover {
  background: #15803d;
}
.search-free-toggle--active {
  box-shadow: 0 0 0 2px #000;
}

/* --- Color circles --- */
.search-color-circles {
  display: flex;
  gap: 3px;
  align-items: center;
}
.search-color-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.1);
  cursor: pointer;
  padding: 0;
  transition: all 0.15s;
  flex-shrink: 0;
}
.search-color-dot:hover {
  transform: scale(1.2);
}
.search-color-dot--active {
  border: 2px solid #000;
  box-shadow: 0 0 0 2px #CCEA4A;
}

/* --- Sort --- */
.search-sort {
  font-size: 12px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #374151;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23666'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.search-clear-filters {
  font-size: 12px;
  color: #ef4444;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: underline;
  margin-left: auto;
}
.search-clear-filters:hover {
  color: #dc2626;
}

/* --- Section Headers --- */
.search-section {
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px dotted #e5e7eb;
}
.search-section:last-child {
  border-bottom: none;
}
.search-section__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.search-section__header h2 {
  font-size: 17px;
  font-weight: 800;
  margin: 0;
  color: #000;
}
.search-section__count {
  color: #9ca3af;
  font-weight: 500;
}
.search-section__showall {
  font-size: 13px;
  font-weight: 600;
  color: #000;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.15s;
}
.search-section__showall:hover {
  color: #16a34a;
}

/* --- Illustration Grid --- */
.illus-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}
.illus-card {
  border-radius: 10px;
  border: 1px solid #f0f0f0;
  overflow: hidden;
  background: #fff;
  transition: transform 0.15s, box-shadow 0.15s;
}
.illus-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.illus-card a {
  text-decoration: none;
  color: inherit;
  display: block;
}
.illus-card__img-wrap {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: #f8f9fa;
}
.illus-card__img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
/* Style badge hidden — distracts from illustration preview */
.illus-card__style-badge {
  display: none;
}
.illus-card__free-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 8px;
  font-weight: 700;
  background: #16a34a;
  color: #fff;
  padding: 2px 8px;
  border-radius: 4px;
}
.illus-card__info {
  padding: 8px;
}
.illus-card__name {
  font-size: 11px;
  font-weight: 700;
  color: #1a1a1a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.illus-card__pack {
  font-size: 11px;
  color: #9ca3af;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

/* --- Icon Grid --- */
.icon-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 8px;
}
.icon-card {
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #f8f9fa;
  text-decoration: none;
  color: inherit;
  display: block;
  transition: border-color 0.15s, background 0.15s;
  overflow: hidden;
}
.icon-card:hover {
  border-color: #CCEA4A;
  background: #fafff0;
}
.icon-card__img {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}
.icon-card__img img {
  max-width: 100%;
  max-height: 100%;
  display: block;
}
.icon-card__info {
  padding: 4px 8px 8px;
}
.icon-card__name {
  font-size: 11px;
  font-weight: 700;
  color: #1a1a1a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.icon-card__pack {
  font-size: 10px;
  color: #9ca3af;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

/* --- Pack Grid --- */
.pack-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
}
.pack-card {
  border-radius: 10px;
  border: 1px solid #f0f0f0;
  overflow: hidden;
  background: #fff;
  text-decoration: none;
  color: inherit;
  display: block;
  transition: transform 0.15s, box-shadow 0.15s;
}
.pack-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.pack-card__hero {
  aspect-ratio: 1;
  background: #f0f0f0;
  position: relative;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}
.pack-card__count {
  font-size: 10px;
  font-weight: 700;
  background: rgba(0,0,0,0.7);
  color: #CCEA4A;
  padding: 3px 10px;
  border-radius: 4px;
}
.pack-card__free {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 9px;
  font-weight: 700;
  background: #16a34a;
  color: #fff;
  padding: 2px 8px;
  border-radius: 4px;
}
.pack-card__info {
  padding: 10px;
}
.pack-card__name {
  font-size: 12px;
  font-weight: 700;
  color: #1a1a1a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pack-card__meta {
  font-size: 10px;
  color: #9ca3af;
  margin-top: 2px;
}

/* --- Related Searches --- */
.search-related {
  background: #fafafa;
  border-radius: 12px;
  padding: 24px;
  margin-top: 20px;
  margin-bottom: 40px;
}
.search-related h3 {
  font-size: 13px;
  font-weight: 700;
  margin: 0 0 12px;
  color: #000;
}
.search-related__pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.search-related__pills a {
  font-size: 12px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #374151;
  text-decoration: none;
  transition: all 0.15s;
}
.search-related__pills a:hover {
  background: #f0f0f0;
  border-color: #ccc;
}

/* --- Loading --- */
.search-loading {
  text-align: center;
  padding: 24px;
  font-size: 13px;
  color: #9ca3af;
}
.search-loading::before {
  content: '';
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid #e5e7eb;
  border-top-color: #000;
  border-radius: 50%;
  animation: searchSpin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}
@keyframes searchSpin {
  to { transform: rotate(360deg); }
}

/* --- No results --- */
.search-empty {
  text-align: center;
  padding: 60px 20px;
}
.search-empty__icon {
  font-size: 48px;
  margin-bottom: 16px;
}
.search-empty__title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}
.search-empty__text {
  font-size: 14px;
  color: #6b7280;
}

/* ============================================================
   Responsive
   ============================================================ */

/* Tablet */
@media (max-width: 1024px) {
  .illus-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  .icon-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

/* Mobile */
@media (max-width: 768px) {
  .search-hero {
    padding: 24px;
    border-radius: 12px;
    margin-top: 16px;
    margin-bottom: 16px;
  }
  .search-hero__title {
    font-size: 22px;
  }

  /* Mobile: hide All tab */
  .search-tab[data-tab="all"] {
    display: none;
  }

  /* Sticky tabs on mobile */
  .search-tabs {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #fff;
    padding-top: 10px;
    margin-left: -15px;
    margin-right: -15px;
    padding-left: 15px;
    padding-right: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.06);
  }

  /* Horizontal scroll filters */
  .search-filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 12px;
  }
  .search-filters::-webkit-scrollbar {
    display: none;
  }
  .search-filter-pill,
  .search-free-toggle {
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  /* Color dots larger for touch */
  .search-color-dot {
    width: 22px;
    height: 22px;
  }

  /* Grids */
  .illus-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .icon-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
  }
  .pack-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  /* Section header */
  .search-section__header h2 {
    font-size: 15px;
  }
}

/* Small mobile */
@media (max-width: 375px) {
  .search-hero {
    padding: 18px;
  }
  .search-hero__title {
    font-size: 20px;
  }
  .icon-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ── Free toggle switch (matches illustration-packs pattern) ── */
.search-free-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.search-free-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #333;
  white-space: nowrap;
}
.search-toggle-container {
  display: block;
  border: 2px solid #000;
  border-radius: 30px;
  width: 44px;
  height: 24px;
  background: #efefef;
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
}
.search-toggle-container:has(input:checked) {
  background: #000;
  border-color: #000;
}
.search-toggle-container:not(:has(input:checked)) {
  border-color: transparent;
}
.search-toggle-input {
  display: none;
}
.search-toggle-switch {
  display: block;
  width: 100%;
  height: 100%;
  cursor: pointer;
}
.search-toggle-switch:before {
  content: "";
  display: block;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: margin-left 0.2s;
}
.search-toggle-input:checked + .search-toggle-switch:before {
  margin-left: 20px;
}

/* ── Back button bar ── */
.search-back-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 0;
  margin-bottom: 8px;
  border-bottom: 1px dotted #e5e7eb;
}
.search-back-btn {
  background: none;
  border: 1px solid #ddd;
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #333;
  cursor: pointer;
  transition: all 0.15s;
}
.search-back-btn:hover {
  background: #f5f5f5;
  border-color: #000;
}
.search-back-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #000;
}

/* ── Pack cards matching site pack card style ── */
.pack-card {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #eee;
  text-decoration: none;
  color: inherit;
  display: block;
  transition: box-shadow 0.15s, transform 0.15s;
}
.pack-card:hover {
  box-shadow: 0 6px 16px rgba(0,0,0,0.1);
  transform: translateY(-2px);
  text-decoration: none;
  color: inherit;
}
/* pack-card__hero defined above — duplicate removed */
.pack-card__hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.pack-card__count {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: #000;
  color: #CCEA4A;
  font-size: 0.65rem;
  padding: 3px 10px;
  border-radius: 4px;
  font-weight: 600;
  z-index: 1;
}
.pack-card__free {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #16a34a;
  color: #fff;
  font-size: 0.6rem;
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 700;
}
.pack-card__info {
  padding: 10px 12px;
}
.pack-card__name {
  font-size: 0.8rem;
  font-weight: 700;
  color: #000;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pack-card__meta {
  font-size: 0.7rem;
  color: #999;
  margin-top: 2px;
}

/* --- Right-click prevention on search results --- */
.illus-card img,
.icon-card img,
.pack-card img {
  -webkit-user-drag: none;
  user-select: none;
  -webkit-touch-callout: none;
  pointer-events: auto;
}
.illus-card,
.icon-card {
  -webkit-user-select: none;
  user-select: none;
}
