/**
 * Sterikem Product Grid - Lovable Design System
 * Light theme with blue accent colors
 */

@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap");

/* CSS Custom Properties - Sterikem Design Tokens */
:root {
  /* Light theme colors */
  --spg-card-bg: #ffffff;
  --spg-card-border: #e0e6eb;
  --spg-muted-bg: #f0f2f5;

  /* Text colors */
  --spg-title: #0b3756;
  --spg-text: #627684;
  --spg-text-light: #f8fafc;

  /* Accent colors - Action blue */
  --spg-accent: #0467a9;
  --spg-accent-hover: #035a94;
  --spg-accent-light: #0467a91a;
  --spg-accent-border-hover: #0467a966;

  /* Border radius */
  --spg-border-radius: 12px;
  --spg-border-radius-sm: 8px;
  --spg-border-radius-full: 9999px;

  /* Transitions */
  --spg-transition: all 0.2s ease;

  /* Shadows */
  --spg-shadow-card: 0 4px 24px -4px rgba(11, 55, 86, 0.08);
  --spg-shadow-elevated: 0 12px 40px -8px rgba(11, 55, 86, 0.15);
}

/* Container */
.spg-container {
  position: relative;
  width: 100%;
  font-family:
    "Plus Jakarta Sans",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    sans-serif;
}

/* Filter Bar - No background */
.spg-filter-bar {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 16px;
  padding: 16px 0;
}

/* Search Wrapper */
.spg-search-wrapper {
  position: relative;
  width: 100%;
  max-width: 400px;
}

.spg-search-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--spg-text);
  pointer-events: none;
}

.spg-search-input {
  width: 100%;
  padding: 10px 40px 10px 40px;
  font-size: 14px;
  color: var(--spg-title);
  background: var(--spg-card-bg);
  border: 1px solid var(--spg-card-border);
  border-radius: var(--spg-border-radius-sm);
  outline: none;
  transition: var(--spg-transition);
}

.spg-search-input::placeholder {
  color: var(--spg-text);
}

.spg-search-input:focus {
  border-color: var(--spg-accent);
  box-shadow: 0 0 0 3px var(--spg-accent-light);
}

.spg-search-clear {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  background: transparent;
  border: none;
  color: var(--spg-text);
  cursor: pointer;
  transition: var(--spg-transition);
}

.spg-search-clear:hover {
  color: var(--spg-title);
}

/* Results Count */
.spg-results-count {
  font-size: 14px;
  color: var(--spg-text);
  margin-bottom: 16px;
}

.spg-results-count .spg-count {
  font-weight: 700;
  color: var(--spg-title);
}

/* Browse Section */
.spg-browse-section {
  margin-bottom: 16px;
}

.spg-browse-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}

.spg-filter-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--spg-text);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Mode Tabs (Chemical Series / Industry) - Lovable Design */
.spg-mode-tabs {
  display: flex;
  background: #f0f2f5;
  border: 1px solid var(--spg-card-border);
  border-radius: 8px;
  padding: 2px;
}

.spg-mode-tab {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--spg-text);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--spg-transition);
}

.spg-mode-tab:hover {
  color: var(--spg-title);
}

.spg-mode-tab.active {
  background: #ffffff;
  color: var(--spg-title);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Filter Sets */
.spg-filter-set {
  display: none;
}

.spg-filter-set.active {
  display: block;
}

.spg-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Legacy Category Filters (for backwards compatibility) */
.spg-category-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

/* Filter Chips - Regular State */
.spg-filter-chip {
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #627684;
  background: transparent;
  border: 1px solid #e0e6eb;
  border-radius: 9999px;
  cursor: pointer;
  transition: var(--spg-transition);
}

.spg-filter-chip:hover {
  border-color: #0467a966;
}

/* Filter Chips - Active State */
.spg-filter-chip.active {
  background: #0467a9;
  border-color: #0467a9;
  color: #f8fafc;
}

/* Product Grid */
.spg-grid {
  display: grid;
  gap: 24px;
}

.spg-cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

.spg-cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.spg-cols-4 {
  grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 1024px) {
  .spg-cols-4,
  .spg-cols-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .spg-cols-4,
  .spg-cols-3,
  .spg-cols-2 {
    grid-template-columns: 1fr;
  }

  .spg-search-wrapper {
    max-width: none;
  }

  .spg-browse-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .spg-mode-tabs {
    width: 100%;
  }

  .spg-mode-tab {
    flex: 1;
    text-align: center;
  }
}

/* Product Card */
.spg-product-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border: 1px solid var(--spg-card-border);
  border-radius: var(--spg-border-radius);
  overflow: hidden;
  transition: var(--spg-transition);
  cursor: pointer;
}

