/* ==========================================================================
   Finished Products & Production Targets Screen
   SGB Agro Industries - Enterprise Corporate Design System
   ========================================================================== */

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulseLiveDot {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(5, 150, 105, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 6px rgba(5, 150, 105, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(5, 150, 105, 0);
  }
}

.finished-products-container {
  padding: 1rem 1.25rem 3rem 1.25rem;
}

/* --------------------------------------------------------------------------
   KPI Summary Grid
   -------------------------------------------------------------------------- */
.finished-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.finished-kpi-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1rem 1.15rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  animation: fadeInUp 0.2s ease-out both;
}

.finished-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px -2px rgba(5, 150, 105, 0.1);
  border-color: #a7f3d0;
}

.kpi-icon-bubble {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
}

.kpi-icon-bubble.green {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}

.kpi-icon-bubble.emerald {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.kpi-icon-bubble.blue {
  background: #f0f9ff;
  color: #0284c7;
  border: 1px solid #bae6fd;
}

.kpi-icon-bubble.purple {
  background: #f5f3ff;
  color: #7c3aed;
  border: 1px solid #ddd6fe;
}

.kpi-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.finished-kpi-card .kpi-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #64748b;
  letter-spacing: 0.03em;
}

.finished-kpi-card .kpi-val {
  font-size: 1.4rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0.1rem 0;
  line-height: 1.2;
}

.finished-kpi-card .kpi-sub {
  font-size: 0.7rem;
  color: #94a3b8;
}

/* --------------------------------------------------------------------------
   Toolbar Card & Filters
   -------------------------------------------------------------------------- */
.finished-toolbar-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.finished-toolbar-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex: 1;
  min-width: 280px;
  flex-wrap: wrap;
}

.finished-search-wrap,
.finished-toolbar-left .search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 270px;
}

.finished-search-wrap svg,
.finished-toolbar-left .search-input-wrap svg {
  position: absolute;
  left: 10px;
  color: #94a3b8;
  pointer-events: none;
}

.finished-search-wrap input,
.finished-toolbar-left .search-input-wrap input {
  width: 100%;
  height: 36px;
  padding: 0 0.75rem 0 2.2rem;
  font-size: 0.8rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  color: #0f172a;
  outline: none;
  transition: all 0.15s ease;
}

.finished-search-wrap input:focus,
.finished-toolbar-left .search-input-wrap input:focus {
  border-color: #059669;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
}

.finished-filter-pills,
.finished-filter-chips {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  overflow-x: auto;
}

.finished-filter-pill,
.filter-chip {
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  font-size: 0.74rem;
  font-weight: 700;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  user-select: none;
}

.finished-filter-pill:hover,
.filter-chip:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.finished-filter-pill.active,
.filter-chip.active {
  background: #065f46 !important;
  color: #ffffff !important;
  border-color: #065f46 !important;
  box-shadow: 0 1px 3px rgba(6, 95, 70, 0.3);
}

.finished-toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* --------------------------------------------------------------------------
   Finished Products Cards Grid
   -------------------------------------------------------------------------- */
.finished-products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.25rem;
}

.finished-product-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, border-color 0.2s ease;
  animation: fadeInUp 0.25s ease-out both;
}

.finished-product-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px -4px rgba(5, 150, 105, 0.12), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
  border-color: #a7f3d0;
}

/* Card Header (Thumbnail + Details) */
.product-card-top,
.finished-card-header {
  padding: 1rem 1.15rem;
  display: flex;
  gap: 0.85rem;
  border-bottom: 1px solid #f1f5f9;
  align-items: flex-start;
}

