:root {
  --bg-color: #F8FAFC;
  --surface-color: #FFFFFF;
  --text-primary: #0F172A;
  --text-secondary: #334155;
  --primary-color: #DC2626; 
  --primary-hover: #B91C1C; 
  --border-color: #E2E8F0;
  --success-color: #10b981;
  --success-hover: #059669;
  --brand-dark: #1E293B;
}

body.dark-mode {
  --bg-color: #111827;
  --surface-color: #1f2937;
  --text-primary: #ffffff;
  --text-secondary: #ffffff;
  --border-color: #374151;
}

body.dark-mode * {
  color: #ffffff !important;
}

/* Exemptions for buttons and specific status colors where white text would hide icons or meanings */
body.dark-mode .btn-primary, 
body.dark-mode .btn-success, 
body.dark-mode .btn-danger,
body.dark-mode .badge,
body.dark-mode .text-white {
  color: white !important;
}


/* Modals need strong dark surface mapping too */
body.dark-mode .modal-content {
  background-color: var(--surface-color);
  color: var(--text-primary);
}
body.dark-mode input, body.dark-mode select, body.dark-mode textarea {
  background-color: #374151;
  color: #f9fafb;
}
body.dark-mode table th {
  background-color: #374151;
}
body.dark-mode tr:hover td {
  background-color: #374151;
}
body.dark-mode .nav-item:hover {
  background-color: #374151;
}
body.dark-mode .btn-secondary {
  color: #ffffff;
  border-color: #ffffff;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 1rem;
  transition: all 0.15s ease-in-out;
}

input, select, textarea {
  font-family: inherit;
  font-size: 1rem;
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  outline: none;
  width: 100%;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  font-weight: 500;
}

