/* Lubricalia Search Overlay */

/* ── Overlay container ─────────────────────────────── */
#ls-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
}
#ls-overlay.ls-open { display: flex; }

.ls-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
}

/* ── Panel ─────────────────────────────────────────── */
.ls-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 90%;
  max-width: 1100px;
  max-height: 85vh;
  margin: 4vh auto 0;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

/* ── Header ────────────────────────────────────────── */
.ls-header {
  padding: 16px 20px 8px;
  border-bottom: 1px solid #e8e8e8;
  flex-shrink: 0;
}

.ls-search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f5f5f5;
  border-radius: 8px;
  padding: 8px 14px;
  border: 2px solid transparent;
  transition: border-color 0.15s;
}
.ls-search-box:focus-within {
  border-color: #00a659;
  background: #fff;
}

.ls-search-icon {
  font-size: 16px;
  flex-shrink: 0;
  opacity: 0.5;
}

.ls-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 16px;
  outline: none;
  color: #222;
  font-family: inherit;
}
.ls-input::placeholder { color: #999; }

.ls-camera {
  font-size: 18px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 50%;
  transition: all 0.2s;
  opacity: 0.5;
  color: inherit;
  display: inline-flex;
  align-items: center;
}
.ls-camera:hover { opacity: 1; color: #00a659; }

.ls-visual-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: #00a659;
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
  line-height: 1.3;
}

.ls-card-img { position: relative; }

.ls-voice {
  font-size: 18px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 50%;
  transition: all 0.2s;
  opacity: 0.5;
}
.ls-voice:hover { opacity: 1; }
.ls-voice-active {
  opacity: 1;
  animation: ls-pulse 1s infinite;
  background: rgba(0, 166, 89, 0.1);
}
@keyframes ls-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

.ls-close {
  font-size: 24px;
  line-height: 1;
  background: none;
  border: none;
  color: #999;
  cursor: pointer;
  padding: 0 4px;
  transition: color 0.15s;
}
.ls-close:hover { color: #333; }

.ls-status {
  font-size: 13px;
  color: #666;
  padding: 6px 0 2px;
  min-height: 22px;
}

/* ── Body (facets + results) ───────────────────────── */
.ls-body {
  display: flex;
  overflow: hidden;
  flex: 1;
  min-height: 0;
}

/* ── Facets sidebar ────────────────────────────────── */
.ls-facets {
  width: 220px;
  flex-shrink: 0;
  padding: 12px 16px;
  border-right: 1px solid #eee;
  overflow-y: auto;
  font-size: 13px;
}

.ls-facet-group {
  margin-bottom: 14px;
}

.ls-facet-label {
  font-weight: 600;
  color: #333;
  margin-bottom: 6px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.ls-facet-options {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.ls-facet-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  font-size: 12px;
  color: #555;
  transition: all 0.15s;
  white-space: nowrap;
}
.ls-facet-btn:hover {
  border-color: #00a659;
  color: #00a659;
}
.ls-facet-btn.ls-facet-active {
  background: #00a659;
  border-color: #00a659;
  color: #fff;
}

.ls-facet-count {
  font-size: 10px;
  opacity: 0.6;
}

.ls-facet-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 13px;
  color: #555;
}
.ls-facet-toggle input { accent-color: #00a659; }

.ls-clear-filters {
  display: block;
  width: 100%;
  padding: 6px 10px;
  margin-bottom: 12px;
  border: 1px solid #dc3545;
  border-radius: 4px;
  background: #fff;
  color: #dc3545;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.15s;
}
.ls-clear-filters:hover {
  background: #dc3545;
  color: #fff;
}

/* ── Results grid ──────────────────────────────────── */
.ls-results {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
}

.ls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.ls-card {
  display: flex;
  flex-direction: column;
  border: 1px solid #eee;
  border-radius: 8px;
  overflow: hidden;
  text-decoration: none;
  color: #333;
  transition: box-shadow 0.15s, border-color 0.15s;
  background: #fff;
}
.ls-card:hover,
.ls-card.ls-selected {
  border-color: #00a659;
  box-shadow: 0 2px 12px rgba(0, 166, 89, 0.15);
}

.ls-card-img {
  aspect-ratio: 1;
  overflow: hidden;
  background: #f9f9f9;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ls-card-img img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.ls-card-body {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.ls-card-meta {
  display: flex;
  gap: 8px;
  font-size: 11px;
  color: #888;
}

.ls-brand {
  font-weight: 600;
  color: #00a659;
}

.ls-ref {
  font-family: monospace;
  font-size: 10px;
  color: #aaa;
}

.ls-card-title {
  font-size: 13px;
  line-height: 1.3;
  font-weight: 500;
  color: #222;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ls-card-title mark {
  background: #fff3cd;
  color: inherit;
  padding: 0 1px;
  border-radius: 2px;
}

.ls-price {
  font-size: 15px;
  font-weight: 700;
  color: #222;
  margin-top: auto;
}
.ls-price-request {
  font-size: 12px;
  font-weight: 600;
  color: #ff8c00;
}

.ls-stock {
  font-size: 11px;
}
.ls-stock-ok { color: #00a659; }
.ls-stock-req { color: #999; }

/* ── View all ──────────────────────────────────────── */
.ls-view-all-wrap {
  text-align: center;
  padding: 16px 0;
}
.ls-view-all {
  display: inline-block;
  padding: 10px 24px;
  background: #00a659;
  color: #fff;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  transition: background 0.15s;
}
.ls-view-all:hover { background: #008c4a; color: #fff; }

/* ── Quick order B2B ───────────────────────────────── */
.ls-quick-order-btn {
  display: inline-block;
  margin-top: 6px;
  background: none;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  color: #555;
  transition: all 0.15s;
}
.ls-quick-order-btn:hover { border-color: #00a659; color: #00a659; }

.ls-quick-panel {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
}
.ls-quick-textarea {
  width: 100%;
  font-family: monospace;
  font-size: 14px;
  padding: 12px;
  border: 2px solid #eee;
  border-radius: 8px;
  resize: vertical;
  outline: none;
}
.ls-quick-textarea:focus { border-color: #00a659; }
.ls-quick-submit {
  display: block;
  margin: 12px 0;
  padding: 10px 24px;
  background: #00a659;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
}
.ls-quick-submit:hover { background: #008c4a; }

.ls-quick-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f0;
}
.ls-quick-info { flex: 1; font-size: 13px; }
.ls-quick-qty { width: 50px; padding: 4px; text-align: center; border: 1px solid #ddd; border-radius: 4px; }
.ls-quick-add {
  background: #00a659;
  border: none;
  border-radius: 4px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 16px;
}
.ls-quick-add-all {
  display: block;
  width: 100%;
  margin-top: 16px;
  padding: 12px;
  background: #00a659;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
}
.ls-quick-add-all:hover { background: #008c4a; }

/* ── Responsive ────────────────────────────────────── */
@media (max-width: 768px) {
  .ls-panel {
    width: 100%;
    max-width: 100%;
    max-height: 100vh;
    margin: 0;
    border-radius: 0;
    height: 100vh;
  }

  .ls-body {
    flex-direction: column;
  }

  .ls-facets {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #eee;
    max-height: 120px;
    padding: 8px 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: flex-start;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .ls-facet-group {
    margin-bottom: 0;
    flex-shrink: 0;
  }

  .ls-facet-label { display: none; }

  .ls-facet-options {
    flex-wrap: nowrap;
  }

  .ls-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .ls-card-img { aspect-ratio: 4/3; }
  .ls-card-title { font-size: 12px; }
  .ls-price { font-size: 13px; }

  .ls-clear-filters {
    width: auto;
    margin-bottom: 0;
  }
}

@media (max-width: 480px) {
  .ls-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
  .ls-card-body { padding: 6px; }
}
