/* =====================================================
   SP Paint Filter v2.0 — Frontend CSS
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ── Root Wrap ── */
.sp-wrap {
  font-family: 'Inter', sans-serif;
  max-width: 1220px;
  margin: 32px auto;
  padding: 0 16px;
  color: #1a1a2e;
}

/* =====================================================
   TABS (top navigation)
   ===================================================== */
.sp-tabs-wrap {
  margin-bottom: 24px;
  border-bottom: 2px solid #e8eaf0;
}

.sp-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.sp-tab-btn {
  padding: 9px 20px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  transition: color .15s, border-color .15s;
  margin-bottom: -2px;
  white-space: nowrap;
}
.sp-tab-btn:hover { color: #2563eb; }
.sp-tab-btn.active {
  color: #2563eb;
  border-bottom-color: #2563eb;
  font-weight: 600;
  background: #eff4ff;
  border-radius: 6px 6px 0 0;
}

/* ── Body layout ── */
.sp-body {
  display: flex;
  gap: 28px;
  align-items: flex-start;
}

/* =====================================================
   SIDEBAR
   ===================================================== */
.sp-sidebar {
  width: 220px;
  min-width: 220px;
  background: #ffffff;
  border: 1.5px solid #e8eaf0;
  border-radius: 16px;
  padding: 20px 18px;
  flex-shrink: 0;
  box-shadow: 0 2px 12px rgba(0,0,0,.05);
  position: sticky;
  top: 100px;
}

.sp-sidebar-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1.5px solid #f0f1f5;
}

.sp-filter-group { margin-bottom: 6px; }

.sp-group-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #9094a8;
  margin-bottom: 10px;
}

