/* ============================================
   FarmBox Consolidated Stylesheet
   ============================================ */

/* --- variables.css --- */
:root {
  --color-primary: #10b981; --color-primary-dark: #059669; --color-primary-light: #34d399; --color-primary-pale: #d1fae5;
  --color-secondary: #3b82f6; --color-secondary-dark: #2563eb;
  --color-white: #ffffff;
  --color-gray-50: #f9fafb; --color-gray-100: #f3f4f6; --color-gray-200: #e5e7eb; --color-gray-300: #d1d5db; --color-gray-400: #9ca3af; --color-gray-500: #6b7280; --color-gray-600: #4b5563; --color-gray-700: #374151; --color-gray-800: #1f2937; --color-gray-900: #111827;
  --color-success: #10b981; --color-warning: #f59e0b; --color-error: #ef4444; --color-info: #3b82f6;
  --color-success-bg: #d1fae5; --color-warning-bg: #fef3c7; --color-error-bg: #fee2e2; --color-info-bg: #dbeafe;
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', sans-serif;
  --font-family-ar: 'Cairo', 'Segoe UI', 'Tahoma', sans-serif;
  --font-size-xs: 0.75rem; --font-size-sm: 0.875rem; --font-size-base: 1rem; --font-size-lg: 1.125rem; --font-size-xl: 1.25rem; --font-size-2xl: 1.5rem; --font-size-3xl: 1.875rem;
  --font-weight-normal: 400; --font-weight-medium: 500; --font-weight-semibold: 600; --font-weight-bold: 700;
  --space-1: 0.25rem; --space-2: 0.5rem; --space-3: 0.75rem; --space-4: 1rem; --space-6: 1.5rem; --space-8: 2rem; --space-10: 2.5rem; --space-12: 3rem;
  --radius-sm: 0.25rem; --radius-md: 0.375rem; --radius-lg: 0.5rem; --radius-xl: 0.75rem; --radius-2xl: 1rem; --radius-full: 9999px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05); --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --transition-fast: 150ms ease-in-out; --transition-base: 200ms ease-in-out;
  --z-dropdown: 100; --z-sticky: 200; --z-fixed: 300; --z-modal-backdrop: 400; --z-modal: 500; --z-toast: 600;
  --sidebar-width: 260px; --sidebar-collapsed-width: 70px; --header-height: 64px;
}

/* --- reset.css --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; scroll-behavior: smooth; }
body { font-family: var(--font-family); font-size: var(--font-size-base); line-height: 1.5; color: var(--color-gray-900); background-color: var(--color-gray-50); min-height: 100vh; overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; font-size: inherit; background: none; border: none; cursor: pointer; color: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; }
img, picture, svg { display: block; max-width: 100%; height: auto; }
.hidden { display: none !important; }

/* --- layout.css --- */
.app-layout { display: flex; min-height: 100vh; background-color: var(--color-gray-50); }
.sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar-width); background-color: var(--color-white); border-right: 1px solid var(--color-gray-200); z-index: var(--z-fixed); transition: width var(--transition-base), transform var(--transition-base); overflow: hidden; display: flex; flex-direction: column; }
.sidebar.collapsed { width: var(--sidebar-collapsed-width); }
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0; /* <-- Add this line to fix the mobile overflow issue */
}
.app-header { position: sticky; top: 0; height: var(--header-height); background-color: var(--color-white); border-bottom: 1px solid var(--color-gray-200); z-index: var(--z-sticky); display: flex; align-items: center; padding: 0 var(--space-4); gap: var(--space-4); }
.page-content { flex: 1; padding: var(--space-6); }
.grid { display: grid; gap: var(--space-4); }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.overlay { position: fixed; inset: 0; background-color: rgba(0, 0, 0, 0.5); z-index: var(--z-modal-backdrop); opacity: 0; pointer-events: none; transition: opacity var(--transition-base); }
.overlay.active { opacity: 1; pointer-events: all; }
@media (max-width: 767px) {
  .sidebar { transform: translateX(-100%); max-width: 80%; width: 280px; }
  .sidebar.open { transform: translateX(0) !important; box-shadow: var(--shadow-xl); }
  .page-content { padding: var(--space-4); }
}
@media (min-width: 640px) { .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 768px) {
  .main-content { margin-left: var(--sidebar-width); }
  .main-content.sidebar-collapsed { margin-left: var(--sidebar-collapsed-width); }
}