/* Stretched Link - Makes entire card clickable */
.spg-card-link {
  text-decoration: none;
  color: inherit;
}

.spg-card-link::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}

.spg-product-card:hover {
  border-color: #0467a94d;
  box-shadow: var(--spg-shadow-elevated);
  transform: translateY(-2px);
}

/* Card Image */
.spg-card-image {
  position: relative;
  width: 100%;
  height: 200px;
  overflow: hidden;
}

.spg-card-image img,
.spg-container .spg-card-image img {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: none !important;
  object-fit: cover !important;
  transition: transform 0.5s ease;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 0 !important;
}

.spg-product-card:hover .spg-card-image img {
  transform: scale(1.05);
}

/* Image Gradient Overlay */
.spg-card-image::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    #ffffff 0%,
    rgba(255, 255, 255, 0.2) 40%,
    transparent 100%
  );
  pointer-events: none;
}

/* Category Badge */
.spg-category-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--spg-text-light);
  background: rgba(4, 103, 169, 0.9);
  backdrop-filter: blur(8px);
  border-radius: 4px;
  z-index: 2;
}

/* Card Content */
.spg-card-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 20px;
  gap: 12px;
}

/* Product Title */
.spg-product-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #0b3756;
  line-height: 1.4;
  transition: var(--spg-transition);
}

.spg-product-card:hover .spg-product-title {
  color: var(--spg-accent);
}

/* Product Tags */
.spg-product-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.spg-tag {
  font-size: 12px;
  font-weight: 500;
  color: #627684;
}

.spg-tag:not(:last-child)::after {
  content: " · ";
  color: #627684;
}

/* Product Description */
.spg-product-description {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: #627684;
}

/* Specs Container - pH Range & Dilution */
.spg-specs-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.spg-spec-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: #f0f2f5;
  border-radius: var(--spg-border-radius-sm);
  padding: 8px 12px;
}

.spg-spec-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #627684;
}

.spg-spec-value {
  font-size: 12px;
  font-weight: 700;
  color: #0b3756;
}

/* Sizes */
.spg-sizes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.spg-size-badge {
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 600;
  color: #0467a9;
  background: #0467a91a;
  border-radius: var(--spg-border-radius-full);
}

/* Shop Button */
.spg-shop-button {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: auto;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  color: #f8fafc;
  background: #0467a9;
  border: none;
  border-radius: var(--spg-border-radius-sm);
  cursor: pointer;
  transition: var(--spg-transition);
}

.spg-shop-button:hover,
.spg-shop-button:focus,
.spg-shop-button:active,
a.spg-shop-button:hover,
a.spg-shop-button:focus,
a.spg-shop-button:active,
.spg-container .spg-shop-button:hover,
.spg-container a.spg-shop-button:hover {
  background: #035a94;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(4, 103, 169, 0.3);
  color: #f8fafc !important;
  text-decoration: none !important;
}

.spg-shop-button svg {
  transition: transform 0.2s ease;
}

.spg-shop-button:hover svg {
  transform: translateX(4px);
}

/* No Products */
.spg-no-products {
  grid-column: 1 / -1;
  padding: 60px 20px;
  text-align: center;
}

.spg-no-products p {
  margin: 0;
  font-size: 16px;
  color: var(--spg-text);
}

/* Loading Overlay */
.spg-loading {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(4px);
  z-index: 10;
  border-radius: var(--spg-border-radius);
}

.spg-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--spg-card-border);
  border-top-color: var(--spg-accent);
  border-radius: 50%;
  animation: spg-spin 0.8s linear infinite;
}

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

/* Card Animation */
.spg-product-card {
  animation: spg-fade-in 0.3s ease forwards;
  opacity: 0;
}

.spg-product-card:nth-child(1) {
  animation-delay: 0.05s;
}
.spg-product-card:nth-child(2) {
  animation-delay: 0.1s;
}
.spg-product-card:nth-child(3) {
  animation-delay: 0.15s;
}
.spg-product-card:nth-child(4) {
  animation-delay: 0.2s;
}
.spg-product-card:nth-child(5) {
  animation-delay: 0.25s;
}
.spg-product-card:nth-child(6) {
  animation-delay: 0.3s;
}
.spg-product-card:nth-child(7) {
  animation-delay: 0.35s;
}
.spg-product-card:nth-child(8) {
  animation-delay: 0.4s;
}
.spg-product-card:nth-child(9) {
  animation-delay: 0.45s;
}
.spg-product-card:nth-child(10) {
  animation-delay: 0.5s;
}
.spg-product-card:nth-child(11) {
  animation-delay: 0.55s;
}
.spg-product-card:nth-child(12) {
  animation-delay: 0.6s;
}

@keyframes spg-fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
