/* ==========================================================================
   PAINT SALES & TINTING OPERATIONS SYSTEM (ប្រព័ន្ធប្រតិបត្តិការលក់ថ្នាំលាបផ្ទះ)
   Ultra-Modern, Touch-Friendly, Enterprise Dealership POS & Mixing Workflow
   ========================================================================== */

:root {
  --paint-primary: #0284c7;
  --paint-primary-dark: #0369a1;
  --paint-secondary: #0f172a;
  --paint-success: #16a34a;
  --paint-warning: #ea580c;
  --paint-danger: #dc2626;
  --paint-purple: #7c3aed;
  --paint-gold: #d4af37;
  --paint-bg: #f8fafc;
  --paint-card-bg: #ffffff;
  --paint-border: #e2e8f0;
  --paint-border-focus: #0284c7;
  --paint-text-dark: #0f172a;
  --paint-text-muted: #64748b;
  --paint-shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --paint-shadow-md: 0 6px 18px rgba(15, 23, 42, 0.08);
  --paint-shadow-lg: 0 14px 34px rgba(15, 23, 42, 0.12);
  --paint-radius-sm: 8px;
  --paint-radius-md: 14px;
  --paint-radius-lg: 20px;
  --paint-radius-full: 9999px;
  --font-km: 'Kantumruy Pro', 'Preahvihear', sans-serif;
  --font-en: 'Outfit', 'Inter', sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body.paint-ops-body {
  font-family: var(--font-km), var(--font-en);
  background-color: #f1f5f9;
  color: var(--paint-text-dark);
  line-height: 1.5;
  letter-spacing: normal;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

button, input, select, textarea {
  font-family: inherit;
  letter-spacing: normal;
}

/* Operations Topbar */
.ops-topbar {
  background: #ffffff;
  border-bottom: 1px solid var(--paint-border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--paint-shadow-sm);
}

.ops-brand-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.ops-brand-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--paint-radius-md);
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 1.25rem;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3);
}

.ops-brand-text h1 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--paint-text-dark);
  line-height: 1.2;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ops-badge-mode {
  background: #e0f2fe;
  color: #0369a1;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: var(--paint-radius-full);
  border: 1px solid #bae6fd;
}

.ops-brand-text span {
  font-size: 0.8rem;
  color: var(--paint-text-muted);
}

.ops-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-ops-nav {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--paint-radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.btn-ops-white {
  background: #f8fafc;
  color: var(--paint-text-dark);
  border-color: var(--paint-border);
}
.btn-ops-white:hover {
  background: #e2e8f0;
}

.btn-ops-primary {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.25);
}
.btn-ops-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(2, 132, 199, 0.35);
}

/* Operations Workflow Stepper */
.ops-stepper-bar {
  background: #ffffff;
  border-bottom: 1px solid var(--paint-border);
  padding: 14px 24px;
}

.stepper-track {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.step-node {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 8px 14px;
  border-radius: var(--paint-radius-md);
  transition: all 0.2s ease;
  user-select: none;
  border: 1.5px solid transparent;
  flex-shrink: 0;
}

.step-node:hover {
  background: #f8fafc;
}

.step-node.active {
  background: #f0f9ff;
  border-color: #0284c7;
}

.step-node.completed .step-number {
  background: #16a34a;
  color: #ffffff;
}

.step-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #475569;
  font-weight: 800;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.step-node.active .step-number {
  background: #0284c7;
  color: #ffffff;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.2);
}

.step-titles {
  display: flex;
  flex-direction: column;
}

.step-title-kh {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--paint-text-dark);
  line-height: 1.25;
}

.step-title-en {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--paint-text-muted);
}

.step-arrow-divider {
  color: #cbd5e1;
  font-size: 0.85rem;
}

/* Main Layout Grid */
.ops-main-container {
  max-width: 1440px;
  width: 100%;
  margin: 20px auto;
  padding: 0 20px 40px;
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 24px;
  flex: 1;
}

@media (max-width: 1100px) {
  .ops-main-container {
    grid-template-columns: 1fr;
  }
}

/* Left Workspace Cards */
.ops-workspace {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.ops-card {
  background: #ffffff;
  border-radius: var(--paint-radius-lg);
  border: 1px solid var(--paint-border);
  box-shadow: var(--paint-shadow-sm);
  overflow: hidden;
}

.ops-card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--paint-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fafafa;
}

.ops-card-header h2 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--paint-text-dark);
  display: flex;
  align-items: center;
  gap: 10px;
}

.ops-card-body {
  padding: 20px;
}

/* Forms & Input Controls */
.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

.form-row-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}

@media (max-width: 768px) {
  .form-row-2, .form-row-3 {
    grid-template-columns: 1fr;
  }
}

