/* ============================================================
   CROPGENE — PRODUCT STYLES
   (Cards, Filters, Search, 2-Column Responsive Detail Modal, Grid)
   ============================================================ */

/* ---- Filter & Search Bar ---- */
.products-toolbar {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  margin-bottom: var(--space-10);
}

.products-search {
  position: relative;
  max-width: 520px;
  width: 100%;
}

.products-search__icon {
  position: absolute;
  left: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: var(--color-gray-500);
  pointer-events: none;
}

.products-search__input {
  width: 100%;
  padding: 14px var(--space-4) 14px calc(var(--space-4) + 32px);
  font-size: var(--text-base);
  border: 2px solid var(--color-gray-200);
  border-radius: var(--radius-full);
  background-color: var(--color-white);
  box-shadow: var(--shadow-sm);
  transition: all var(--duration-normal) var(--ease-default);
}

.products-search__input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px var(--color-primary-subtle);
}

.products-search__input::placeholder {
  color: var(--color-gray-400);
}

.products-search__clear {
  position: absolute;
  right: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  color: var(--color-gray-500);
  background: var(--color-gray-100);
  transition: all var(--duration-fast) var(--ease-default);
}

.products-search__clear:hover {
  background-color: var(--color-gray-200);
  color: var(--color-dark);
}

.products-search__clear.visible {
  display: flex;
}

/* ---- Filter Tabs ---- */
.products-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.products-filter {
  padding: 8px 18px;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-gray-700);
  background-color: var(--color-white);
  border: 1.5px solid var(--color-gray-200);
  border-radius: var(--radius-full);
  transition: all var(--duration-normal) var(--ease-default);
  cursor: pointer;
  white-space: nowrap;
  box-shadow: var(--shadow-xs);
}

.products-filter:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background-color: var(--color-primary-subtle);
  transform: translateY(-1px);
}

.products-filter--active {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: var(--color-white);
  border-color: transparent;
  box-shadow: 0 4px 12px var(--color-primary-glow);
}

.products-filter--active:hover {
  background: linear-gradient(135deg, var(--color-primary-light) 0%, var(--color-primary) 100%);
  color: var(--color-white);
  border-color: transparent;
}

.products-filter__count {
  margin-left: 4px;
  font-size: 0.8em;
  opacity: 0.85;
}

/* ---- Product Grid ---- */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-8);
}

/* ---- Product Card ---- */
.product-card {
  background-color: var(--color-white);
  border: 1px solid var(--color-gray-200);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition: all var(--duration-normal) var(--ease-default);
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-xl);
  border-color: var(--color-primary-light);
}

.product-card__image-wrap {
  position: relative;
  aspect-ratio: 4/3;
  overflow: hidden;
  background-color: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-3);
}

.product-card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-md);
  transition: transform var(--duration-slow) var(--ease-default);
}

.product-card:hover .product-card__image {
  transform: scale(1.04);
}

.product-card__category {
  position: absolute;
  top: var(--space-3);
  left: var(--space-3);
  z-index: 2;
  box-shadow: var(--shadow-sm);
}

.product-card__body {
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.product-card__name {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: var(--weight-bold);
  color: var(--color-dark);
  margin-bottom: var(--space-3);
  line-height: var(--leading-snug);
}

.product-card__specs {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: var(--space-4);
  flex-grow: 1;
}

.product-card__spec {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--text-xs);
  padding: 4px 8px;
  background-color: var(--color-gray-50);
  border-radius: var(--radius-sm);
}

.product-card__spec-label {
  font-weight: var(--weight-medium);
  color: var(--color-gray-600);
}

.product-card__spec-value {
  font-weight: var(--weight-semibold);
  color: var(--color-gray-900);
}

.product-card__feature {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: var(--weight-semibold);
  color: var(--color-secondary-dark);
  background: rgba(45, 128, 78, 0.08);
  border: 1px solid rgba(45, 128, 78, 0.2);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  margin-top: auto;
  line-height: 1.4;
}

.product-card__feature svg {
  width: 16px;
  height: 16px;
  min-width: 16px;
  flex-shrink: 0;
  stroke: var(--color-secondary);
}

.product-card__cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: var(--weight-bold);
  color: var(--color-primary);
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-gray-100);
  transition: color var(--duration-fast) var(--ease-default);
}

.product-card:hover .product-card__cta {
  color: var(--color-primary-dark);
}

.product-card__cta svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  stroke: currentColor;
  transition: transform var(--duration-fast) var(--ease-default);
}

.product-card:hover .product-card__cta svg {
  transform: translateX(4px);
}

/* ============================================================
   PRODUCT DETAIL MODAL — SPLIT 2-COLUMN ENTERPRISE LAYOUT
   ============================================================ */

.product-modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  opacity: 0;
  visibility: hidden;
  transition: all var(--duration-normal) var(--ease-default);
}

.product-modal.active {
  opacity: 1;
  visibility: visible;
}

