@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ==========================================================================
   FoodFlow Enterprise Design System
   US Market SaaS Standard
   ========================================================================== */

:root {
  /* Core Foundation - Slate / Navy */
  --color-slate-50: #f8fafc;
  --color-slate-100: #f1f5f9;
  --color-slate-200: #e2e8f0;
  --color-slate-300: #cbd5e1;
  --color-slate-700: #334155;
  --color-slate-800: #1e293b;
  --color-slate-900: #0f172a;
  
  /* Brand Primary - Electric Blue */
  --color-blue-50: #eff6ff;
  --color-blue-100: #dbeafe;
  --color-blue-500: #3b82f6;
  --color-blue-600: #2563eb;
  --color-blue-700: #1d4ed8;

  /* Semantic - Success (Emerald) */
  --color-emerald-50: #ecfdf5;
  --color-emerald-500: #10b981;
  --color-emerald-600: #059669;

  /* Semantic - Warning (Amber) */
  --color-amber-50: #fffbeb;
  --color-amber-500: #f59e0b;
  
  /* Semantic - Danger (Rose) */
  --color-rose-50: #fff1f2;
  --color-rose-500: #f43f5e;

  /* 
   * THEME: LIGHT (DEFAULT) 
   */
  --bg-app: var(--color-slate-50);
  --bg-surface: #ffffff;
  --bg-surface-hover: var(--color-slate-50);
  --bg-surface-active: var(--color-slate-100);
  
  --text-main: var(--color-slate-900);
  --text-muted: var(--color-slate-700);
  --text-placeholder: var(--color-slate-300);
  
  --border-subtle: var(--color-slate-200);
  --border-strong: var(--color-slate-300);
  
  --brand-primary: var(--color-blue-600);
  --brand-primary-hover: var(--color-blue-700);
  --brand-primary-bg: var(--color-blue-50);
  
  /* Layout */
  --sidebar-width: 260px;
  --sidebar-width-collapsed: 72px;
  --topbar-height: 64px;
  
  /* Shadows & Elevations */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-float: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  
  /* Glassmorphism */
  --glass-bg: rgba(255, 255, 255, 0.8);
  --glass-border: rgba(255, 255, 255, 0.4);
  --blur-md: blur(12px);

  /* Animations */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* 
 * THEME: DARK 
 */
[data-theme="dark"] {
  --bg-app: #020617; /* Very dark slate */
  --bg-surface: var(--color-slate-900);
  --bg-surface-hover: var(--color-slate-800);
  --bg-surface-active: var(--color-slate-700);
  
  --text-main: var(--color-slate-50);
  --text-muted: var(--color-slate-300);
  --text-placeholder: var(--color-slate-700);
  
  --border-subtle: var(--color-slate-800);
  --border-strong: var(--color-slate-700);
  
  --brand-primary: var(--color-blue-500);
  --brand-primary-hover: var(--color-blue-600);
  --brand-primary-bg: rgba(59, 130, 246, 0.15);
  
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.5);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.6), 0 2px 4px -2px rgb(0 0 0 / 0.4);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.8), 0 4px 6px -4px rgb(0 0 0 / 0.5);
  --shadow-float: 0 25px 50px -12px rgb(0 0 0 / 0.7);

  --glass-bg: rgba(15, 23, 42, 0.8);
  --glass-border: rgba(255, 255, 255, 0.05);
}

/* ==========================================================================
   Resets & Globals
   ========================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-main);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ==========================================================================
   App Shell (Sidebar & Topbar)
   ========================================================================== */
.app-shell {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  position: relative;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  transition: width var(--transition-normal), background-color var(--transition-normal);
  z-index: 40;
  flex-shrink: 0;
}

.sidebar.collapsed {
  width: var(--sidebar-width-collapsed);
}

.sidebar-header {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  padding: 0 20px;
  border-bottom: 1px solid var(--border-subtle);
  transition: padding var(--transition-normal);
  overflow: hidden;
  white-space: nowrap;
}

.sidebar.collapsed .sidebar-header {
  padding: 0 16px;
  justify-content: center;
}

.logo-icon {
  color: var(--brand-primary);
  font-size: 28px;
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}
.sidebar-header:hover .logo-icon {
  transform: scale(1.1);
}

.brand-name {
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  margin-left: 12px;
  transition: opacity var(--transition-fast);
}
.sidebar.collapsed .brand-name {
  opacity: 0;
  display: none;
}

