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

:root {
  /* Brand & Theme Colors */
  --bg-app: #0f131d;
  --bg-sidebar: #171d2b;
  --bg-sidebar-hover: rgba(255, 255, 255, 0.05);
  --bg-sidebar-active: #2563eb;
  --bg-card: #1c2436;
  --bg-card-header: #212b40;
  --bg-input: #151b29;
  --bg-modal: #182030;
  
  --border-color: rgba(255, 255, 255, 0.08);
  --border-color-strong: rgba(255, 255, 255, 0.15);
  
  --text-main: #f1f5f9;
  --text-muted: #8a99b5;
  --text-dim: #5c6b8a;
  --text-sidebar-category: #718096;
  
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: rgba(37, 99, 235, 0.15);
  
  --success: #10b981;
  --success-light: rgba(16, 185, 129, 0.15);
  --warning: #f59e0b;
  --warning-light: rgba(245, 158, 11, 0.15);
  --danger: #ef4444;
  --danger-light: rgba(239, 68, 68, 0.15);
  --info: #3b82f6;
  --info-light: rgba(59, 130, 246, 0.15);
  --purple: #8b5cf6;
  --purple-light: rgba(139, 92, 246, 0.15);

  --sidebar-width: 250px;
  --header-height: 70px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-main: 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-active: 0 4px 14px rgba(37, 99, 235, 0.4);
}

/* Light Theme Variables */
[data-theme="light"] {
  --bg-app: #f4f6fa;
  --bg-sidebar: #171d2b; /* Keep sidebar dark navy like original enterprise UI */
  --bg-card: #ffffff;
  --bg-card-header: #f8fafc;
  --bg-input: #ffffff;
  --bg-modal: #ffffff;
  --border-color: #e2e8f0;
  --border-color-strong: #cbd5e1;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-dim: #94a3b8;
}

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

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

/* Layout */
#app-root {
  display: flex;
  min-height: 100vh;
  width: 100vw;
}

/* Sidebar Styles - Matching Exact Reference Screenshot */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 100;
  user-select: none;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.sidebar-header {
  padding: 22px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-color);
}

.brand-logo {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  font-size: 20px;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.brand-text {
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.5px;
}
.brand-subtext {
  font-size: 11px;
  color: var(--primary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sidebar-menu {
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.menu-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.menu-category-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-sidebar-category);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  padding: 6px 12px;
  margin-top: 4px;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 16px;
  border-radius: 8px;
  color: #cbd5e1;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.menu-item:hover {
  background-color: var(--bg-sidebar-hover);
  color: #ffffff;
  transform: translateX(2px);
}

.menu-item.active {
  background-color: var(--bg-sidebar-active);
  color: #ffffff;
  font-weight: 600;
  box-shadow: var(--shadow-active);
}

.menu-item.danger-item {
  color: var(--danger);
}
.menu-item.danger-item:hover {
  background-color: var(--danger-light);
  color: #f87171;
}

.menu-item svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.2px;
  flex-shrink: 0;
}

/* Badge counts on sidebar */
.menu-badge {
  margin-left: auto;
  background-color: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 12px;
}
.menu-item.active .menu-badge {
  background-color: rgba(255, 255, 255, 0.25);
}

/* Main Content Wrapper */
.main-wrapper {
  margin-left: var(--sidebar-width);
  width: calc(100vw - var(--sidebar-width));
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.top-header {
  height: var(--header-height);
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
}

.header-title-group h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main);
}
.header-title-group p {
  font-size: 12px;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.search-box {
  position: relative;
  width: 280px;
}
.search-box input {
  width: 100%;
  padding: 8px 14px 8px 38px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s ease;
}
.search-box input:focus {
  border-color: var(--primary);
}
.search-box svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 16px;
  height: 16px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
}
.icon-btn:hover {
  background-color: var(--border-color);
  color: var(--text-main);
}
.icon-btn .dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  background-color: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--bg-card);
}

.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 12px 5px 6px;
  border-radius: 30px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  cursor: pointer;
}
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 13px;
}
.user-info {
  display: flex;
  flex-direction: column;
}
.user-name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
}
.user-role {
  font-size: 10px;
  color: var(--text-muted);
}