.ops-field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ops-field-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: #334155;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ops-input, .ops-select {
  padding: 9px 12px;
  border: 1.5px solid var(--paint-border);
  border-radius: var(--paint-radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--paint-text-dark);
  outline: none;
  background: #ffffff;
  transition: all 0.2s ease;
}

.ops-input:focus, .ops-select:focus {
  border-color: var(--paint-primary);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

/* Color Selection Chip Box */
.selected-color-banner {
  background: #f8fafc;
  border: 2px dashed #cbd5e1;
  border-radius: var(--paint-radius-md);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  transition: all 0.2s ease;
}

.selected-color-banner.has-color {
  border-style: solid;
  border-color: #0284c7;
  background: #ffffff;
  box-shadow: var(--paint-shadow-sm);
}

.color-swatch-giant {
  width: 60px;
  height: 60px;
  border-radius: var(--paint-radius-md);
  border: 2px solid #ffffff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
}

.color-banner-details h3 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--paint-text-dark);
  line-height: 1.25;
}

.color-banner-details span {
  font-size: 0.85rem;
  color: var(--paint-text-muted);
  font-family: monospace;
}

.color-banner-badges {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.badge-pill-soft {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--paint-radius-full);
  background: #e2e8f0;
  color: #334155;
}

/* Quick Color Search / Palette Selector */
.quick-colors-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--paint-border);
  padding: 10px;
  border-radius: var(--paint-radius-sm);
  background: #fafafa;
}

.quick-color-item {
  background: #ffffff;
  border: 1.5px solid var(--paint-border);
  border-radius: var(--paint-radius-sm);
  padding: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.quick-color-item:hover {
  border-color: var(--paint-primary);
  transform: translateY(-2px);
  box-shadow: var(--paint-shadow-sm);
}

.quick-color-item.active {
  border-color: var(--paint-primary);
  background: #f0f9ff;
}

.quick-color-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
}

.quick-color-info {
  min-width: 0;
}

.quick-color-name {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--paint-text-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quick-color-code {
  font-size: 0.68rem;
  color: var(--paint-text-muted);
  font-family: monospace;
}

/* Paint Products Selection Grid */
.product-options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 10px;
}

.product-option-card {
  border: 2px solid var(--paint-border);
  border-radius: var(--paint-radius-md);
  padding: 12px;
  cursor: pointer;
  background: #ffffff;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.product-option-card:hover {
  border-color: #0284c7;
  transform: translateY(-2px);
}

.product-option-card.selected {
  border-color: #0284c7;
  background: #f0f9ff;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.15);
}

.prod-tag-top {
  font-size: 0.68rem;
  font-weight: 800;
  color: #0284c7;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.prod-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--paint-text-dark);
  line-height: 1.25;
}

.prod-desc {
  font-size: 0.75rem;
  color: var(--paint-text-muted);
  margin-top: 4px;
}

.prod-price-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--paint-border);
}

.prod-price {
  font-size: 1.05rem;
  font-weight: 800;
  color: #16a34a;
}

/* Area Calculation Output Result Box */
.calc-summary-card {
  background: #f0fdf4;
  border: 1.5px solid #86efac;
  border-radius: var(--paint-radius-md);
  padding: 16px;
  margin-top: 16px;
}

.calc-summary-header {
  font-size: 0.88rem;
  font-weight: 800;
  color: #166534;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.calc-can-breakdown {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  text-align: center;
}

.can-size-item {
  background: #ffffff;
  border: 1px solid #bbf7d0;
  border-radius: var(--paint-radius-sm);
  padding: 10px 8px;
}

.can-size-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: #15803d;
}

.can-size-qty {
  font-size: 1.35rem;
  font-weight: 900;
  color: #166534;
  line-height: 1.2;
  margin: 4px 0;
}

.can-size-sub {
  font-size: 0.7rem;
  color: #166534;
}

/* Tinting Machine Dispatch & Formula Display */
.tinting-console-box {
  background: #0f172a;
  color: #f8fafc;
  border-radius: var(--paint-radius-md);
  padding: 20px;
  margin-top: 14px;
  box-shadow: var(--paint-shadow-md);
}

.tinting-console-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #334155;
}

.tinting-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--paint-radius-full);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.status-waiting {
  background: rgba(234, 88, 12, 0.2);
  color: #fb923c;
  border: 1px solid #ea580c;
}
.status-mixing {
  background: rgba(2, 132, 199, 0.2);
  color: #38bdf8;
  border: 1px solid #0284c7;
}
.status-ready {
  background: rgba(22, 163, 74, 0.2);
  color: #4ade80;
  border: 1px solid #16a34a;
}

.colorant-formula-table {
  width: 100%;
  border-collapse: collapse;
  font-family: monospace;
  font-size: 0.85rem;
  margin-bottom: 16px;
}