/* Sidebar Navigation */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-placeholder);
  font-weight: 600;
  margin: 16px 0 8px 12px;
  transition: opacity var(--transition-fast);
}
.sidebar.collapsed .nav-section-title {
  opacity: 0;
  height: 0;
  margin: 0;
  overflow: hidden;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  text-decoration: none;
  color: var(--text-muted);
  border-radius: 6px;
  font-weight: 500;
  transition: all var(--transition-fast);
  position: relative;
  white-space: nowrap;
}

.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 10px 0;
}

.nav-item:hover {
  background-color: var(--bg-surface-hover);
  color: var(--text-main);
}

.nav-item.active {
  background-color: var(--brand-primary-bg);
  color: var(--brand-primary);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 15%;
  height: 70%;
  width: 4px;
  background-color: var(--brand-primary);
  border-radius: 0 4px 4px 0;
}
.sidebar.collapsed .nav-item.active::before {
  left: 0;
}

.nav-item .material-symbols-outlined {
  font-size: 20px;
  flex-shrink: 0;
  transition: margin var(--transition-normal);
}
.sidebar:not(.collapsed) .nav-item .material-symbols-outlined {
  margin-right: 12px;
}

.nav-label {
  transition: opacity var(--transition-normal);
}
.sidebar.collapsed .nav-label {
  opacity: 0;
  display: none;
}

/* Tooltip for collapsed sidebar */
.nav-item::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 8px);
  background: var(--bg-surface-active);
  color: var(--text-main);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  transform: translateX(-10px);
  transition: all var(--transition-fast);
  z-index: 100;
}
.sidebar.collapsed .nav-item:hover::after {
  opacity: 1;
  transform: translateX(0);
}

/* Main Wrapper */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* Topbar */
.topbar {
  height: var(--topbar-height);
  background-color: var(--glass-bg);
  backdrop-filter: var(--blur-md);
  -webkit-backdrop-filter: var(--blur-md);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 30;
  transition: background-color var(--transition-normal);
}

.topbar-left, .topbar-center, .topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Toggle Sidebar Btn */
.sidebar-toggle {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  transition: all var(--transition-fast);
}
.sidebar-toggle:hover {
  background: var(--bg-surface-active);
  color: var(--text-main);
}

/* Selectors (Tenant / Warehouse) */
.context-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 500;
  font-size: 13px;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}
.context-selector:hover {
  background-color: var(--bg-surface-active);
  color: var(--text-main);
  border-color: var(--border-subtle);
}
.context-selector .material-symbols-outlined {
  font-size: 18px;
}
.context-selector .primary-text {
  font-weight: 600;
  color: var(--text-main);
}

/* Global Search */
.search-bar {
  display: flex;
  align-items: center;
  background-color: var(--bg-surface-active);
  border-radius: 8px;
  padding: 0 12px;
  width: 360px;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
}
.search-bar:focus-within {
  background-color: var(--bg-surface);
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--brand-primary-bg);
}
.search-bar input {
  border: none;
  background: transparent;
  padding: 8px 10px;
  width: 100%;
  color: var(--text-main);
  outline: none;
  font-family: inherit;
  font-size: 14px;
}
.search-bar input::placeholder {
  color: var(--text-placeholder);
}
.search-bar .material-symbols-outlined {
  color: var(--text-placeholder);
  font-size: 18px;
}
.search-shortcut {
  font-size: 11px;
  color: var(--text-placeholder);
  border: 1px solid var(--border-strong);
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-surface);
}

/* Icon Buttons */
.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  transition: all var(--transition-fast);
}
.icon-btn:hover {
  background-color: var(--bg-surface-active);
  color: var(--text-main);
}
.icon-btn .badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background-color: var(--color-rose-500);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 10px;
  min-width: 16px;
  text-align: center;
  border: 2px solid var(--bg-surface);
  box-sizing: content-box;
}

/* User Profile */
.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 4px;
  border-radius: 20px;
  transition: background var(--transition-fast);
}
.user-profile:hover {
  background: var(--bg-surface-active);
}
.avatar {
  background: linear-gradient(135deg, var(--brand-primary), var(--color-blue-500));
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.5px;
  box-shadow: var(--shadow-sm);
}

/* Main Content Area */
.main-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 32px;
  scroll-behavior: smooth;
}

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  gap: 16px;
  animation: pulse 2s infinite ease-in-out;
}
@keyframes pulse {
  0% { opacity: 0.6; }
  50% { opacity: 1; }
  100% { opacity: 0.6; }
}
.rotating {
  animation: spin 1s linear infinite;
  font-size: 32px;
  color: var(--brand-primary);
}
@keyframes spin {
  100% { transform: rotate(360deg); }
}