/* --- components.css --- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); padding: var(--space-3) var(--space-4); font-size: var(--font-size-sm); font-weight: var(--font-weight-medium); border-radius: var(--radius-md); border: 1px solid transparent; cursor: pointer; transition: all var(--transition-fast); white-space: nowrap; min-height: 44px; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary { background-color: var(--color-primary); color: var(--color-white); border-color: var(--color-primary); }
.btn-primary:hover:not(:disabled) { background-color: var(--color-primary-dark); }
.btn-outline { background-color: transparent; color: var(--color-gray-700); border-color: var(--color-gray-300); }
.btn-outline:hover:not(:disabled) { background-color: var(--color-gray-50); }
.btn-success { background-color: var(--color-success); color: var(--color-white); }
.btn-warning { background-color: var(--color-warning); color: var(--color-white); }
.btn-error { background-color: var(--color-error); color: var(--color-white); }
.btn-outline-error {
  background-color: transparent;
  color: var(--color-error);
  border-color: var(--color-error);
}
.btn-outline-error:hover:not(:disabled) {
  background-color: var(--color-error-bg);
}
.btn-sm { padding: var(--space-2) var(--space-3); font-size: var(--font-size-xs); min-height: 36px; }
.btn-lg { padding: var(--space-4) var(--space-6); font-size: var(--font-size-base); min-height: 52px; }
.btn-icon { width: 44px; height: 44px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.btn-block { width: 100%; display: flex; }
/* --- Tab Container (Responsive) --- */
.tabs-container {
    display: flex;
    flex-wrap: wrap; /* WRAP ON MOBILE (default) */
    gap: 0.5rem;
}