.colorant-formula-table th {
  text-align: left;
  color: #94a3b8;
  padding: 6px 8px;
  border-bottom: 1px solid #334155;
  font-size: 0.75rem;
}

.colorant-formula-table td {
  padding: 8px;
  border-bottom: 1px solid #1e293b;
}

.colorant-chip {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

.tinting-action-bar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-dispense {
  flex: 1;
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  border: none;
  padding: 12px 18px;
  border-radius: var(--paint-radius-sm);
  font-weight: 800;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}
.btn-dispense:hover {
  background: linear-gradient(135deg, #0369a1 0%, #0284c7 100%);
}

.btn-print-label {
  background: #334155;
  color: #ffffff;
  border: none;
  padding: 12px 16px;
  border-radius: var(--paint-radius-sm);
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}
.btn-print-label:hover {
  background: #475569;
}

/* Paint Accessories & Tools Cards */
.accessories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.accessory-card {
  border: 1.5px solid var(--paint-border);
  border-radius: var(--paint-radius-md);
  padding: 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: #ffffff;
  transition: all 0.2s ease;
}

.accessory-card:hover {
  border-color: #0284c7;
  transform: translateY(-2px);
}

.accessory-name {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--paint-text-dark);
}

.accessory-price {
  font-size: 0.9rem;
  font-weight: 800;
  color: #16a34a;
  margin: 6px 0;
}

.btn-add-accessory {
  background: #f1f5f9;
  border: 1px solid var(--paint-border);
  color: #0f172a;
  padding: 6px;
  border-radius: var(--paint-radius-sm);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.btn-add-accessory:hover {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
}

/* ==========================================================================
   RIGHT COLUMN: POS CART & INVOICE ORDER SUMMARY
   ========================================================================== */
.ops-cart-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cart-card {
  background: #ffffff;
  border-radius: var(--paint-radius-lg);
  border: 1px solid var(--paint-border);
  box-shadow: var(--paint-shadow-md);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 86px;
}

.cart-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--paint-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cart-header h3 {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--paint-text-dark);
  display: flex;
  align-items: center;
  gap: 8px;
}

.cart-items-box {
  padding: 16px;
  max-height: 380px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cart-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: var(--paint-radius-sm);
  background: #f8fafc;
  border: 1px solid var(--paint-border);
}

.cart-item-info {
  flex: 1;
  min-width: 0;
}

.cart-item-title {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--paint-text-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cart-item-sub {
  font-size: 0.72rem;
  color: var(--paint-text-muted);
}

.cart-item-pricing {
  text-align: right;
  margin-left: 10px;
}

.cart-item-total {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--paint-text-dark);
}

.btn-cart-remove {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px;
  font-size: 0.85rem;
}
.btn-cart-remove:hover {
  color: #dc2626;
}

/* Order Financial Summary */
.cart-financials {
  padding: 16px 20px;
  border-top: 1px solid var(--paint-border);
  background: #fafafa;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fin-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: #475569;
}

.fin-row.total-row {
  font-size: 1.25rem;
  font-weight: 900;
  color: var(--paint-text-dark);
  border-top: 1.5px solid var(--paint-border);
  padding-top: 8px;
  margin-top: 4px;
}

.fin-riel {
  font-size: 0.85rem;
  color: #0284c7;
  font-weight: 700;
  text-align: right;
}

/* Checkout Button & Payment Method Selector */
.cart-checkout-box {
  padding: 16px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.payment-modes-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.payment-mode-btn {
  border: 1.5px solid var(--paint-border);
  border-radius: var(--paint-radius-sm);
  background: #ffffff;
  padding: 8px 4px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #334155;
  cursor: pointer;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}

.payment-mode-btn:hover {
  border-color: #0284c7;
}

.payment-mode-btn.active {
  border-color: #0284c7;
  background: #f0f9ff;
  color: #0284c7;
}

.btn-complete-order {
  width: 100%;
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
  color: #ffffff;
  border: none;
  padding: 14px;
  border-radius: var(--paint-radius-md);
  font-weight: 800;
  font-size: 1.05rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 4px 14px rgba(22, 163, 74, 0.3);
  transition: all 0.2s ease;
}

.btn-complete-order:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(22, 163, 74, 0.4);
}

/* Printable Paint Can Label Modal */
.label-modal-sheet {
  width: 380px;
  background: #ffffff;
  border: 2px solid #000000;
  padding: 20px;
  border-radius: var(--paint-radius-sm);
  font-family: var(--font-en);
  box-shadow: var(--paint-shadow-lg);
  margin: 0 auto;
}

.label-logo-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #000000;
  padding-bottom: 8px;
  margin-bottom: 12px;
}

.label-barcode {
  font-family: monospace;
  font-size: 1.8rem;
  letter-spacing: 4px;
  text-align: center;
  margin: 12px 0;
  background: #f1f5f9;
  padding: 6px;
}