/* ==========================================================================
   UI Components (Design System)
   ========================================================================== */

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  outline: none;
  font-family: inherit;
}
.btn .material-symbols-outlined {
  font-size: 18px;
}
.btn:focus-visible {
  box-shadow: 0 0 0 3px var(--brand-primary-bg);
}

.btn-primary {
  background-color: var(--brand-primary);
  color: white;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
  background-color: var(--brand-primary-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: var(--bg-surface);
  color: var(--text-main);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover {
  background-color: var(--bg-surface-active);
  border-color: var(--text-muted);
}

.btn-ghost {
  background-color: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover {
  background-color: var(--bg-surface-active);
  color: var(--text-main);
}

/* Cards & Surfaces */
.card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-fast), border-color var(--transition-fast);
}
.card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

/* Typography Helpers */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 24px;
}
.page-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}
.page-subtitle {
  font-size: 14px;
  color: var(--text-muted);
}

/* Data Tables */
.table-container {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}
.data-table th {
  background-color: var(--bg-surface-active);
  color: var(--text-muted);
  font-weight: 600;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}
.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
  vertical-align: middle;
}
.data-table tbody tr {
  transition: background-color var(--transition-fast);
}
.data-table tbody tr:hover {
  background-color: var(--bg-surface-hover);
}
.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* Badges / Status Chips */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.badge-status::before {
  content: '';
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.badge-status.success {
  background-color: var(--color-emerald-50);
  color: var(--color-emerald-600);
}
.badge-status.success::before { background-color: var(--color-emerald-500); }

.badge-status.warning {
  background-color: var(--color-amber-50);
  color: var(--color-amber-500);
}
.badge-status.warning::before { background-color: var(--color-amber-500); }

.badge-status.danger {
  background-color: var(--color-rose-50);
  color: var(--color-rose-500);
}
.badge-status.danger::before { background-color: var(--color-rose-500); }

.badge-status.info {
  background-color: var(--color-blue-50);
  color: var(--color-blue-600);
}
.badge-status.info::before { background-color: var(--color-blue-500); }

/* Dark mode adjustments for badges */
[data-theme="dark"] .badge-status.success { background-color: rgba(16, 185, 129, 0.15); color: #34d399; }
[data-theme="dark"] .badge-status.warning { background-color: rgba(245, 158, 11, 0.15); color: #fbbf24; }
[data-theme="dark"] .badge-status.danger { background-color: rgba(244, 63, 94, 0.15); color: #fb7185; }
[data-theme="dark"] .badge-status.info { background-color: rgba(59, 130, 246, 0.15); color: #60a5fa; }

/* Forms & Inputs */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.input-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}
.input-field {
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background-color: var(--bg-surface);
  color: var(--text-main);
  font-family: inherit;
  font-size: 14px;
  transition: all var(--transition-fast);
  outline: none;
}
.input-field:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--brand-primary-bg);
}

/* ==========================================================================
   Specific Layouts & Utilities
   ========================================================================== */

/* Login Shell Override */
.app-shell.login-mode .sidebar,
.app-shell.login-mode .topbar {
  display: none !important;
}
.app-shell.login-mode .main-content {
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-app);
}

/* Mobile Simulator Framework */
.mobile-simulator-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px 0;
  background: var(--bg-surface-active);
  border-radius: 16px;
  min-height: 700px;
  box-shadow: inset var(--shadow-md);
}
.mobile-device {
  width: 375px;
  height: 812px; /* iPhone X dimension ratio */
  background: var(--bg-app);
  border-radius: 40px;
  box-shadow: var(--shadow-float);
  border: 12px solid #000;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.mobile-device::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 150px;
  height: 25px;
  background: #000;
  border-radius: 0 0 15px 15px;
  z-index: 100;
}
[data-theme="dark"] .mobile-device {
  border-color: #111;
}

/* Utilities */
.w-100 { width: 100%; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.flex { display: flex; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
. m a t e r i a l - s y m b o l s - r o u n d e d   {   f o n t - v a r i a t i o n - s e t t i n g s :   ' F I L L '   0 ,   ' w g h t '   3 0 0 ,   ' G R A D '   0 ,   ' o p s z '   2 4 ;   f o n t - w e i g h t :   n o r m a l ;   }  
 