/* ==================================================================
   HEADER SEARCH TRIGGER
   ================================================================== */

.gpl-search-trigger__inner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  height: 2.25rem;
  padding: 0 0.75rem;
  border-radius: 0.375rem;
  border: 1px solid hsl(var(--input, var(--border)));
  background: hsl(var(--background));
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.gpl-search-trigger__inner:hover {
  border-color: hsl(var(--ring, var(--foreground) / 0.3));
}

.gpl-search-trigger__inner svg {
  flex-shrink: 0;
  color: hsl(var(--muted-foreground));
}

.gpl-search-trigger__inner input {
  border: none;
  outline: none;
  background: transparent;
  font-size: 0.8125rem;
  color: hsl(var(--foreground));
  width: 100%;
  cursor: pointer;
}

.gpl-search-trigger__inner input::placeholder {
  color: hsl(var(--muted-foreground));
}

/* ==================================================================
   SEARCH POPUP OVERLAY
   ================================================================== */

.gpl-search-popup {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gpl-search-popup__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

/* ==================================================================
   SEARCH POPUP PANEL
   ================================================================== */

.gpl-search-popup__panel {
  position: relative;
  z-index: 1;
  width: 90vw;
  max-width: 900px;
  max-height: 80vh;
  background: hsl(var(--background));
  border-radius: 16px;
  box-shadow: 0 25px 80px -12px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Header / Search Bar */
.gpl-search-popup__header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid hsl(var(--border));
}

.gpl-search-popup__search-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.gpl-search-popup__search-bar svg {
  flex-shrink: 0;
  color: hsl(var(--muted-foreground));
}

.gpl-search-popup__search-bar input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 1rem;
  color: hsl(var(--foreground));
}

.gpl-search-popup__search-bar input::placeholder {
  color: hsl(var(--muted-foreground));
}

.gpl-search-popup__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.gpl-search-popup__close:hover {
  background: hsl(var(--muted-foreground) / 0.1);
  color: hsl(var(--foreground));
}

/* Body */
.gpl-search-popup__body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  flex: 1;
  overflow: hidden;
}

@media (max-width: 640px) {
  .gpl-search-popup__body {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
  }
}

/* Results List (Left) */
.gpl-search-popup__results {
  overflow-y: auto;
  padding: 0.5rem;
  border-right: 1px solid hsl(var(--border));
}

@media (max-width: 640px) {
  .gpl-search-popup__results {
    border-right: none;
    border-bottom: 1px solid hsl(var(--border));
  }
}

.gpl-search-popup__placeholder {
  text-align: center;
  color: hsl(var(--muted-foreground));
  font-size: 0.875rem;
  padding: 2rem 1rem;
  margin: 0;
}

.gpl-result {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s ease;
}

.gpl-result:hover,
.gpl-result.gpl-result--active {
  background: hsl(var(--muted-foreground) / 0.08);
}

.gpl-result__img {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid hsl(var(--border));
}

.gpl-result__title {
  font-size: 0.8125rem;
  font-weight: 500;
  color: hsl(var(--foreground));
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Detail Panel (Right) */
.gpl-search-popup__detail {
  overflow-y: auto;
  padding: 1.25rem;
}

.gpl-search-popup__detail-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 0.75rem;
  color: hsl(var(--muted-foreground));
  font-size: 0.875rem;
}

/* Detail Image */
.gpl-detail-image {
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 1rem;
  border: 1px solid hsl(var(--border));
}

.gpl-detail-image img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

/* Detail Info */
.gpl-detail-info {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.gpl-detail-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: hsl(var(--foreground));
  line-height: 1.3;
  margin: 0;
}

.gpl-detail-title a {
  color: hsl(var(--foreground));
  text-decoration: none;
}

.gpl-detail-title a:hover {
  text-decoration: underline;
}

.gpl-detail-sku {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  margin: 0;
}

.gpl-detail-sku span {
  font-weight: 600;
  font-family: monospace;
}

.gpl-detail-price {
  font-size: 1.25rem;
  font-weight: 700;
  color: hsl(var(--foreground));
}

.gpl-detail-divider {
  height: 1px;
  background: hsl(var(--border));
  margin: 0.5rem 0;
  width: 100%;
}

.gpl-detail-desc {
  font-size: 0.8125rem;
  line-height: 1.6;
  color: hsl(var(--muted-foreground));
}

/* Quantity + Add to Cart */
.gpl-detail-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.gpl-qty-control {
  display: inline-flex;
  align-items: center;
  border: 1px solid hsl(var(--border));
  border-radius: 8px;
  overflow: hidden;
}

.gpl-qty-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 36px;
  border: none;
  background: transparent;
  color: hsl(var(--foreground));
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.12s ease;
}

.gpl-qty-btn:hover {
  background: hsl(var(--muted-foreground) / 0.08);
}

.gpl-qty-input {
  width: 40px;
  height: 36px;
  text-align: center;
  border: none;
  border-left: 1px solid hsl(var(--border));
  border-right: 1px solid hsl(var(--border));
  outline: none;
  font-size: 0.875rem;
  font-weight: 600;
  color: hsl(var(--foreground));
  background: hsl(var(--background));
  -moz-appearance: textfield;
}

.gpl-qty-input::-webkit-outer-spin-button,
.gpl-qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.gpl-detail-cart-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  height: 36px;
  padding: 0 1.25rem;
  border-radius: 8px;
  border: none;
  background: #010869;
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease;
}

.gpl-detail-cart-btn:hover {
  background: #020a80;
  color: #fff;
}

.gpl-detail-cart-btn--link {
  text-align: center;
}

.gpl-detail-cart-btn.gpl-btn-loading {
  opacity: 0.7;
  pointer-events: none;
}
