/* ── Quick Sell Page (brand gold theme) ── */
.quick-sell-page {
  min-height: 100%;
}

.quick-sell-page.has-cart {
  padding-bottom: 80px;
}

/* ── Header ── */
.qs-header-row,
.qs-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.qs-title-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  border-left: 4px solid var(--color-brand);
  padding-left: var(--space-sm);
}

.qs-title-wrap .page-title-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  transition: background 0.2s ease, color 0.2s ease;
  flex-shrink: 0;
}

.qs-title-wrap .page-title-back:hover {
  background: var(--color-brand-soft);
  color: var(--color-brand-dark);
}

.qs-title-wrap .page-title-back svg {
  width: 20px;
  height: 20px;
}

.qs-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.qs-full-sell-link {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

/* ── Search Hero ── */
.qs-search-hero {
  margin-top: var(--space-lg);
  padding: var(--space-md) var(--space-lg);
  background: linear-gradient(135deg, var(--color-brand-soft) 0%, #fff 100%);
  border: 1px solid var(--color-brand-muted);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.qs-search-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
}

.qs-search-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}

.qs-search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 0 14px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.qs-search-box:focus-within {
  border-color: var(--color-brand);
  box-shadow: 0 0 0 3px var(--color-focus-ring);
}

.qs-search-box svg {
  width: 20px;
  height: 20px;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.qs-search-box input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  font-family: var(--font-bn);
  font-size: var(--text-md);
  color: var(--color-text-primary);
  background: transparent;
}

.qs-search-box input::placeholder {
  color: var(--color-text-muted);
}

.qs-barcode-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: 1px solid var(--color-brand-muted);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-brand-dark);
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.qs-barcode-btn:hover {
  background: var(--color-brand-soft);
  border-color: var(--color-brand);
}

.qs-barcode-btn svg {
  width: 22px;
  height: 22px;
}

.qs-search-hint {
  margin: 8px 0 0;
  font-family: var(--font-bn);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* Search dropdown */
.qs-search-results {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 100;
  max-height: 280px;
  overflow-y: auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}

.qs-search-results.is-open {
  display: block;
}

.qs-search-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 10px 14px;
  border: none;
  border-bottom: 1px solid var(--color-border-light);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease;
}

.qs-search-item:last-child {
  border-bottom: none;
}

.qs-search-item:hover,
.qs-search-item.is-highlighted {
  background: var(--color-brand-soft);
}

.qs-search-item:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.qs-search-item-name {
  font-family: var(--font-bn);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-primary);
}

.qs-search-item-meta {
  font-family: var(--font-bn);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: 2px;
}

.qs-search-item-meta.is-low-stock {
  color: #dc2626;
}

.qs-search-item-price {
  font-family: var(--font-en);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-brand-dark);
  white-space: nowrap;
}

.qs-search-empty {
  padding: 14px;
  font-family: var(--font-bn);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  text-align: center;
}

/* ── Main Layout ── */
.qs-layout {
  display: flex;
  gap: var(--space-lg);
  margin-top: var(--space-lg);
  align-items: flex-start;
}

.qs-grid-panel {
  flex: 1;
  min-width: 0;
}

.qs-filter-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: var(--space-md);
  flex-wrap: wrap;
}

.qs-filter-tab {
  padding: 6px 14px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-family: var(--font-bn);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-secondary);
  background: var(--color-surface);
  cursor: pointer;
  transition: all 0.2s ease;
}

.qs-filter-tab:hover {
  border-color: var(--color-brand);
  color: var(--color-brand-dark);
}

.qs-filter-tab.is-active {
  background: var(--color-brand);
  border-color: var(--color-brand);
  color: #111827;
}

.qs-product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.qs-product-grid.is-hidden {
  display: none;
}

.qs-product-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 12px;
  min-height: 100px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface);
  text-align: left;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  box-shadow: var(--shadow-sm);
}

.qs-product-tile:hover {
  border-color: var(--color-brand);
  box-shadow: var(--shadow-hover);
}

.qs-product-tile:active {
  transform: scale(0.97);
}

.qs-product-tile:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.qs-tile-name {
  font-family: var(--font-bn);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-primary);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.qs-tile-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  width: 100%;
}

.qs-tile-price {
  font-family: var(--font-en);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-brand-dark);
  background: var(--color-brand-soft);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.qs-tile-stock {
  font-family: var(--font-en);
  font-size: 10px;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-left: auto;
}

.qs-grid-empty {
  padding: var(--space-xl);
  text-align: center;
  font-family: var(--font-bn);
  color: var(--color-text-muted);
}

.qs-grid-empty.is-hidden {
  display: none;
}

/* ── Cart Panel ── */
.qs-cart-panel {
  width: 340px;
  flex-shrink: 0;
  position: sticky;
  top: var(--space-md);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 120px);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-top: 3px solid var(--color-brand);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.qs-cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md);
  border-bottom: 1px solid var(--color-border-light);
}

