/* ==========================================================================
   PK Cabinet — Client-side Search Overlay
   Matches design tokens from finished-product/src/index.css
   ========================================================================== */

 
/* ---- Design Tokens ---- */
:root {
  --pk-dark: #1a1a1a;
  --pk-muted: #6b6258;
  --pk-gold: #a89060;
  --pk-gold-dark: #8a7248;
  --pk-border: #e0dcd5;
  --pk-input-border: #c8c0b4;
  --pk-placeholder-bg: #eeebe6;
}

 
/* ---- Search Trigger Button (in navbar) ---- */
.pk-search-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--pk-muted, #6b6258);
  transition: color 0.2s;
  line-height: 1;
}
.pk-search-trigger:hover {
  color: var(--pk-dark, #1a1a1a);
}
.pk-search-trigger svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.5;
  display: block;
}
.pk-search-trigger__text {
  font-size: 13px;
  font-weight: 500;
  display: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
  line-height: 1.2;
}
.pk-search-trigger:hover .pk-search-trigger__text {
  border-color: var(--pk-dark, #1a1a1a);
}
@media (min-width: 640px) {
  .pk-search-trigger__text {
    display: inline;
  }
}
 
/* ---- Backdrop ---- */
.pk-search-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.2);
  z-index: 600;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}
.pk-search-backdrop.is-open {
  opacity: 1;
  visibility: visible;
}
 
/* ---- Main Panel ---- */
.pk-search-panel {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: #fff;
  z-index: 700;
  transform: translateY(-100%);
  transition: transform 0.2s ease;
  overflow-y: auto;
  max-height: 90vh;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}
.pk-search-panel.is-open {
  transform: translateY(0);
}
.pk-search-panel.has-results {
  max-height: 100vh;
}
 