/* On screens 768px and wider, switch to a VISIBLE horizontal scrollbar */
@media (min-width: 768px) {
    .tabs-container {
        flex-wrap: nowrap;     /* Prevent items from wrapping */
        overflow-x: auto;      /* Enable horizontal scroll and SHOW the scrollbar */
        gap: 0.75rem;
        padding-bottom: 0.75rem; /* Add some space below the tabs for the visible scrollbar */
    }
}
.tab-btn {
    padding: var(--space-2) var(--space-4);
    border: 1px solid var(--color-gray-200);
    background: var(--color-white);
    color: var(--color-gray-700);
    cursor: pointer;
    border-radius: var(--radius-full); /* This makes it a pill shape */
    transition: all 0.2s;
    font-size: var(--font-size-sm);
    font-weight: 500;
    white-space: nowrap; /* Prevent text wrapping inside the button */
}
.tab-btn:hover:not(.active) {
    color: var(--color-primary-dark);
    border-color: var(--color-primary-light);
}
.tab-btn.active {
    color: var(--color-white);
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    font-weight: 600;
}
.card { background-color: var(--color-white); border-radius: var(--radius-lg); border: 1px solid var(--color-gray-200); box-shadow: var(--shadow-sm); overflow: visible; }
.card-header { padding: var(--space-4) var(--space-6); border-bottom: 1px solid var(--color-gray-200); display: flex; align-items: center; justify-content: space-between; }
.card-title { font-size: var(--font-size-lg); font-weight: var(--font-weight-semibold); color: var(--color-gray-900); }
.card-body { padding: var(--space-6); overflow: visible; }
.form-group { margin-bottom: var(--space-4); }
.form-label { display: block; font-size: var(--font-size-sm); font-weight: var(--font-weight-medium); color: var(--color-gray-700); margin-bottom: var(--space-2); }
.form-label.required::after { content: " *"; color: var(--color-error); }
.form-input, .form-select, .form-textarea { width: 100%; padding: var(--space-3) var(--space-4); font-size: var(--font-size-sm); color: var(--color-gray-900); background-color: var(--color-white); border: 1px solid var(--color-gray-300); border-radius: var(--radius-md); transition: all var(--transition-fast); min-height: 44px; }
.form-input:focus, .form-select:focus, .form-textarea:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1); }
.badge { display: inline-flex; align-items: center; gap: var(--space-1); padding: var(--space-1) var(--space-3); font-size: var(--font-size-xs); font-weight: var(--font-weight-medium); border-radius: var(--radius-full); }
.badge-primary { background-color: var(--color-primary-pale); color: var(--color-primary-dark); }
.badge-success { background-color: var(--color-success-bg); color: var(--color-success); }
.badge-warning { background-color: var(--color-warning-bg); color: var(--color-warning); }
.badge-error { background-color: var(--color-error-bg); color: var(--color-error); }
.badge-info { background-color: var(--color-info-bg); color: var(--color-info); }
.badge-status-new { background-color: #dbeafe; color: #1e40af; } .badge-status-assigned { background-color: #ede9fe; color: #6b21a8; } .badge-status-preparing { background-color: #fef3c7; color: #b45309; } .badge-status-ready_for_cashier { background-color: #d1fae5; color: #065f46; } .badge-status-at_cashier { background-color: #d1fae5; color: #065f46; } .badge-status-with_delivery { background-color: #cffafe; color: #0e7490; } .badge-status-out_for_delivery { background-color: #cffafe; color: #0e7490; } .badge-status-completed { background-color: #dcfce7; color: #166534; } .badge-status-cancelled { background-color: #fee2e2; color: #991b1b; }
.modal { position: fixed; inset: 0; z-index: var(--z-modal); display: flex; align-items: center; justify-content: center; padding: var(--space-4); opacity: 0; pointer-events: none; transition: opacity var(--transition-base); }
.modal.active { opacity: 1; pointer-events: all; }
.modal-backdrop { position: absolute; inset: 0; background-color: rgba(0,0,0,0.5); }
.modal-content { position: relative; background-color: var(--color-white); border-radius: var(--radius-xl); box-shadow: var(--shadow-xl); max-width: 600px; width: 100%; max-height: 90vh; overflow-y: auto; transform: scale(0.9); transition: transform var(--transition-base); }
.modal.active .modal-content { transform: scale(1); }
.modal-header { padding: var(--space-6); border-bottom: 1px solid var(--color-gray-200); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: var(--font-size-xl); font-weight: var(--font-weight-semibold); }
.modal-body { padding: var(--space-6); }
.modal-footer { padding: var(--space-6); border-top: 1px solid var(--color-gray-200); display: flex; gap: var(--space-3); justify-content: flex-end; }
.toast-container { position: fixed; top: var(--space-4); right: var(--space-4); z-index: var(--z-toast); display: flex; flex-direction: column; gap: var(--space-3); max-width: 400px; }
.toast { background-color: var(--color-white); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: var(--space-4); display: flex; align-items: start; gap: var(--space-3); border-left: 4px solid var(--color-gray-300); animation: slideInRight 0.3s ease-out; }
.toast-success { border-left-color: var(--color-success); } .toast-error { border-left-color: var(--color-error); }
.toast-icon { flex-shrink: 0; width: 24px; height: 24px; }
.toast-message { font-size: var(--font-size-sm); color: var(--color-gray-600); }
.toast-close { flex-shrink: 0; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; color: var(--color-gray-400); cursor: pointer; }
@keyframes slideInRight { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
/* Enhanced Loading States */
.spinner { 
  display: inline-block; 
  width: 20px; 
  height: 20px; 
  border: 3px solid var(--color-gray-200); 
  border-top-color: var(--color-primary); 
  border-radius: 50%; 
  animation: spin 0.8s linear infinite; 
}
.spinner-lg { 
  width: 40px; 
  height: 40px; 
  border-width: 4px; 
}
.spinner-sm { 
  width: 16px; 
  height: 16px; 
  border-width: 2px; 
}

/* Loading Overlay */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border-radius: inherit;
}

.loading-overlay.dark {
  background: rgba(0, 0, 0, 0.7);
  color: white;
}

/* Skeleton Loading Components */
.skeleton {
  background: linear-gradient(90deg, var(--color-gray-200) 25%, var(--color-gray-100) 50%, var(--color-gray-200) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: var(--radius-md);
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text {
  height: 1rem;
  margin-bottom: 0.5rem;
}

.skeleton-text:last-child {
  margin-bottom: 0;
}

.skeleton-text.short { width: 60%; }
.skeleton-text.medium { width: 80%; }
.skeleton-text.long { width: 100%; }

.skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.skeleton-button {
  height: 44px;
  width: 120px;
}

.skeleton-card {
  padding: var(--space-6);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-gray-200);
}

.skeleton-table-row {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-4);
  border-bottom: 1px solid var(--color-gray-200);
}

.skeleton-table-cell {
  flex: 1;
  height: 1.5rem;
}

/* Page Loading States */
.page-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  gap: var(--space-4);
}

.page-loading .spinner-lg {
  margin-bottom: var(--space-2);
}