.btn-primary:hover { background-color: var(--primary-hover); transform: translateY(-1px); }
.btn-primary:disabled { background-color: #fca5a5; cursor: not-allowed; transform: none; }

.btn-secondary {
  background-color: transparent;
  color: var(--primary-color);
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  font-weight: 500;
  border: 1px solid var(--primary-color);
}

.btn-secondary:hover { background-color: rgba(239, 68, 68, 0.05); }

.btn-success { background-color: var(--success-color); color: white; padding: 0.75rem 1.5rem; border-radius: 0.5rem; font-weight: 500; }
.btn-success:hover { background-color: var(--success-hover); }

.btn-danger {
  background-color: #ef4444;
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  font-weight: 500;
}
.btn-danger:hover {
  background-color: #dc2626;
}

.card {
  background-color: var(--surface-color);
  border-radius: 0.5rem;
  padding: 1.5rem;
  border: 1px solid var(--border-color);
  box-shadow: none;
}

/* Layout */
.app-container { 
  display: flex; 
  min-height: 100vh; 
  zoom: 0.72; /* Adjusted to make 100% zoom look like 90% of current */
}
.sidebar { 
  width: 250px; 
  background-color: var(--brand-dark); 
  border-right: 1px solid var(--brand-dark); 
  padding: 1.5rem; 
  display: flex; 
  flex-direction: column; 
  color: white;
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  z-index: 100;
}
.main-content { 
  flex: 1; 
  padding: 2rem; 
  overflow-y: auto; 
  background-color: var(--bg-color);
  margin-left: 250px; /* Offset for fixed sidebar */
}

/* Utilities */
.flex { display: flex; } .flex-col { flex-direction: column; } .items-center { align-items: center; } .justify-between { justify-content: space-between; } .justify-center { justify-content: center; }
.gap-2 { gap: 0.5rem; } .gap-4 { gap: 1rem; }
.mb-4 { margin-bottom: 1rem; } .mb-2 { margin-bottom: 0.5rem; } .mb-6 { margin-bottom: 1.5rem;} .mb-8 { margin-bottom: 2rem; }
.mt-2 { margin-top: 0.5rem; } .mt-4 { margin-top: 1rem; }
.text-sm { font-size: 0.875rem; } .text-lg { font-size: 1.125rem; } .text-xl { font-size: 1.25rem; } .text-2xl { font-size: 1.5rem; } .text-3xl { font-size: 1.875rem; }
.font-bold { font-weight: 700; } .font-semibold { font-weight: 600; }
.text-gray-500 { color: var(--text-secondary); } .text-red-500 { color: var(--primary-color); } .text-green-500 { color: var(--success-color); }
.w-full { width: 100%; } .text-center { text-align: center; }
.grid { display: grid; } .grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.text-white { color: white !important; }
.bg-blue-600 { background-color: #2563eb !important; }
.bg-red-500 { background-color: #ef4444 !important; }
.bg-slate-500 { background-color: #64748b !important; }
.bg-yellow-500 { background-color: #f59e0b !important; }
.bg-gray-100 { background-color: #f3f4f6 !important; }
body.dark-mode .bg-gray-100 { background-color: #374151 !important; }
.rounded { border-radius: 0.375rem; }
.shadow-sm { box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); }
.transition-colors { transition-property: color, background-color, border-color, text-decoration-color, fill, stroke; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; }
.font-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.text-10px { font-size: 10px; }
.min-w-20px { min-width: 20px; }

/* Position Utilities */
.relative { position: relative; }
.absolute { position: absolute; }
.top-1/2 { top: 50%; }
.-translate-y-1/2 { transform: translateY(-50%); }
.left-3 { left: 0.75rem; }
.pl-10 { padding-left: 2.5rem; }
.pr-10 { padding-right: 2.5rem; }

/* Specific Components */
.nav-item {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; border-radius: 0.5rem; color: #94a3b8; font-weight: 500; margin-bottom: 0.5rem;
}
.nav-item:hover { background-color: #334155; color: white; }
.nav-item.active { background-color: var(--primary-color); color: white; }

.product-card { border: 1px solid var(--border-color); border-radius: 0.5rem; padding: 1rem; cursor: pointer; transition: all 0.15s; text-align: center; }
.product-card:hover { border-color: var(--primary-color); background-color: rgba(220, 38, 38, 0.02); }
.product-card.selected { border-color: var(--primary-color); background-color: rgba(220, 38, 38, 0.05); }

.table-container { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 1rem; text-align: left; border-bottom: 1px solid var(--border-color); }
th { font-weight: 600; color: var(--text-secondary); background-color: var(--bg-color); white-space: nowrap; }
tr:hover td { background-color: var(--bg-color); }

.badge { display: inline-block; padding: 0.25rem 0.5rem; border-radius: 9999px; font-size: 0.75rem; font-weight: 600; }
.badge-red { background-color: #fee2e2; color: #991b1b; }
.badge-gray { background-color: #f3f4f6; color: #374151; }
.badge-green { background-color: #d1fae5; color: #065f46; }
.badge-yellow { background-color: #fef3c7; color: #92400e; }

body.dark-mode .badge-gray { background-color: #374151; color: #ffffff !important; }
body.dark-mode .badge-green { background-color: #065f46; color: #ffffff !important; }
body.dark-mode .badge-yellow { background-color: #92400e; color: #ffffff !important; }
body.dark-mode .badge-red { background-color: #991b1b; color: #ffffff !important; }

.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.5rem; font-weight: 500; color: var(--text-primary); }

.logo-container { text-align: center; margin-bottom: 1.5rem; }
.logo-container img { 
  width: 80px; height: 80px; object-fit: contain; 
  transition: transform 0.3s ease;
}
.logo-container img:hover {
  transform: translateY(-2px);
}

.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(15, 23, 42, 0.7); display: flex; justify-content: center; align-items: center; z-index: 1000;
}
.modal-content {
  background-color: white; padding: 2rem; border-radius: 0.5rem; border: 1px solid var(--border-color);
  width: 100%; max-width: 400px;
}

/* Dropdown Search List */
.search-dropdown {
  position: absolute; top: 70px; width: 100%; background-color: var(--surface-color); color: var(--text-primary); border: 1px solid var(--border-color); border-radius: 0.5rem;
  max-height: 200px; overflow-y: auto; z-index: 50; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}
.search-item { padding: 0.75rem; cursor: pointer; border-bottom: 1px solid var(--border-color); }
.search-item:hover { background-color: var(--bg-color); }
.search-item:last-child { border-bottom: none; }

.washer-btn {
  padding: 0.375rem 0.25rem;
  border-radius: 0.375rem;
  font-weight: 700;
  font-size: 10px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-color);
  color: var(--text-primary);
  transition: all 0.15s;
  cursor: pointer;
  text-transform: uppercase;
}
.washer-btn:hover { border-color: var(--primary-color); }
.washer-btn.selected {
  background-color: var(--primary-color);
  color: white;
  border-color: var(--primary-hover);
}

.print-only { display: none; }

/* Segmented Toggle */
.segmented-toggle {
  display: flex;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  padding: 2px;
  width: 100%;
}
.toggle-option {
  flex: 1;
  text-align: center;
  padding: 0.5rem;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 0.4rem;
  transition: all 0.2s;
  color: var(--text-secondary);
}
.toggle-option.active {
  background: var(--primary-color);
  color: white;
}

@media print {
  body { 
    background: white !important; 
    margin: 0 !important; 
    padding: 0 !important; 
    visibility: hidden;
    display: flex !important;
    justify-content: center !important;
    align-items: flex-start !important;
  }
  
  #print-root {
    display: block !important;
    visibility: visible !important;
    position: relative !important;
    width: 100% !important;
    max-width: 80mm !important;
    margin: 20mm auto !important;
    padding: 10px;
    background: white !important;
    color: black !important;
    border: none !important;
  }

  #print-root * {
    visibility: visible !important;
    color: black !important;
    border-color: black !important;
  }

  @page {
    margin: 0;
    size: auto;
  }
}

/* Login logo animation */
@keyframes spinIn {
  from { opacity: 0; transform: scale(0.6) rotate(-15deg); }
  to   { opacity: 1; transform: scale(1) rotate(0deg); }
}
/* Custom Toggle Detail Button */
.btn-toggle-detail {
  padding: 0.5rem 1rem;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  border-radius: 0.5rem;
  border: 2px solid #3b82f6;
  color: #2563eb;
  background: transparent;
  transition: all 0.2s;
}

.btn-toggle-detail:hover {
  background-color: #2563eb;
  color: white;
}

body.dark-mode .btn-toggle-detail {
  border-color: #ffffff;
  color: #ffffff;
}

body.dark-mode .btn-toggle-detail:hover {
  background-color: #ffffff;
  color: #0f172a;
}

/* Hide number input spinners */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type=number] {
  -moz-appearance: textfield;
}

.btn-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem;
  width: 100%;
  border-radius: 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: #94a3b8;
  background-color: rgba(148, 163, 184, 0.1);
  border: 1px solid rgba(148, 163, 184, 0.2);
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.btn-logout:hover {
  background-color: #ef4444;
  color: white !important;
  border-color: #ef4444;
}

body.dark-mode .btn-logout {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.3);
  background-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .btn-logout:hover {
  background-color: #ef4444;
  border-color: #ef4444;
}