.qs-cart-title {
  font-family: var(--font-bn);
  font-size: var(--text-md);
  font-weight: 700;
  color: var(--color-text-primary);
}

.qs-item-count {
  font-family: var(--font-bn);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-brand-dark);
  background: var(--color-brand-soft);
  padding: 2px 8px;
  border-radius: 999px;
}

.qs-cart-lines {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-sm);
  min-height: 120px;
}

.qs-cart-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100px;
  font-family: var(--font-bn);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.qs-cart-empty.is-hidden {
  display: none;
}

.qs-cart-line {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  margin-bottom: 6px;
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  background: #fafafa;
}

.qs-cart-line-name {
  flex: 1;
  min-width: 0;
  font-family: var(--font-bn);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.qs-qty-stepper {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.qs-qty-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--touch-min);
  height: var(--touch-min);
  border: 1px solid var(--color-border);
  border-radius: 50%;
  background: var(--color-surface);
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  color: var(--color-text-primary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.qs-qty-btn:hover {
  border-color: var(--color-brand);
  background: var(--color-brand-soft);
  color: var(--color-brand-dark);
}

.qs-qty-btn.minus:hover {
  border-color: #fca5a5;
  background: #fef2f2;
  color: #dc2626;
}

.qs-qty-value {
  min-width: 20px;
  text-align: center;
  font-family: var(--font-en);
  font-size: var(--text-sm);
  font-weight: 700;
}

.qs-cart-line-total {
  font-family: var(--font-en);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-text-primary);
  white-space: nowrap;
  min-width: 56px;
  text-align: right;
}

.qs-cart-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--touch-min);
  height: var(--touch-min);
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.15s ease, background 0.15s ease;
}

.qs-cart-remove:hover {
  color: #dc2626;
  background: #fef2f2;
}

.qs-cart-remove svg {
  width: 16px;
  height: 16px;
}

.qs-cart-footer {
  padding: var(--space-md);
  border-top: 1px solid var(--color-border-light);
  background: var(--color-brand-soft);
}

.qs-total-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.qs-total-label {
  font-family: var(--font-bn);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-secondary);
}

.qs-grand-total {
  font-family: var(--font-en);
  font-size: 28px;
  font-weight: 700;
  color: var(--color-brand-dark);
  letter-spacing: -0.02em;
}

.qs-pay-btn {
  width: 100%;
  justify-content: center;
  height: 52px !important;
  font-size: var(--text-md) !important;
  box-shadow: var(--shadow-brand);
}

.qs-pay-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

/* ── Sticky Checkout Bar (mobile) ── */
.qs-checkout-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: 12px var(--space-md);
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
}

.qs-checkout-bar.is-hidden {
  display: none;
}

.qs-checkout-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.qs-checkout-count {
  font-family: var(--font-bn);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.qs-checkout-total {
  font-family: var(--font-en);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-brand-dark);
}

.qs-checkout-btn {
  white-space: nowrap;
  padding: 10px 20px !important;
  box-shadow: var(--shadow-brand);
}

.qs-checkout-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

/* ── Toast ── */
.qs-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  z-index: 300;
  min-width: 280px;
  max-width: 90vw;
  padding: 14px 18px;
  background: #111827;
  color: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  transition: transform 0.3s ease;
}

.qs-toast.is-visible {
  transform: translateX(-50%) translateY(0);
}

.qs-toast.has-actions {
  bottom: 96px;
}

.qs-toast-msg {
  display: block;
  font-family: var(--font-bn);
  font-size: var(--text-sm);
  font-weight: 600;
}

.qs-toast-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.qs-toast-actions.is-hidden {
  display: none;
}

.qs-toast-btn {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.1);
  font-family: var(--font-bn);
  font-size: var(--text-xs);
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: background 0.15s ease;
}

.qs-toast-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ── Responsive ── */
@media (min-width: 993px) {
  .qs-checkout-bar {
    display: none !important;
  }

  .quick-sell-page.has-cart {
    padding-bottom: 0;
  }
}

@media (max-width: 992px) {
  .quick-sell-page.has-cart {
    padding-bottom: 80px;
  }

  .qs-layout {
    flex-direction: column;
  }

  .qs-cart-panel {
    width: 100%;
    position: static;
    max-height: none;
  }

  .qs-pay-btn {
    display: none;
  }

  .qs-toast.has-actions {
    bottom: 96px;
  }
}

@media (max-width: 768px) {
  .qs-search-hero {
    padding: var(--space-md);
  }

  .qs-header-actions {
    width: 100%;
  }

  .qs-header-actions .btn-outline,
  .qs-full-sell-link {
    flex: 1;
    justify-content: center;
  }

  .qs-product-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }
}