.page-loading-text {
  color: var(--color-gray-600);
  font-size: var(--font-size-sm);
  font-weight: 500;
}

/* Content Loading States */
.content-loading {
  opacity: 0.6;
  pointer-events: none;
  position: relative;
}

.content-loading::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Button Loading States */
.btn-loading {
  position: relative;
  color: transparent !important;
}

.btn-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.btn-loading.btn-primary::after {
  border-top-color: white;
}

/* Table Loading States */
.table-loading {
  position: relative;
}

.table-loading tbody tr {
  opacity: 0.3;
}

.table-loading::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Card Loading States */
.card-loading {
  position: relative;
  overflow: hidden;
}

.card-loading::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

/* Progress Indicators */
.progress-bar {
  width: 100%;
  height: 4px;
  background: var(--color-gray-200);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--color-primary);
  border-radius: 2px;
  transition: width 0.3s ease;
  animation: progress-pulse 1.5s ease-in-out infinite;
}

@keyframes progress-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Fade In Animation */
.fade-in {
  animation: fadeIn 0.3s ease-in-out;
}

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

/* Pulse Animation for Interactive Elements */
.pulse {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Network Status Indicator */
.network-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--color-gray-100);
  border-radius: var(--radius-full);
  font-size: var(--font-size-sm);
  font-weight: 500;
  transition: all var(--transition-fast);
}

.network-indicator {
  font-size: 0.75rem;
  animation: pulse 2s infinite;
}

.network-indicator.online {
  color: var(--color-success);
}

.network-indicator.offline {
  color: var(--color-error);
}

.network-indicator.syncing {
  color: var(--color-warning);
  animation: spin 1s linear infinite;
}

@keyframes spin { 
  to { transform: rotate(360deg); } 
}
.empty-state { text-align: center; padding: var(--space-12) var(--space-6); }
.empty-state-icon { font-size: 4rem; margin: 0 auto var(--space-4); color: var(--color-gray-400); }
.empty-state-title { font-size: var(--font-size-lg); font-weight: var(--font-weight-semibold); margin-bottom: var(--space-2); }
.empty-state-description { font-size: var(--font-size-sm); color: var(--color-gray-600); }
.search-bar { position: relative; width: 100%; }
.search-input { width: 100%; padding-left: var(--space-10); }
.search-icon { position: absolute; left: var(--space-3); top: 50%; transform: translateY(-50%); color: var(--color-gray-400); }
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  width: 100%; /* This is the key fix: match the button's width */
  margin-top: var(--space-2);
  background-color: var(--color-white);
  border: 1px solid var(--color-gray-200);
  border-radius: var(--radius-md); /* Match the button's border radius */
  box-shadow: var(--shadow-lg);
  z-index: var(--z-dropdown);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all var(--transition-fast);
  overflow: hidden; /* Ensures content respects the border radius */
}
.dropdown.active .dropdown-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown-item {
  display: block; /* Use block for simpler alignment */
  width: 100%;
  text-align: left; /* Ensure text is left-aligned */
  padding: var(--space-3) var(--space-4);
  font-size: var(--font-size-sm);
  cursor: pointer;
  border-radius: var(--radius-md); /* Rounded corners for each item */
  transition: background-color var(--transition-fast);
}
.dropdown-item:hover { background-color: var(--color-gray-50); }
.dropdown-divider { height: 1px; background-color: var(--color-gray-200); margin: var(--space-2) 0; }
.sidebar-header {
  padding: var(--space-4); /* Reduced padding for a tighter look */
  border-bottom: 1px solid var(--color-primary-dark);
  background-color: var(--color-primary); /* Solid color like your image */
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: var(--header-height); /* Enforce consistent height */
}
.sidebar-close { display: none; color: var(--color-white); border-color: rgba(255, 255, 255, 0.2); }
@media (max-width: 767px) { .sidebar-close { display: inline-flex; } }
.sidebar-logo { display: flex; align-items: center; gap: var(--space-3); }
.logo-icon {
  width: 48px; /* Slightly larger */
  height: 48px; /* Slightly larger */
  background: transparent;
  border-radius: 50%; /* Makes it a circle */
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden; /* This is KEY: clips the square image into a circle */
}

