/* Shopping Modal Styles */
.shopping-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
  animation: fadeIn 0.3s ease;
}

.shopping-modal-content {
  background: white;
  border-radius: var(--radius-xl);
  max-width: 1200px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
}

.shopping-modal-header {
  padding: 24px 28px;
  border-bottom: 2px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-secondary);
}

.shopping-modal-header h2 {
  margin: 0;
  color: var(--text-primary);
  font-size: 24px;
}

.shopping-modal-close {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition);
  font-size: 20px;
  font-weight: bold;
}

.shopping-modal-close:hover {
  background: var(--primary-color);
  color: white;
  transform: rotate(90deg);
  box-shadow: var(--shadow-md);
}

.shopping-modal-close:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.35);
}

/* Shopping Tabs */
.shopping-tabs {
  display: flex;
  gap: 12px;
  padding: 16px 24px;
  border-bottom: 2px solid var(--border-color);
  background: var(--bg-primary);
  overflow-x: auto;
}

.shopping-tabs::-webkit-scrollbar {
  height: 6px;
}

.shopping-tabs::-webkit-scrollbar-thumb {
  background: rgba(102, 126, 234, 0.3);
  border-radius: 999px;
}

.shopping-tab {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-radius: 12px;
  border: 2px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
}

.shopping-tab:hover {
  background: var(--bg-tertiary);
  border-color: var(--primary-color);
  color: var(--text-primary);
  transform: translateY(-2px);
}

.shopping-tab.active {
  background: var(--primary-gradient);
  color: white;
  border-color: transparent;
  box-shadow: 0 8px 20px rgba(118, 75, 162, 0.3);
}

.shopping-tab-text {
  font-size: 14px;
  font-weight: 600;
}

.shopping-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(102, 126, 234, 0.15);
  color: var(--text-primary);
}

.shopping-tab.active .shopping-tab-badge {
  background: rgba(255, 255, 255, 0.25);
  color: white;
}

.detected-item-preview {
  display: flex;
  align-items: center;
  gap: 10px;
}

.detected-item-thumb {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  border: 2px solid rgba(102, 126, 234, 0.3);
  background: white;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
}

.shopping-tab.active .detected-item-thumb {
  border-color: rgba(255, 255, 255, 0.5);
}

.detected-item-thumb-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: linear-gradient(180deg, #f8fafc, #eef2ff);
  padding: 4px;
  transition: transform 0.25s ease-out;
}

/* Shopping Controls */
.shopping-controls {
  padding: 20px 24px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
}

.shopping-controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.shopping-filter-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.shopping-filter-group select {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: white;
  transition: var(--transition);
}

.shopping-filter-group select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Shopping Results */
.shopping-results {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  background: var(--bg-primary);
}

.shopping-tab-content {
  display: none;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.shopping-tab-content.active {
  display: flex;
  animation: fadeIn 0.3s ease;
}

.shopping-section {
  margin-bottom: 32px;
}

.shopping-section-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border-color);
}

.shopping-detected-image {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 2px solid var(--primary-color);
}

.shopping-section-title {
  margin: 0 0 4px 0;
  color: var(--text-primary);
  font-size: 20px;
  text-transform: capitalize;
  font-weight: 600;
}

.shopping-section-count {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
}

/* Product Grid */
.shopping-products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

.shopping-product-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: var(--transition);
  cursor: pointer;
  border: 2px solid transparent;
}

.shopping-product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-color);
}

.shopping-product-image {
  width: 100%;
  aspect-ratio: 3 / 4;
  height: auto;
  object-fit: contain;
  background: linear-gradient(180deg, #f8fafc, #eef2ff);
  padding: 12px;
}

.shopping-product-info {
  padding: 16px;
}

.shopping-product-brand {
  margin: 0 0 6px 0;
  font-size: 12px;
  color: var(--primary-color);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.shopping-product-name {
  margin: 0 0 10px 0;
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.4;
}

.shopping-product-price-container {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.shopping-product-sale-price {
  font-size: 18px;
  font-weight: 700;
  color: #e74c3c;
}

.shopping-product-original-price {
  font-size: 14px;
  color: var(--text-muted);
  text-decoration: line-through;
}

.shopping-product-price {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.shopping-product-vendor {
  margin: 6px 0 0 0;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.shopping-product-match {
  margin: 6px 0 0 0;
  font-size: 11px;
  color: var(--primary-color);
  font-weight: 600;
}

.shopping-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 60px 20px;
  font-size: 16px;
}

.shop-similar-btn {
  width: 100%;
  padding: 8px 12px;
  background: var(--primary-gradient);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  margin-top: 8px;
}

.shop-similar-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.shop-similar-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

@media (max-width: 768px) {
  .shopping-modal-content {
    max-height: 95vh;
  }

  .shopping-products-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
  }

  .shopping-controls-grid {
    grid-template-columns: 1fr;
  }
}