/* ---- Top bar: input row ---- */
.pk-search-bar {
  height: 70px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  border-bottom: 1px solid var(--pk-border, #e0dcd5);
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 10;
}
@media (min-width: 768px) {
  .pk-search-bar {
    padding: 0 48px;
  }
}
.pk-search-bar__icon {
  flex-shrink: 0;
  color: var(--pk-muted, #6b6258);
  line-height: 0;
}
.pk-search-bar__icon svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.5;
}
.pk-search-bar__input {
  flex: 1;
  height: 100%;
  border: none;
  outline: none;
  font-size: 16px;
  font-family: inherit;
  color: var(--pk-dark, #1a1a1a);
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
}
.pk-search-bar__input::placeholder {
  color: var(--pk-muted, #6b6258);
}
/* Remove default search-input X in WebKit */
.pk-search-bar__input::-webkit-search-decoration,
.pk-search-bar__input::-webkit-search-cancel-button,
.pk-search-bar__input::-webkit-search-results-button,
.pk-search-bar__input::-webkit-search-results-decoration {
  display: none;
}
.pk-search-bar__close {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--pk-muted, #6b6258);
  line-height: 0;
  transition: color 0.2s;
}
.pk-search-bar__close:hover {
  color: var(--pk-dark, #1a1a1a);
}
.pk-search-bar__close svg {
  width: 24px;
  height: 24px;
  stroke-width: 1.5;
  display: block;
}
 
/* ---- Content Area ---- */
.pk-search-body {
  display: flex;
  flex-direction: column;
  gap: 32px;
  padding: 24px 16px 48px;
}
@media (min-width: 768px) {
  .pk-search-body {
    flex-direction: row;
    gap: 40px;
    padding: 40px 48px 48px;
  }
}
 
/* ---- Sidebar (left column) ---- */
.pk-search-sidebar {
  width: 100%;
}
@media (min-width: 768px) {
  .pk-search-sidebar {
    width: 200px;
    flex-shrink: 0;
  }
}
.pk-search-sidebar__title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--pk-muted, #6b6258);
  margin: 0 0 16px;
  font-family: inherit;
}
 
/* ---- Popular Searches ---- */
.pk-search-popular {
  display: flex;
  flex-wrap: wrap;
  gap: 0 16px;
}
@media (min-width: 768px) {
  .pk-search-popular {
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 0;
  }
}
.pk-search-popular__item {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--pk-muted, #6b6258);
  text-align: left;
  line-height: 32px;
  padding: 0;
  font-family: inherit;
  transition: color 0.2s;
}
.pk-search-popular__item:hover {
  color: var(--pk-dark, #1a1a1a);
}
 
/* ---- Recommended (right column, initial state) ---- */
.pk-search-recommended {
  flex: 1;
  min-width: 0;
}
.pk-search-carousel {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-snap-type: x mandatory;
}
.pk-search-carousel::-webkit-scrollbar {
  display: none;
}
.pk-search-carousel-item {
  width: 75%;
  flex-shrink: 0;
  scroll-snap-align: start;
  text-decoration: none;
  color: inherit;
}
@media (min-width: 480px) {
  .pk-search-carousel-item {
    width: 240px;
  }
}
@media (min-width: 768px) {
  .pk-search-carousel-item {
    width: 160px;
  }
}
.pk-search-card-mini {
  height: 200px;
  border: 1px solid var(--pk-border, #e0dcd5);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-radius: 2px;
}
.pk-search-card-mini__image {
  height: 65%;
  background: var(--pk-placeholder-bg, #eeebe6);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pk-search-card-mini__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}
.pk-search-carousel-item:hover .pk-search-card-mini__image img {
  transform: scale(1.05);
}
.pk-search-card-mini__body {
  flex: 1;
  padding: 10px 12px;
  background: #fff;
}
.pk-search-card-mini__name {
  font-size: 13px;
  color: var(--pk-dark, #1a1a1a);
  line-height: 1.35;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-family: inherit;
}
 
/* ---- Categories Filter (results state, left col) ---- */
.pk-search-filters-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
@media (min-width: 768px) {
  .pk-search-filters-toggle {
    display: block;
  }
}
.pk-search-toggle-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--pk-dark, #1a1a1a);
  padding: 0;
  font-family: inherit;
}
@media (min-width: 768px) {
  .pk-search-toggle-btn {
    display: none;
  }
}
.pk-search-categories {
  display: none;
}
.pk-search-categories.is-visible {
  display: flex;
  flex-direction: column;
}
@media (min-width: 768px) {
  .pk-search-categories {
    display: flex !important;
    flex-direction: column;
  }
}
.pk-search-category-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  line-height: 32px;
}
.pk-search-category-checkbox {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border: 1px solid var(--pk-border, #e0dcd5);
  border-radius: 2px;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  transition: background 0.15s, border-color 0.15s;
}
.pk-search-category-checkbox:checked {
  background: var(--pk-dark, #1a1a1a);
  border-color: var(--pk-dark, #1a1a1a);
}
.pk-search-category-checkbox:checked::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 6px;
  height: 9px;
  border: 2px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(40deg);
}
.pk-search-category-text {
  font-size: 14px;
  color: var(--pk-muted, #6b6258);
  font-family: inherit;
  transition: color 0.2s;
}
.pk-search-category-label:hover .pk-search-category-text {
  color: var(--pk-dark, #1a1a1a);
}
 
/* ---- Results Main (right col) ---- */
.pk-search-main {
  flex: 1;
  min-width: 0;
}
 
/* Results header row */
.pk-search-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: 24px;
}
.pk-search-results-count {
  font-size: 14px;
  color: var(--pk-muted, #6b6258);
  font-family: inherit;
  margin: 0;
}
 
/* Sort dropdown */
.pk-search-sort {
  position: relative;
}
.pk-search-sort__btn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--pk-muted, #6b6258);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
  transition: color 0.2s;
}
.pk-search-sort__btn:hover {
  color: var(--pk-dark, #1a1a1a);
}
.pk-search-sort__btn svg {
  width: 14px;
  height: 14px;
  transition: transform 0.2s;
  flex-shrink: 0;
}
.pk-search-sort__btn.is-open svg {
  transform: rotate(180deg);
}
.pk-search-sort__dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 200px;
  background: #fff;
  border: 1px solid var(--pk-border, #e0dcd5);
  border-radius: 2px;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.12);
  padding: 8px 0;
  z-index: 20;
}
.pk-search-sort__dropdown.is-open {
  display: block;
}
.pk-search-sort__option {
  display: block;
  width: 100%;
  padding: 8px 16px;
  font-size: 14px;
  font-family: inherit;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  color: var(--pk-muted, #6b6258);
  transition: background 0.15s, color 0.15s;
}
.pk-search-sort__option:hover {
  background: var(--pk-placeholder-bg, #eeebe6);
  color: var(--pk-dark, #1a1a1a);
}
.pk-search-sort__option.is-active {
  background: var(--pk-placeholder-bg, #eeebe6);
  color: var(--pk-dark, #1a1a1a);
  font-weight: 500;
}
 
/* Results grid */
.pk-search-results-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
@media (min-width: 1024px) {
  .pk-search-results-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
  }
}
 
/* ---- Product Card (full, in results grid) ---- */
.pk-search-product-card {
  text-decoration: none;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--pk-border, #e0dcd5);
  border-radius: 2px;
  overflow: hidden;
  background: #fff;
  height: 100%;
  transition: border-color 0.2s;
}
.pk-search-product-card:hover {
  border-color: var(--pk-input-border, #c8c0b4);
}
.pk-search-product-card__image {
  aspect-ratio: 4 / 5;
  background: var(--pk-placeholder-bg, #eeebe6);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pk-search-product-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}
.pk-search-product-card:hover .pk-search-product-card__image img {
  transform: scale(1.05);
}
.pk-search-product-card__body {
  flex: 1;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pk-search-product-card__name {
  font-size: 13px;
  font-weight: 500;
  color: var(--pk-dark, #1a1a1a);
  line-height: 1.35;
  margin: 0;
  min-height: 2.7em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-family: inherit;
}
@media (min-width: 768px) {
  .pk-search-product-card__name {
    font-size: 14px;
  }
}
.pk-search-product-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
}
.pk-search-product-card__rating {
  display: flex;
  align-items: center;
  gap: 3px;
  color: var(--pk-gold, #a89060);
}
.pk-search-product-card__rating svg {
  width: 10px;
  height: 10px;
  display: block;
}
.pk-search-product-card__rating-num {
  font-size: 11px;
  font-weight: 500;
  color: var(--pk-dark, #1a1a1a);
}
.pk-search-product-card__reviews {
  font-size: 11px;
  color: var(--pk-muted, #6b6258);
}
.pk-search-product-card__price {
  font-size: 14px;
  font-weight: 500;
  color: var(--pk-dark, #1a1a1a);
  margin: auto 0 0;
  font-family: inherit;
}
@media (min-width: 768px) {
  .pk-search-product-card__price {
    font-size: 15px;
  }
}
 
/* ---- Empty State ---- */
.pk-search-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  text-align: center;
}
.pk-search-empty__title {
  font-size: 16px;
  font-weight: 500;
  color: var(--pk-dark, #1a1a1a);
  margin: 0 0 8px;
  font-family: inherit;
}
.pk-search-empty__text {
  font-size: 14px;
  color: var(--pk-muted, #6b6258);
  margin: 0;
  font-family: inherit;
}