.logo-title { font-weight: var(--font-weight-semibold); font-size: var(--font-size-base); }
.logo-subtitle { font-size: var(--font-size-xs); opacity: 0.9; }
.sidebar-nav { flex: 1; padding: var(--space-4) var(--space-3); overflow-y: auto; }
.sidebar-item { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); margin-bottom: var(--space-1); border-radius: var(--radius-md); color: var(--color-gray-700); text-decoration: none; font-size: var(--font-size-sm); font-weight: var(--font-weight-medium); transition: all var(--transition-fast); cursor: pointer; background: transparent; width: 100%; border: none; text-align: left; }
.sidebar-item:hover { background-color: var(--color-gray-100); color: var(--color-gray-900); }
.sidebar-item.active { background-color: var(--color-primary-pale); color: var(--color-primary-dark); font-weight: var(--font-weight-semibold); }
.sidebar-icon { width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.sidebar-footer { padding: var(--space-4) var(--space-3); border-top: 1px solid var(--color-gray-200); }
.logout-btn:hover { background-color: var(--color-error-bg); color: var(--color-error); }
.sidebar.collapsed .logo-text, .sidebar.collapsed .sidebar-label { display: none; }
.sidebar.collapsed .sidebar-header {
    justify-content: center;
}
.sidebar.collapsed .sidebar-item { justify-content: center; padding: var(--space-3); }

/* --- rtl.css --- */
body[dir="rtl"] { font-family: var(--font-family-ar); direction: rtl; text-align: right; }
body[dir="rtl"] .sidebar { left: auto; right: 0; border-right: none; border-left: 1px solid var(--color-gray-200); }
body[dir="rtl"] .sidebar-item { text-align: right; }
body[dir="rtl"] .main-content { margin-left: 0; }
@media (min-width: 768px) { body[dir="rtl"] .main-content { margin-right: var(--sidebar-width); } body[dir="rtl"] .main-content.sidebar-collapsed { margin-right: var(--sidebar-collapsed-width); } }
@media (max-width: 767px) { body[dir="rtl"] .sidebar { transform: translateX(100%); } }
body[dir="rtl"] .search-input { padding-left: var(--space-4); padding-right: var(--space-10); }
body[dir="rtl"] .search-icon { left: auto; right: var(--space-3); }
body[dir="rtl"] .toast-container { right: auto; left: var(--space-4); }
body[dir="rtl"] .toast { border-left: none; border-right: 4px solid var(--color-gray-300); animation: slideInLeft 0.3s ease-out; }
@keyframes slideInLeft { from { transform: translateX(-100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Custom additions for table */
.table-container {
    width: 100%;
    overflow-x: auto;
}
table {
    width: 100%;
    border-collapse: collapse;
    text-align: center;
}
th, td {
    padding: var(--space-4);
    border-bottom: 1px solid var(--color-gray-200);
    font-size: var(--font-size-sm);
    white-space: nowrap;
    text-align: center;
}
th {
    font-weight: var(--font-weight-semibold);
    color: var(--color-gray-600);
    background-color: var(--color-gray-50);
    text-align: center;
}
tbody tr:hover {
    background-color: var(--color-gray-50);
}
/* Center action buttons in table cells */
td .btn-group {
    display: flex;
    justify-content: center;
    gap: var(--space-2);
}
/* --- Login Page Styles --- */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background-color: var(--color-gray-50);
  padding: var(--space-4);
}
.login-box {
  width: 100%;
  max-width: 400px;
}
/* --- Toggle Switch Component --- */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--color-gray-300);
  transition: var(--transition-fast);
  border-radius: 34px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: var(--transition-fast);
  border-radius: 50%;
}
input:checked + .slider {
  background-color: var(--color-primary);
}
input:checked + .slider:before {
  transform: translateX(20px);
}
input:disabled + .slider {
    cursor: not-allowed;
    opacity: 0.6;
}
/* --- List Group Component --- */
.list-group {
    display: flex;
    flex-direction: column;
    padding-left: 0;
    margin-bottom: 0;
    border-radius: var(--radius-lg);
}
.list-group-item {
    position: relative;
    display: block;
    padding: var(--space-3) var(--space-4);
    background-color: var(--color-white);
    border-bottom: 1px solid var(--color-gray-200);
}
.list-group-item:first-child {
    border-top-left-radius: inherit;
    border-top-right-radius: inherit;
}
.list-group-item:last-child {
    border-bottom: none;
    border-bottom-right-radius: inherit;
    border-bottom-left-radius: inherit;
}
/* --- Report Stat Card --- */
.stat-card {
    background-color: var(--color-white);
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    text-align: center;
}
.stat-title {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--color-gray-600);
    margin-bottom: var(--space-2);
}
.stat-value {
    font-size: var(--font-size-3xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-gray-900);
}
/* --- Report Tabs --- */
.report-tabs {
    display: flex;
    border-bottom: 1px solid var(--color-gray-200);
    padding: 0 var(--space-4);
}
.report-tab-content.active {
    display: block;
}
/* --- Dashboard Enhancements --- */
.stat-card.interactive {
    transition: all var(--transition-fast);
}
.stat-card.interactive:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--color-primary);
}
.text-warning { color: var(--color-warning); }
.text-info { color: var(--color-info); }
.text-error { color: var(--color-error); }
/* --- Custom Search Dropdown --- */
.dropdown-menu.active {
  opacity: 1;
  visibility: visible;
  border: 1px solid var(--color-gray-200);
  box-shadow: var(--shadow-lg);
  background-color: var(--color-white);
  border-radius: var(--radius-md);
  z-index: var(--z-dropdown);
}