.product-card-thumb,
.finished-card-thumb {
  width: 58px;
  height: 58px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-card-thumb img,
.finished-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-card-details,
.finished-card-title-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.product-card-sku-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.product-sku-pill,
.finished-sku-badge {
  display: inline-block;
  font-family: monospace;
  font-size: 0.675rem;
  font-weight: 700;
  color: #475569;
  background: #f1f5f9;
  padding: 0.12rem 0.4rem;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
}

.product-stock-pill {
  font-size: 0.675rem;
  font-weight: 800;
  padding: 0.12rem 0.45rem;
  border-radius: 4px;
}

.product-stock-pill.in-stock {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}

.product-stock-pill.zero-stock {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.product-card-name,
.finished-product-name {
  font-size: 0.95rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0.1rem 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.product-card-pricing {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.735rem;
  color: #64748b;
  flex-wrap: wrap;
}

.product-card-pricing .price-item strong {
  color: #065f46;
  font-weight: 800;
}

/* --------------------------------------------------------------------------
   Target Goal Section on Card
   -------------------------------------------------------------------------- */
.product-card-target-box,
.finished-card-target-section {
  padding: 0.85rem 1.15rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: #fafaf9;
  border-bottom: 1px solid #f1f5f9;
}

.product-card-target-box.active {
  background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  margin: 0.65rem 1rem;
  padding: 0.65rem 0.85rem;
}

.product-card-target-box.empty {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  margin: 0.65rem 1rem;
  padding: 0.65rem 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.target-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.35rem;
}

.target-box-title {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.725rem;
  font-weight: 800;
  color: #065f46;
}

.live-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #059669;
  display: inline-block;
  animation: pulseLiveDot 1.6s infinite ease-in-out;
}

.target-box-percent {
  font-size: 0.75rem;
  font-weight: 900;
  color: #047857;
}

.target-box-progress-track {
  width: 100%;
  height: 6px;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 9999px;
  overflow: hidden;
  margin-bottom: 0.4rem;
}

.target-box-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #059669);
  border-radius: 9999px;
  transition: width 0.35s ease;
}

.target-box-progress-bar.complete {
  background: #059669;
}

.target-box-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.7rem;
  color: #334155;
  font-weight: 600;
}

.product-card-target-box.paused {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 1px solid #fde68a;
}
.product-card-target-box.paused .target-box-title {
  color: #b45309;
}
.live-pulse-dot.paused-dot {
  background: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

.target-box-lifecycle-bar {
  margin-top: 0.45rem;
  padding-top: 0.35rem;
  border-top: 1px dashed rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.btn-target-pill {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.18rem 0.45rem;
  border-radius: 5px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  background: #ffffff;
}
.btn-target-pill.pause {
  color: #b45309;
  border-color: #fde68a;
  background: #fffbeb;
}
.btn-target-pill.pause:hover {
  background: #fef3c7;
}
.btn-target-pill.resume {
  color: #047857;
  border-color: #a7f3d0;
  background: #ecfdf5;
}
.btn-target-pill.resume:hover {
  background: #d1fae5;
}
.btn-target-pill.stop {
  color: #0369a1;
  border-color: #bae6fd;
  background: #f0f9ff;
}
.btn-target-pill.stop:hover {
  background: #e0f2fe;
}
.btn-target-pill.cancel {
  color: #dc2626;
  border-color: #fecaca;
  background: #fef2f2;
}
.btn-target-pill.cancel:hover {
  background: #fee2e2;
}
.btn-target-pill.delete {
  color: #991b1b;
  border-color: #fca5a5;
  background: #fff1f2;
}
.btn-target-pill.delete:hover {
  background: #ffe4e6;
}

.btn-text-action {
  background: transparent;
  border: none;
  color: #059669;
  font-size: 0.735rem;
  font-weight: 800;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  transition: background 0.15s ease;
}

.btn-text-action:hover {
  background: #ecfdf5;
}

/* --------------------------------------------------------------------------
   Card Action Buttons Footer
   -------------------------------------------------------------------------- */
.product-card-actions,
.finished-card-actions {
  padding: 0.75rem 1.15rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #ffffff;
}

.product-card-actions .btn,
.finished-card-actions .btn {
  height: 32px;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 0 0.7rem;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-action-target {
  flex: 1.4;
  background: linear-gradient(135deg, #059669, #047857) !important;
  color: #ffffff !important;
  border: none !important;
  box-shadow: 0 1px 3px rgba(5, 150, 105, 0.25);
}

.btn-action-target:hover {
  background: linear-gradient(135deg, #10b981, #059669) !important;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(5, 150, 105, 0.35);
}

.product-card-actions .btn-secondary {
  flex: 1;
}

.btn-card-delete-icon {
  margin-left: auto;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  padding: 0.15rem 0.35rem;
  font-size: 0.82rem;
  color: #94a3b8;
  opacity: 0.65;
  transition: all 0.15s ease;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.finished-product-card:hover .btn-card-delete-icon {
  opacity: 1;
}

.btn-card-delete-icon:hover {
  background: #fef2f2;
  border-color: #fecaca;
  color: #dc2626;
  transform: scale(1.08);
}

.product-card-actions .btn-action-delete {
  flex: 0 0 34px !important;
  min-width: 34px !important;
  max-width: 34px !important;
  padding: 0 !important;
  color: #dc2626 !important;
  background: #fef2f2 !important;
  border: 1px solid #fee2e2 !important;
}

.product-card-actions .btn-action-delete:hover {
  background: #fee2e2 !important;
  border-color: #fca5a5 !important;
  color: #b91c1c !important;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.15);
}