.sp-group-toggle {
  cursor: pointer;
  user-select: none;
}
.sp-group-toggle:hover { color: #2563eb; }

.sp-toggle-icon {
  font-size: 16px;
  font-weight: 400;
  color: #9094a8;
  line-height: 1;
}

/* Radio list (Category) */
.sp-radio-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sp-radio-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 13.5px;
  color: #3d3f52;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.sp-radio-item:hover { background: #f4f5fb; }
.sp-radio-item.active {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #fff;
  font-weight: 600;
}
.sp-radio-item input[type="radio"] { display: none; }

/* Checkbox list */
.sp-check-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sp-check-item label {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 8px;
  border-radius: 7px;
  font-size: 13px;
  color: #3d3f52;
  cursor: pointer;
  transition: background .12s;
  user-select: none;
}
.sp-check-item label:hover { background: #f4f5fb; }

.sp-check-item input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: #2563eb;
  cursor: pointer;
  flex-shrink: 0;
}

/* Separator */
.sp-sep { border: none; border-top: 1.5px solid #f0f1f5; margin: 14px 0; }

/* Clear btn */
.sp-clear-btn {
  width: 100%;
  padding: 8px;
  background: none;
  border: 1.5px solid #fcd5d5;
  border-radius: 8px;
  color: #e03e3e;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.sp-clear-btn:hover { background: #fff5f5; }

/* =====================================================
   MAIN
   ===================================================== */
.sp-main { flex: 1; min-width: 0; }

/* Top bar */
.sp-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 10px;
}

.sp-result-count {
  font-size: 13.5px;
  color: #6b7280;
  font-weight: 500;
}
.sp-result-count strong { color: #1a1a2e; }

.sp-topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* View toggle */
.sp-view-toggle {
  display: flex;
  border: 1.5px solid #e0e2ed;
  border-radius: 8px;
  overflow: hidden;
}

.sp-view-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 7px 10px;
  background: #fff;
  border: none;
  color: #9094a8;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.sp-view-btn + .sp-view-btn { border-left: 1.5px solid #e0e2ed; }
.sp-view-btn:hover { background: #f4f5fb; color: #2563eb; }
.sp-view-btn.active { background: #2563eb; color: #fff; }

/* Sort */
.sp-sort {
  padding: 8px 36px 8px 12px;
  border: 1.5px solid #e0e2ed;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  color: #3d3f52;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center;
  appearance: none;
  cursor: pointer;
  transition: border-color .15s;
}
.sp-sort:focus { outline: none; border-color: #2563eb; }

/* Active chips */
.sp-active-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
  min-height: 0;
}
.sp-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: #eff4ff;
  border: 1px solid #c7d9ff;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  color: #2563eb;
  cursor: pointer;
  transition: background .15s;
}
.sp-chip:hover { background: #dce8ff; }
.sp-chip svg { width: 12px; height: 12px; }

/* =====================================================
   PRODUCT GRID
   ===================================================== */
.sp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 18px;
  transition: all .2s;
}

/* List view */
.sp-grid.sp-list-view {
  grid-template-columns: 1fr;
  gap: 12px;
}
.sp-grid.sp-list-view .sp-card {
  flex-direction: row;
  align-items: stretch;
}
.sp-grid.sp-list-view .sp-card-img-wrap {
  width: 120px;
  min-width: 120px;
  aspect-ratio: 1;
  flex-shrink: 0;
}
.sp-grid.sp-list-view .sp-card-body { padding: 14px 16px; }

/* ── Card ── */
.sp-card {
  background: #ffffff;
  border: 1.5px solid #ebebf2;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow .2s, transform .2s, border-color .2s;
  cursor: pointer;
  position: relative;
}
.sp-card:hover {
  box-shadow: 0 10px 30px rgba(37,99,235,.12);
  transform: translateY(-3px);
  border-color: #c7d9ff;
}
.sp-grid.sp-list-view .sp-card:hover { transform: translateX(3px); }

/* Image area */
.sp-card-img-wrap {
  background: linear-gradient(145deg, #f7f8fc, #eef0f8);
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow: hidden;
  position: relative;
}
.sp-card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform .3s;
}
.sp-card:hover .sp-card-img-wrap img { transform: scale(1.06); }

/* Badge */
.sp-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .05em;
  padding: 3px 9px;
  border-radius: 99px;
  text-transform: uppercase;
  box-shadow: 0 2px 6px rgba(245,158,11,.35);
  z-index: 1;
}

/* No image placeholder */
.sp-no-img {
  width: 80px;
  height: 80px;
  background: #e8eaf0;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9094a8;
  font-size: 28px;
}

/* Card body */
.sp-card-body { padding: 12px 14px 14px; flex: 1; }
.sp-card-name {
  font-size: 13px;
  font-weight: 700;
  color: #1a1a2e;
  line-height: 1.4;
  margin-bottom: 8px;
}
.sp-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 6px;
}
.sp-tag {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 99px;
  background: #f0f1f8;
  color: #5c6080;
}
.sp-tag.lid   { background: #ecfdf5; color: #059669; }
.sp-tag.shape { background: #fef3c7; color: #d97706; }
.sp-tag.neck  { background: #fdf2f8; color: #9333ea; }

/* Description */
.sp-card-desc {
  font-size: 12px;
  color: #6b7280;
  line-height: 1.5;
  margin: 6px 0 8px;
}

/* Spec badges */
.sp-card-specs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 8px 0 6px;
}
.sp-spec-item {
  font-size: 10.5px;
  padding: 2px 7px;
  background: #f0fdf4;
  color: #16a34a;
  border: 1px solid #bbf7d0;
  border-radius: 99px;
  font-weight: 500;
}

/* Material & MOQ footer */
.sp-card-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed #f0f1f5;
}
.sp-card-mat,
.sp-card-moq {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #9094a8;
  font-weight: 500;
}
.sp-card-moq {
  color: #2563eb;
  background: #eff4ff;
  padding: 2px 7px;
  border-radius: 99px;
}

/* Category count pill */
.sp-cat-count {
  margin-left: auto;
  font-size: 11px;
  background: #f0f1f8;
  color: #9094a8;
  padding: 1px 6px;
  border-radius: 99px;
  font-weight: 600;
}
.sp-radio-item.active .sp-cat-count {
  background: rgba(255,255,255,.25);
  color: #fff;
}

/* =====================================================
   SKELETON LOADER
   ===================================================== */
.sp-skeleton-wrap {
  grid-column: 1/-1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 18px;
  width: 100%;
}
.sp-skeleton {
  height: 250px;
  border-radius: 16px;
  background: linear-gradient(90deg, #f0f1f6 25%, #e4e6ee 50%, #f0f1f6 75%);
  background-size: 400% 100%;
  animation: sp-shimmer 1.4s ease infinite;
}
@keyframes sp-shimmer {
  0%   { background-position: 100% 50%; }
  100% { background-position:   0% 50%; }
}

/* No results */
.sp-empty {
  grid-column: 1/-1;
  text-align: center;
  padding: 60px 20px;
}
.sp-empty-icon { font-size: 48px; margin-bottom: 12px; }
.sp-empty h3 { font-size: 16px; color: #3d3f52; margin-bottom: 6px; }
.sp-empty p  { font-size: 13px; color: #9094a8; }

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 860px) {
  .sp-body { flex-direction: column; }
  .sp-sidebar {
    width: 100%;
    min-width: 0;
    position: static;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }
  .sp-sidebar-head { grid-column: 1/-1; border-bottom: 1.5px solid #f0f1f5; padding-bottom: 12px; }
  .sp-sep { display: none !important; }
  .sp-clear-btn { grid-column: 1/-1; }
  .sp-tabs { gap: 2px; }
  .sp-tab-btn { font-size: 12.5px; padding: 7px 14px; }
}
@media (max-width: 520px) {
  .sp-sidebar { grid-template-columns: 1fr; }
  .sp-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .sp-grid.sp-list-view .sp-card-img-wrap { width: 90px; min-width: 90px; }
}

/* =====================================================
   2-COLUMN SIZE GRID (dynamic sidebar)
   ===================================================== */
.sp-check-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 6px;
}