.customer-result-item {
  line-height: 1.4;
  cursor: pointer;
}

.customer-result-item small {
  color: var(--color-gray-600);
  white-space: normal; /* Allows long addresses to wrap nicely */
}

#customer-details {
  border: 1px solid var(--color-primary-pale); /* Adds a subtle highlight */
}

/* Customer search dropdown - ensure it appears above other content */
#customer-search-results {
  z-index: 1000;
}

/* Allow dropdown to overflow the form group container */
.form-group {
  overflow: visible;
}
/* --- Product Card (Compact & Clean Styling) --- */
.product-card {
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    flex-direction: column;
}

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

.product-card .card-body {
    padding: 0.75rem; /* REDUCED padding for a tighter feel */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex-grow: 1;
}

.product-card-info {
    margin-bottom: 1rem; /* REDUCED space between title and footer */
    /* REMOVED the min-height to eliminate extra whitespace */
}

.product-card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-gray-800);
    line-height: 1.4;
    font-family: var(--font-family-ar);
}

.product-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: auto;
}

/* Price Styling */
.product-card-price {
    color: var(--color-primary-dark);
    font-weight: 600;
}
.price-value {
    font-size: 1.125rem;
}
.price-unit {
    font-size: 0.8rem;
    color: var(--color-gray-500);
}

/* Stock Status Styling */
.product-card-stock {
    font-weight: 500;
    padding: 0.3rem 0.8rem;
    border-radius: var(--radius-full);
    text-align: center;
    min-width: 90px;
}

.product-card-stock .stock-quantity {
    font-size: 1rem;
    font-weight: 700;
    display: block;
}

.product-card-stock .stock-label {
    font-size: 0.7rem;
    display: block;
    line-height: 1;
}

/* Stock Status Colors */
.product-card-stock.stock-ok {
    background-color: var(--color-success-bg);
    color: var(--color-success);
}
.product-card-stock.stock-low {
    background-color: var(--color-warning-bg);
    color: var(--color-warning);
}
.product-card-stock.stock-out {
    background-color: var(--color-error-bg);
    color: var(--color-error);
    font-size: 0.875rem;
    padding: 0.5rem 0.8rem;
}
/* --- Order Summary UI/UX Improvements --- */

/* Individual Cart Item Styling */
.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--color-gray-200);
}

.cart-item:first-child {
    padding-top: 0;
}

.cart-item-details {
    flex-grow: 1;
}

.cart-item-details strong {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: 600;
    font-family: var(--font-family-ar);
    color: var(--color-gray-800);
    line-height: 1.4;
}

.cart-item-details small {
    font-size: var(--font-size-xs);
    color: var(--color-gray-500);
}

/* Controls for Quantity and Remove Button */
.cart-item-controls {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.cart-item-qty {
    width: 70px;
    height: 38px;
    text-align: center;
    padding-left: var(--space-2);
    padding-right: var(--space-2);
}

.remove-cart-item {
    background: transparent;
    border: 1px solid var(--color-gray-200);
    color: var(--color-gray-500);
    width: 38px;
    height: 38px;
}

.remove-cart-item:hover {
    background-color: var(--color-error-bg);
    border-color: var(--color-error-bg);
    color: var(--color-error);
}

/* Summary Totals Styling */
.summary-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: var(--font-size-sm);
    color: var(--color-gray-600);
    margin-bottom: var(--space-2);
}