.product-modal__backdrop {
  position: absolute;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.product-modal__content {
  position: relative;
  width: 100%;
  max-width: 900px;
  max-height: min(85vh, 600px);
  background-color: var(--color-white);
  border-radius: var(--radius-2xl);
  overflow: hidden;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
  transform: translateY(20px) scale(0.98);
  transition: transform var(--duration-normal) var(--ease-out);
  display: grid;
  grid-template-columns: 260px 1fr;
  z-index: 1;
}

.product-modal.active .product-modal__content {
  transform: translateY(0) scale(1);
}

.product-modal__close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background-color: var(--color-gray-100);
  color: var(--color-gray-700);
  z-index: 20;
  transition: all var(--duration-fast) var(--ease-default);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-gray-200);
}

.product-modal__close:hover {
  background-color: var(--color-primary);
  color: var(--color-white);
  transform: rotate(90deg);
  border-color: var(--color-primary);
}

.product-modal__close svg {
  width: 16px;
  height: 16px;
}

/* Left Column: Compact Visual Showcase */
.product-modal__media {
  background: #f8fafc;
  border-right: 1px solid var(--color-gray-200);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  position: relative;
}

.product-modal__image-box {
  width: 100%;
  max-width: 220px;
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-gray-200);
  padding: 10px;
  box-shadow: var(--shadow-sm);
}

.product-modal__image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: var(--radius-sm);
}

.product-modal__trust-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: var(--space-3);
  font-size: 0.68rem;
  font-weight: var(--weight-bold);
  color: var(--color-secondary-dark);
  background: var(--color-secondary-subtle);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(45, 128, 78, 0.2);
  text-align: center;
}

/* Right Column: Scrollable Content */
.product-modal__body {
  padding: var(--space-6) var(--space-8);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.product-modal__header {
  margin-bottom: var(--space-4);
  padding-right: var(--space-6);
}

.product-modal__category-tag {
  margin-bottom: 4px;
}

.product-modal__name {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--color-dark);
  line-height: 1.2;
}

.product-modal__feature-section {
  padding: 10px 14px;
  background: var(--color-secondary-subtle);
  border-radius: var(--radius-md);
  border-left: 3.5px solid var(--color-secondary);
  margin-bottom: var(--space-4);
}

.product-modal__feature-label {
  font-size: 0.68rem;
  font-weight: var(--weight-bold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: var(--color-secondary-dark);
  margin-bottom: 2px;
}

.product-modal__feature-value {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-gray-800);
  line-height: var(--leading-snug);
}

/* Compact 2-column or 3-column specifications grid */
.product-modal__specs-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: var(--space-5);
}

.product-modal__spec {
  display: flex;
  flex-direction: column;
  padding: 6px 10px;
  background-color: #f8fafc;
  border: 1px solid var(--color-gray-200);
  border-radius: var(--radius-sm);
}

.product-modal__spec-label {
  font-size: 0.68rem;
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-gray-500);
  margin-bottom: 1px;
}

.product-modal__spec-value {
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: var(--color-dark);
  line-height: 1.2;
}

/* Actions footer */
.product-modal__actions {
  margin-top: auto;
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-gray-100);
  display: flex;
  gap: var(--space-3);
  align-items: center;
}

.product-modal__actions .btn {
  flex: 1;
}

/* ---- Loading Sentinel & Spinner ---- */
.products-sentinel {
  height: 1px;
  width: 100%;
}

.products-loader {
  display: flex;
  justify-content: center;
  padding: var(--space-10);
}

.products-loader__spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--color-gray-200);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ---- Empty / No Results ---- */
.products-empty {
  text-align: center;
  padding: var(--space-16) var(--space-8);
}

.products-empty__icon {
  width: 64px;
  height: 64px;
  color: var(--color-gray-400);
  margin: 0 auto var(--space-5);
}

.products-empty__title {
  font-size: var(--text-xl);
  margin-bottom: var(--space-3);
}

.products-empty__text {
  color: var(--color-gray-500);
  max-width: 400px;
  margin-inline: auto;
}

.products-results {
  font-size: var(--text-sm);
  color: var(--color-gray-500);
  margin-bottom: var(--space-6);
}

.products-results__count {
  font-weight: var(--weight-bold);
  color: var(--color-dark);
}

/* ============================================================
   RESPONSIVE BREAKPOINTS (Laptop / Tablet / Mobile)
   ============================================================ */

/* Small Laptops & Tablets */
@media (max-width: 860px) {
  .product-modal__content {
    grid-template-columns: 300px 1fr;
    max-height: 85vh;
  }

  .product-modal__body {
    padding: var(--space-5);
  }

  .product-modal__name {
    font-size: 1.6rem;
  }

  .product-modal__specs-grid {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

/* Mobile Devices */
@media (max-width: 680px) {
  .product-modal__content {
    grid-template-columns: 1fr;
    max-height: 90vh;
    overflow-y: auto;
    display: block;
  }

  .product-modal__media {
    border-right: none;
    border-bottom: 1px solid var(--color-gray-200);
    padding: var(--space-4);
  }

  .product-modal__image-box {
    max-height: 220px;
  }

  .product-modal__image {
    max-height: 200px;
  }

  .product-modal__body {
    padding: var(--space-5);
    overflow-y: visible;
  }

  .product-modal__specs-grid {
    grid-template-columns: 1fr 1fr;
  }

  .product-modal__actions {
    flex-direction: column;
  }

  .product-modal__actions .btn {
    width: 100%;
  }
}