/* Main Container Area */
.content-container {
  padding: 28px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Stat Cards Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}

.stat-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-main);
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.stat-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-color-strong);
}

.stat-info p {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}
.stat-info h2 {
  font-size: 24px;
  font-weight: 700;
  margin: 4px 0;
  color: var(--text-main);
}
.stat-trend {
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.stat-trend.up { color: var(--success); }
.stat-trend.down { color: var(--danger); }

.stat-icon-wrapper {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}
.stat-icon-wrapper.blue { background-color: var(--primary-light); color: var(--primary); }
.stat-icon-wrapper.emerald { background-color: var(--success-light); color: var(--success); }
.stat-icon-wrapper.amber { background-color: var(--warning-light); color: var(--warning); }
.stat-icon-wrapper.purple { background-color: var(--purple-light); color: var(--purple); }

/* Card Section Box */
.card-box {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-main);
}

.card-header {
  padding: 18px 24px;
  background-color: var(--bg-card-header);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-header h3 {
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-body {
  padding: 24px;
}

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}
.custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13.5px;
}
.custom-table th {
  background-color: var(--bg-card-header);
  padding: 12px 18px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.8px;
}
.custom-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  vertical-align: middle;
}
.custom-table tbody tr {
  transition: background-color 0.15s ease;
}
.custom-table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

/* Status Badges */
.status-pill {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-transform: capitalize;
}
.status-pill::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.status-pill.pending { background: var(--warning-light); color: var(--warning); }
.status-pill.pending::before { background: var(--warning); }
.status-pill.processing { background: var(--info-light); color: var(--info); }
.status-pill.processing::before { background: var(--info); }
.status-pill.packed { background: var(--purple-light); color: var(--purple); }
.status-pill.packed::before { background: var(--purple); }
.status-pill.dispatched { background: var(--primary-light); color: var(--primary); }
.status-pill.dispatched::before { background: var(--primary); }
.status-pill.delivered { background: var(--success-light); color: var(--success); }
.status-pill.delivered::before { background: var(--success); }
.status-pill.cancelled { background: var(--danger-light); color: var(--danger); }
.status-pill.cancelled::before { background: var(--danger); }
.status-pill.instock { background: var(--success-light); color: var(--success); }
.status-pill.instock::before { background: var(--success); }
.status-pill.lowstock { background: var(--warning-light); color: var(--warning); }
.status-pill.lowstock::before { background: var(--warning); }

/* Buttons */
.btn {
  padding: 9px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  transition: all 0.2s ease;
  outline: none;
}
.btn-primary {
  background-color: var(--primary);
  color: white;
}
.btn-primary:hover {
  background-color: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}
.btn-secondary {
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
}
.btn-secondary:hover {
  background-color: var(--border-color);
}
.btn-success {
  background-color: var(--success);
  color: white;
}
.btn-success:hover {
  background-color: #059669;
}
.btn-danger {
  background-color: var(--danger);
  color: white;
}
.btn-danger:hover {
  background-color: #dc2626;
}
.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

/* Modals & Overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(5px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.modal-content {
  background-color: var(--bg-modal);
  border: 1px solid var(--border-color-strong);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 650px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
}
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 {
  font-size: 18px;
  font-weight: 700;
}
.modal-body {
  padding: 24px;
}
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  background-color: var(--bg-card-header);
}

.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.form-control {
  width: 100%;
  padding: 10px 14px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 13.5px;
  outline: none;
}
.form-control:focus {
  border-color: var(--primary);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  background-color: var(--bg-card);
  border-left: 4px solid var(--primary);
  border-right: 1px solid var(--border-color);
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  padding: 14px 18px;
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideInRight 0.3s ease;
}
.toast.success { border-left-color: var(--success); }
.toast.danger { border-left-color: var(--danger); }

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Print Invoice Styling */
@media print {
  .sidebar, .top-header, .btn, .modal-footer, .toast-container { display: none !important; }
  .main-wrapper { margin-left: 0 !important; width: 100% !important; }
  .modal-overlay { position: static !important; background: transparent !important; backdrop-filter: none !important; }
  .modal-content { max-width: 100% !important; border: none !important; box-shadow: none !important; color: #000 !important; }
  body { background: #fff !important; color: #000 !important; }
}