.cart-total-line {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--color-gray-900);
    margin-top: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px solid var(--color-gray-300);
}
/* --- System-Wide Custom Select Dropdown --- */
.custom-select {
  position: relative;
  width: 100%;
}

.custom-select-input {
  display: none; /* The hidden input that holds the actual value */
}

.select-button {
  /* Mimic the form-input style for consistency */
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-size: var(--font-size-sm);
  color: var(--color-gray-900);
  background-color: var(--color-white);
  border: 1px solid var(--color-gray-300);
  border-radius: var(--radius-md);
  min-height: 44px;
  text-align: left;
  transition: all var(--transition-fast);
}

.select-button:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.select-button-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.select-button .select-arrow {
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}

/* Dropdown styles */
.select-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background-color: var(--color-white);
  border: 1px solid var(--color-gray-200);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-dropdown);
  max-height: 200px;
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.custom-select.active .select-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.custom-select.active .select-button .select-arrow {
  transform: rotate(180deg);
}

.select-dropdown li {
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  list-style-type: none;
  transition: background-color var(--transition-fast);
}

.select-dropdown li:hover {
  background-color: var(--color-gray-50);
}

.select-dropdown li.selected {
  background-color: var(--color-primary-pale);
  color: var(--color-primary-dark);
  font-weight: var(--font-weight-medium);
}
/* --- Order Tracker Timeline --- */
.timeline {
  position: relative;
  padding-left: 1.5rem; /* Space for the line */
}

.timeline::before {
  content: '';
  position: absolute;
  left: 8px; /* Center the 2px line on the 18px dot */
  top: 1rem;
  bottom: 1rem;
  width: 2px;
  background-color: var(--color-gray-200);
}

.timeline-item {
  position: relative;
  padding-left: 2rem; /* Space for the dot */
  margin-bottom: 2rem;
}

.timeline-item:last-child {
  margin-bottom: 0;
}

/* This is now the dot ON the line */
.timeline-item::after {
  content: '';
  position: absolute;
  left: 0;
  top: 6px; /* Align with the center of the first line of text */
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background-color: var(--color-white);
  border: 2px solid var(--color-gray-300);
  z-index: 1;
}

/* This is now the icon circle */
.timeline-dot {
  position: absolute;
  left: 2.5rem; /* Position it to the right of the dot */
  top: -4px; /* Align vertically with the dot */
  width: 36px; /* Smaller icon circle */
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--color-gray-100);
  border: 1px solid var(--color-gray-200);
}

.timeline-dot svg {
  width: 18px;
  height: 18px;
  color: var(--color-gray-600);
}

.timeline-content {
  padding-left: 3rem; /* Make space for the icon */
}

/* --- State-based styling --- */

/* Completed Step Styling */
.timeline-item.completed::after {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
}
.timeline-item.completed .timeline-dot {
  background-color: var(--color-primary-pale);
  border-color: var(--color-primary-light);
}
.timeline-item.completed .timeline-dot svg {
  color: var(--color-primary);
}
.timeline-item.completed .timeline-title {
  color: var(--color-gray-800);
}

/* Current (Active) Step Styling */
.timeline-item.active::after {
  background-color: var(--color-white);
  border-color: var(--color-primary);
  transform: scale(1.1);
  border-width: 3px;
}
.timeline-item.active .timeline-dot {
  background-color: var(--color-primary-pale);
  border-color: var(--color-primary);
}
.timeline-item.active .timeline-dot svg {
  color: var(--color-primary);
}
.timeline-item.active .timeline-title {
  color: var(--color-primary-dark);
  font-weight: 700;
}

/* Future Step Styling (default) */
.timeline-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-gray-500); /* Dim future steps */
  margin-bottom: 0.25rem;
}
.timeline-meta {
  font-size: 0.875rem;
  color: var(--color-gray-500);
}
.timeline-duration {
    position: absolute;
    left: 8px; /* Center on the timeline's vertical line */
    top: -1.2rem; /* Position it vertically between the current and previous dot */
    transform: translateX(-50%);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--color-gray-500);
    background-color: var(--color-white); /* Creates a break in the line */
    padding: 2px 6px;
    z-index: 2; /* Ensures it sits on top of the line */
    border-radius: var(--radius-full);
    border: 1px solid var(--color-gray-200);
}

.timeline-item.completed .timeline-duration {
    color: var(--color-primary-dark);
    border-color: var(--color-primary-pale);
}