/* Elyxr Mission Control - Product List Component */
/* Typography: Orbitron (display) + Space Mono (functional) */

.product-list-container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.product-search-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  align-items: center;
}

.product-search-bar input {
  flex: 1;
  padding: 14px 16px;
  font-family: 'Space Mono', monospace;
  font-size: 0.875rem;
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: 2px;
  transition: all 0.2s;
  background: rgba(5, 5, 8, 0.8);
  color: #f8fafc;
}

.product-search-bar input::placeholder {
  color: rgba(248, 250, 252, 0.4);
}

.product-search-bar input:focus {
  outline: none;
  border-color: var(--primary-color, #8b5cf6);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
  background: rgba(10, 10, 16, 0.9);
}

.product-search-bar button {
  padding: 14px 18px;
  font-size: 1.1rem;
  border: 1px solid var(--primary-color, #8b5cf6);
  border-radius: 2px;
  background: transparent;
  color: var(--primary-color, #8b5cf6);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}

.product-search-bar button:hover {
  background: var(--primary-color, #8b5cf6);
  color: #050508;
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.3);
}

.product-search-bar button:active {
  transform: scale(0.98);
}

/* Sorting buttons */
.sorting-buttons {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  justify-content: flex-end;
}

.sort-btn {
  padding: 8px 16px;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: 2px;
  background-color: rgba(139, 92, 246, 0.03);
  color: rgba(248, 250, 252, 0.5);
  cursor: pointer;
  transition: all 0.2s;
  min-width: 50px;
}

.sort-btn:hover {
  border-color: rgba(139, 92, 246, 0.4);
  background-color: rgba(139, 92, 246, 0.08);
  color: rgba(248, 250, 252, 0.8);
}

.sort-btn.active {
  border-color: var(--primary-color, #8b5cf6);
  background-color: var(--primary-color, #8b5cf6);
  color: #050508;
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.3);
}

.sort-btn.active.asc::after {
  content: ' ↑';
  font-size: 10px;
}

.sort-btn.active.desc::after {
  content: ' ↓';
  font-size: 10px;
}

/* Category headers */
.category-header {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--primary-color, #8b5cf6);
  padding: 12px 14px;
  margin-top: 20px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--primary-color, #8b5cf6);
  background: linear-gradient(to right, rgba(139, 92, 246, 0.08), transparent);
  border-radius: 2px;
  grid-column: 1 / -1;
}

.category-header:first-child {
  margin-top: 0;
}

.product-list {
  display: grid;
  gap: 12px;
  overflow-y: auto;
  flex: 1;
  max-height: 500px;
  padding: 4px;
  transition: all 0.3s ease;
}

/* Zoom levels */
.product-list[data-zoom="1"] {
  grid-template-columns: repeat(1, 1fr);
  gap: 16px;
}

.product-list[data-zoom="1"] .product-item {
  padding: 20px;
}

.product-list[data-zoom="1"] .product-image {
  width: 80px;
  height: 80px;
  font-size: 40px;
}

.product-list[data-zoom="1"] .product-name {
  font-size: 0.85rem;
}

.product-list[data-zoom="1"] .product-upc,
.product-list[data-zoom="1"] .product-quantity,
.product-list[data-zoom="1"] .product-type-badge {
  font-size: 0.75rem;
}

.product-list[data-zoom="2"],
.product-list[data-zoom="3"] {
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.product-list[data-zoom="2"] .product-item,
.product-list[data-zoom="3"] .product-item {
  padding: 16px;
}

.product-list[data-zoom="2"] .product-image,
.product-list[data-zoom="3"] .product-image {
  width: 60px;
  height: 60px;
  font-size: 32px;
}

.product-list[data-zoom="2"] .product-name,
.product-list[data-zoom="3"] .product-name {
  font-size: 0.75rem;
}

.product-list[data-zoom="2"] .product-upc,
.product-list[data-zoom="2"] .product-quantity,
.product-list[data-zoom="2"] .product-type-badge,
.product-list[data-zoom="3"] .product-upc,
.product-list[data-zoom="3"] .product-quantity,
.product-list[data-zoom="3"] .product-type-badge {
  font-size: 0.65rem;
}

.product-list[data-zoom="4"],
.product-list[data-zoom="5"] {
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.product-list[data-zoom="4"] .product-item,
.product-list[data-zoom="5"] .product-item {
  padding: 12px;
}

.product-list[data-zoom="4"] .product-image,
.product-list[data-zoom="5"] .product-image {
  width: 44px;
  height: 44px;
  font-size: 24px;
}

.product-list[data-zoom="4"] .product-name,
.product-list[data-zoom="5"] .product-name {
  font-size: 0.65rem;
}

.product-list[data-zoom="4"] .product-upc,
.product-list[data-zoom="4"] .product-quantity,
.product-list[data-zoom="4"] .product-type-badge,
.product-list[data-zoom="5"] .product-upc,
.product-list[data-zoom="5"] .product-quantity,
.product-list[data-zoom="5"] .product-type-badge {
  font-size: 0.55rem;
}

.product-list[data-zoom="6"],
.product-list[data-zoom="7"] {
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.product-list[data-zoom="6"] .product-item,
.product-list[data-zoom="7"] .product-item {
  padding: 10px;
}

.product-list[data-zoom="6"] .product-image,
.product-list[data-zoom="7"] .product-image {
  width: 32px;
  height: 32px;
  font-size: 18px;
}

.product-list[data-zoom="6"] .product-name,
.product-list[data-zoom="7"] .product-name {
  font-size: 0.55rem;
}

.product-list[data-zoom="6"] .product-upc,
.product-list[data-zoom="6"] .product-quantity,
.product-list[data-zoom="6"] .product-type-badge,
.product-list[data-zoom="7"] .product-upc,
.product-list[data-zoom="7"] .product-quantity,
.product-list[data-zoom="7"] .product-type-badge {
  font-size: 0.5rem;
}

.product-list[data-zoom="8"] {
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.product-list[data-zoom="8"] .product-item {
  padding: 8px;
}

.product-list[data-zoom="8"] .product-image {
  width: 20px;
  height: 20px;
  font-size: 12px;
}

.product-list[data-zoom="8"] .product-name {
  font-size: 0.5rem;
}

.product-list[data-zoom="8"] .product-upc,
.product-list[data-zoom="8"] .product-quantity,
.product-list[data-zoom="8"] .product-type-badge {
  font-size: 0.45rem;
}

.product-item {
  background: rgba(139, 92, 246, 0.03);
  border: 1px solid rgba(139, 92, 246, 0.12);
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  gap: 12px;
  align-items: center;
  position: relative;
}

.product-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 2px;
  height: 100%;
  background: var(--primary-color, #8b5cf6);
  transform: scaleY(0);
  transition: transform 0.2s;
}

.product-item:hover {
  border-color: rgba(139, 92, 246, 0.35);
  background-color: rgba(139, 92, 246, 0.06);
}

.product-item:hover::before {
  transform: scaleY(1);
}

.product-item:active {
  transform: scale(0.99);
}

.product-image {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 2px;
  background-color: rgba(5, 5, 8, 0.6);
  border: 2px solid var(--warehouse-color, rgba(139, 92, 246, 0.3));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  transition: all 0.3s ease;
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 2px;
  cursor: pointer;
}

.product-image img:hover {
  opacity: 0.85;
}

/* Lazy loading placeholder */
.product-image img.lazy-image {
  opacity: 0;
  background: rgba(139, 92, 246, 0.1);
}

.product-image img.lazy-loaded {
  opacity: 1;
  transition: opacity 0.3s ease;
}

/* Load more indicator for infinite scroll */
.load-more-indicator {
  text-align: center;
  padding: 16px;
  color: rgba(139, 92, 246, 0.7);
  font-size: 0.85rem;
  font-family: 'Orbitron', sans-serif;
}

.load-more-indicator::after {
  content: '';
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-left: 8px;
  border: 2px solid rgba(139, 92, 246, 0.3);
  border-top-color: rgba(139, 92, 246, 0.8);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.product-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.product-name {
  font-family: 'Orbitron', sans-serif;
  font-weight: 600;
  font-size: 0.7rem;
  letter-spacing: 0.03em;
  color: #f8fafc;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: all 0.3s ease;
}

.product-type-badge {
  display: inline-block;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.55rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--primary-color, #a855f7);
  background: rgba(168, 85, 247, 0.1);
  border: 1px solid rgba(168, 85, 247, 0.25);
  border-radius: 2px;
  padding: 2px 5px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-upc {
  font-family: 'Space Mono', monospace;
  color: rgba(248, 250, 252, 0.4);
  font-size: 0.6rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: all 0.3s ease;
}

.product-quantity {
  font-family: 'Space Mono', monospace;
  color: var(--primary-color, #a855f7);
  font-size: 0.65rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: all 0.3s ease;
}

.product-list-empty {
  text-align: center;
  padding: 50px 20px;
  color: rgba(248, 250, 252, 0.4);
  font-family: 'Space Mono', monospace;
  font-size: 0.8rem;
}

.product-list-loading {
  text-align: center;
  padding: 50px 20px;
  color: rgba(248, 250, 252, 0.6);
  font-family: 'Space Mono', monospace;
  font-size: 0.8rem;
}

/* Image zoom modal */
.image-zoom-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(5, 5, 8, 0.98);
  backdrop-filter: blur(20px);
  z-index: 10000;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}

.image-zoom-modal.active {
  display: flex;
}

.image-zoom-modal img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  border-radius: 4px;
  border: 1px solid rgba(139, 92, 246, 0.2);
}

/* Mobile responsive */
@media (max-width: 768px) {
  .product-list[data-zoom="1"] {
    grid-template-columns: repeat(1, 1fr);
  }

  .product-list[data-zoom="2"],
  .product-list[data-zoom="3"] {
    grid-template-columns: repeat(2, 1fr);
  }

  .product-list[data-zoom="4"],
  .product-list[data-zoom="5"] {
    grid-template-columns: repeat(2, 1fr);
  }

  .product-list[data-zoom="6"],
  .product-list[data-zoom="7"],
  .product-list[data-zoom="8"] {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 480px) {
  .product-search-bar input {
    font-size: 0.8rem;
    padding: 12px 14px;
  }

  .product-search-bar button {
    padding: 12px 14px;
    font-size: 1rem;
  }

  .sorting-buttons {
    gap: 6px;
  }

  .sort-btn {
    padding: 6px 12px;
    font-size: 0.55rem;
  }
}
