/* ==========================================================================
   PRODUCT MASTER CATALOG & PRICING COMMAND CENTER
   Enterprise Matte Dark Design System (#0B0F14 / #111720 / #151C26 / #192231)
   Features:
    - Dual View Modes: High-Density List Table vs. Premium Grid Cards
    - Instant Category Filter Pills & Real-time Live Search
    - Simplified Product Entry (No HS Code, No VAT % required)
    - Handler / Labour Loading Charge per piece tracking
    - Quick Duplicate, Price Calculator, and Export Controls
   ========================================================================== */

.product-master-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background-color: #0c1017;
  color: #f1f5f9;
  min-height: calc(100vh - 44px);
  padding: 16px 20px 24px 20px;
  box-sizing: border-box;
  font-family: 'Inter', sans-serif;
}

/* ==========================================================================
   1. KPI SUMMARY METRICS (Matching Delivery Schedule Aesthetic)
   ========================================================================== */
.product-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

@media (max-width: 1200px) {
  .product-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .product-kpi-grid {
    grid-template-columns: 1fr;
  }
}

.product-kpi-card {
  background-color: #131926;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  transition: border-color 0.2s ease, transform 0.15s ease;
}

.product-kpi-card:hover {
  border-color: rgba(255, 255, 255, 0.16);
  transform: translateY(-1px);
}

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

.kpi-icon-pink {
  background-color: rgba(219, 39, 119, 0.18);
  color: #ec4899;
}

.kpi-icon-green {
  background-color: rgba(16, 185, 129, 0.18);
  color: #10b981;
}

.kpi-icon-amber {
  background-color: rgba(245, 158, 11, 0.18);
  color: #f59e0b;
}

.kpi-icon-blue {
  background-color: rgba(59, 130, 246, 0.18);
  color: #3b82f6;
}

.product-kpi-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.product-kpi-title {
  font-size: 11.5px;
  font-weight: 500;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.product-kpi-value {
  font-size: 22px;
  font-weight: 700;
  color: #ffffff;
  font-family: 'JetBrains Mono', monospace;
  line-height: 1.2;
}

.product-kpi-sub {
  font-size: 11px;
  color: #64748b;
  margin-top: 2px;
}

/* ==========================================================================
   2. TOOLBAR & FILTER CONTROLS
   ========================================================================== */
.product-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background-color: #131926;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 10px 14px;
}

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

.product-search-box {
  position: relative;
  width: 260px;
}

.product-search-box i {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
  font-size: 12px;
}

.product-search-box input {
  width: 100%;
  background-color: #0c1017;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 6px 10px 6px 30px;
  font-size: 12px;
  color: #ffffff;
  outline: none;
  transition: border-color 0.15s ease;
  box-sizing: border-box;
}

.product-search-box input:focus {
  border-color: #db2777;
  box-shadow: 0 0 0 2px rgba(219, 39, 119, 0.2);
}

/* Category Filter Pills */
.category-filter-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding: 2px 0;
}

.category-pill {
  background-color: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  color: #94a3b8;
  font-size: 11.5px;
  font-weight: 500;
  padding: 4px 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.category-pill:hover {
  background-color: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.category-pill.active {
  background-color: #db2777;
  border-color: #db2777;
  color: #ffffff;
  font-weight: 600;
}

/* Toolbar Right Controls */
.product-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* View Switcher Toggle (Table vs Grid) */
.view-switcher-group {
  display: flex;
  background-color: #0c1017;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 2px;
}

.btn-view-toggle {
  background: transparent;
  border: none;
  color: #64748b;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.15s ease;
}

.btn-view-toggle:hover {
  color: #ffffff;
}

.btn-view-toggle.active {
  background-color: #1e293b;
  color: #db2777;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.btn-add-product-primary {
  background: linear-gradient(135deg, #ec4899, #db2777);
  border: none;
  border-radius: 6px;
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.1s ease;
  box-shadow: 0 2px 8px rgba(219, 39, 119, 0.3);
}

.btn-add-product-primary:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

/* ==========================================================================
   3. MINIMAL GOOGLE / ODOO COMPACT GRID CARDS (Matte Dark)
   ========================================================================== */
.product-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: 100%;
  box-sizing: border-box;
}

@media (max-width: 1024px) {
  .product-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .product-cards-grid {
    grid-template-columns: 1fr;
  }
}

.product-card-minimal {
  background-color: #131926;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 90px;
  min-width: 0;
  position: relative;
  cursor: pointer;
  transition: all 0.15s ease;
  box-sizing: border-box;
  overflow: hidden;
}

.product-card-minimal:hover {
  background-color: #171f2e;
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.card-top-row {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  padding-right: 50px;
}

.star-icon-btn {
  background: transparent;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 0;
  font-size: 14px;
  line-height: 1;
  transition: color 0.15s ease;
  flex-shrink: 0;
}

.star-icon-btn:hover,
.star-icon-btn.active {
  color: #f59e0b;
}

.prod-name-title {
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.prod-code-line {
  font-size: 11px;
  color: #94a3b8;
  font-family: 'JetBrains Mono', monospace;
  margin-top: 1px;
}

.prod-info-line {
  font-size: 11.5px;
  color: #cbd5e1;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 1px;
}

.prod-info-line .info-label {
  color: #94a3b8;
}

.prod-info-line .info-value {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
}

.prod-info-line .price-text {
  color: #ffffff;
}

.prod-info-line .handler-text {
  color: #f59e0b;
}

/* Hover Quick Actions (clean & unobtrusive) */
.card-hover-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.product-card-minimal:hover .card-hover-actions {
  opacity: 1;
}

.btn-card-mini-action {
  background-color: #1f293d;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  cursor: pointer;
  transition: all 0.1s ease;
}

.btn-card-mini-action:hover {
  background-color: #db2777;
  border-color: #db2777;
  color: #ffffff;
}

.btn-card-mini-action.btn-delete:hover {
  background-color: #ef4444;
  border-color: #ef4444;
  color: #ffffff;
}

.btn-card-action {
  background-color: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #94a3b8;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 11px;
  transition: all 0.15s ease;
}

.btn-card-action:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.btn-card-action.btn-delete:hover {
  background-color: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
  color: #ef4444;
}

/* ==========================================================================
   4. HIGH-DENSITY LIST TABLE VIEW
   ========================================================================== */
.product-table-wrapper {
  background-color: #131926;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.product-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  color: #f1f5f9;
  text-align: left;
}

.product-data-table thead th {
  background-color: #171f2e;
  color: #94a3b8;
  font-weight: 600;
  font-size: 11.5px;
  padding: 12px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  user-select: none;
}

.product-data-table tbody tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background-color 0.15s ease;
}

.product-data-table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.025);
}

.product-data-table td {
  padding: 12px 10px;
  vertical-align: middle;
}

/* ==========================================================================
   5. SIMPLIFIED PRODUCT ENTRY MODAL
   ========================================================================== */
.product-modal-dialog {
  max-width: 520px;
  background-color: #131926;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  color: #f1f5f9;
  overflow: hidden;
}

.product-modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #171f2e;
}

.product-modal-title {
  font-size: 14.5px;
  font-weight: 700;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.product-modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: calc(85vh - 120px);
  overflow-y: auto;
}

.product-form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.product-form-label {
  font-size: 11.5px;
  font-weight: 600;
  color: #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.product-form-label .required-star {
  color: #ec4899;
}

.product-form-label .label-hint {
  font-size: 10px;
  font-weight: 400;
  color: #64748b;
}

.product-form-input {
  width: 100%;
  background-color: #0c1017;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 12.5px;
  color: #ffffff;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.product-form-input:focus {
  border-color: #db2777;
  box-shadow: 0 0 0 3px rgba(219, 39, 119, 0.18);
}

.product-form-input.input-mono {
  font-family: 'JetBrains Mono', monospace;
}

.product-form-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.product-modal-footer {
  padding: 14px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background-color: #171f2e;
}
