/* ==========================================================================
   BHARANI ARC — Professional Manufacturing ERP Stylesheet
   Theme: Strictly Modern LIGHT Theme
   Color Palette: Pure White, Slate Gray, Industrial Blue, Amber, Crimson
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* Brand Accents */
  --primary: #1e40af;        /* Deep Industrial Blue */
  --primary-light: #eff6ff;  /* Soft Blue Tint */
  --primary-hover: #1d4ed8;  /* Vibrant Blue Hover */
  --secondary: #0284c7;      /* Cyan/Sky Blue Accent */
  --copper: #c2410c;         /* Industrial Copper */

  /* Neutral Slate Palette (Light Theme) */
  --bg-page: #f8fafc;        /* Slate 50 Background */
  --surface-card: #ffffff;   /* Pure White */
  --surface-subtle: #f1f5f9; /* Slate 100 */
  --border-light: #e2e8f0;   /* Slate 200 */
  --border-focus: #93c5fd;   /* Blue 300 */
  
  --text-main: #0f172a;      /* Slate 900 */
  --text-muted: #64748b;     /* Slate 500 */
  --text-light: #94a3b8;     /* Slate 400 */

  /* Functional Status Colors */
  --success: #10b981;
  --success-bg: #ecfdf5;
  --success-border: #a7f3d0;

  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --warning-border: #fde68a;

  --danger: #ef4444;
  --danger-bg: #fff1f2;
  --danger-border: #fecdd3;

  --info: #3b82f6;
  --info-bg: #eff6ff;
  --info-border: #bfdbfe;

  /* Elevation & Geometry */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-pill: 9999px;

  --shadow-xs: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.06), 0 1px 2px -1px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.03);
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-page);
  color: var(--text-main);
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Typography */
h1, h2, h3, h4, h5 {
  color: var(--text-main);
  margin: 0 0 0.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

h1 { font-size: 1.65rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 0.75rem; color: var(--text-muted); }
a { color: var(--primary); text-decoration: none; transition: color 0.15s ease; }
a:hover { color: var(--primary-hover); }

/* Main Layout */
.erp-container {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* -------------------------------------------------------------
   LIGHT SIDEBAR (DIFFERENTIATED & EXECUTIVE LIGHT THEME)
   ------------------------------------------------------------- */
.erp-sidebar {
  width: 260px;
  flex-shrink: 0;
  background-color: #f1f5f9; /* Executive cool-slate canvas distinctly separates sidebar from white content */
  border-right: 1px solid #cbd5e1; /* Crisp Slate-300 structural divider */
  box-shadow: 3px 0 12px -2px rgba(15, 23, 42, 0.06), 1px 0 3px rgba(15, 23, 42, 0.03);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 30;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

/* Modern slim scrollbar */
.erp-sidebar::-webkit-scrollbar {
  width: 5px;
}
.erp-sidebar::-webkit-scrollbar-track {
  background: transparent;
}
.erp-sidebar::-webkit-scrollbar-thumb {
  background-color: #cbd5e1;
  border-radius: 9999px;
}
.erp-sidebar::-webkit-scrollbar-thumb:hover {
  background-color: #94a3b8;
}

.sidebar-brand {
  padding: 1.15rem 1.15rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid #cbd5e1;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.brand-badge {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  box-shadow: 0 4px 10px -2px rgba(37, 99, 235, 0.4);
  flex-shrink: 0;
}

.brand-details {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-size: 1.15rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.brand-tagline {
  font-size: 0.65rem;
  font-weight: 700;
  color: #1e40af;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 2px;
}

.sidebar-menu {
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.menu-section {
  font-size: 0.67rem;
  font-weight: 800;
  color: #475569;
  letter-spacing: 0.09em;
  padding: 0.65rem 0.5rem 0.3rem;
  text-transform: uppercase;
  margin-top: 0.85rem;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.menu-section:first-of-type {
  margin-top: 0;
  border-top: none;
  padding-top: 0.2rem;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.58rem 0.8rem;
  color: #334155;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid transparent;
  text-decoration: none;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.menu-item:hover:not(.active) {
  color: #1e40af;
  background-color: #ffffff;
  border-color: #cbd5e1;
  box-shadow: 0 2px 5px -1px rgba(15, 23, 42, 0.06);
  transform: translateX(3px);
}

.menu-item:hover:not(.active) .menu-icon {
  stroke: #1e40af;
  opacity: 1;
}

/* Premium High-Contrast Active State in Light Theme */
.menu-item.active {
  color: #ffffff !important;
  background: linear-gradient(135deg, #1e40af 0%, #2563eb 100%);
  font-weight: 700;
  border: 1px solid #1d4ed8;
  box-shadow: 0 4px 12px -2px rgba(37, 99, 235, 0.38), 0 2px 4px -1px rgba(37, 99, 235, 0.2);
}

.menu-item.active .menu-icon {
  stroke: #ffffff !important;
  opacity: 1;
}

.menu-icon {
  width: 18px;
  height: 18px;
  stroke: #64748b;
  stroke-width: 2.2;
  opacity: 0.9;
  flex-shrink: 0;
  transition: stroke 0.15s ease, opacity 0.15s ease;
}

.sidebar-footer {
  padding: 0.85rem 0.85rem;
  border-top: 1px solid #cbd5e1;
  background: #ffffff;
  box-shadow: 0 -2px 6px rgba(15, 23, 42, 0.03);
}

.user-profile-box {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.65rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.avatar-circle {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: linear-gradient(135deg, #1e40af 0%, #2563eb 100%);
  color: #ffffff;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  box-shadow: 0 2px 6px rgba(30, 64, 175, 0.25);
  flex-shrink: 0;
}

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

.profile-name {
  font-weight: 700;
  font-size: 0.85rem;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-role {
  font-size: 0.7rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar-logout-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: #fff1f2;
  color: #ef4444;
  border: 1px solid #fecdd3;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.sidebar-logout-btn:hover {
  background: #fee2e2;
  color: #dc2626;
  border-color: #fca5a5;
  transform: scale(1.05);
}

/* -------------------------------------------------------------
   MAIN CONTENT AREA & TOPBAR
   ------------------------------------------------------------- */
.erp-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.erp-topbar {
  height: 64px;
  background: #ffffff;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: var(--shadow-xs);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.page-breadcrumb {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
}
.page-breadcrumb span {
  color: var(--text-main);
  font-weight: 700;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.erp-content {
  padding: 1.75rem 2rem 3rem;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}

/* -------------------------------------------------------------
   BUTTONS & ACTIONS
   ------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  text-decoration: none;
  line-height: 1.25;
}

.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(30, 64, 175, 0.2);
}
.btn-primary:hover {
  background-color: var(--primary-hover);
  color: #ffffff;
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: #ffffff;
  color: var(--text-main);
  border-color: var(--border-light);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover {
  background-color: var(--surface-subtle);
  border-color: var(--border-focus);
}

.btn-success {
  background-color: var(--success);
  color: #ffffff;
}
.btn-success:hover { background-color: #059669; }

.btn-danger {
  background-color: var(--danger);
  color: #ffffff;
}
.btn-danger:hover { background-color: #dc2626; }

.btn-warning {
  background-color: var(--warning);
  color: #ffffff;
}
.btn-warning:hover { background-color: #d97706; }

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

/* -------------------------------------------------------------
   CARDS & PANELS
   ------------------------------------------------------------- */
.card {
  background-color: var(--surface-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--surface-subtle);
}

.card-header h2 {
  margin: 0;
  font-size: 1.15rem;
  color: var(--text-main);
}

/* -------------------------------------------------------------
   13 DASHBOARD KPI METRIC CARDS (Section 1)
   ------------------------------------------------------------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.1rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .kpi-grid { grid-template-columns: 1fr; }
}

.kpi-card {
  background: var(--surface-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.kpi-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background-color: var(--primary);
}

.kpi-card.kpi-success::before { background-color: var(--success); }
.kpi-card.kpi-warning::before { background-color: var(--warning); }
.kpi-card.kpi-danger::before { background-color: var(--danger); }
.kpi-card.kpi-info::before { background-color: var(--secondary); }

.kpi-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.4rem;
  display: flex;
  justify-content: space-between;
}

.kpi-value {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
  font-feature-settings: "tnum";
}

.kpi-sub {
  font-size: 0.78rem;
  color: var(--text-light);
  margin-top: 0.35rem;
}

/* -------------------------------------------------------------
   CHARTS GRID (7 Charts - Section 1)
   ------------------------------------------------------------- */
.chart-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.chart-grid-even {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 1024px) {
  .chart-grid, .chart-grid-even { grid-template-columns: 1fr; }
}

.chart-card {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-sm);
}

.chart-card h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chart-container {
  position: relative;
  width: 100%;
  height: 280px;
}

/* -------------------------------------------------------------
   TABLES
   ------------------------------------------------------------- */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: #ffffff;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

table.data-table th, 
table.data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--surface-subtle);
  font-size: 0.88rem;
}

table.data-table th {
  background-color: var(--surface-subtle);
  font-weight: 700;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border-light);
  white-space: nowrap;
}

table.data-table tr:hover td {
  background-color: #fafbfc;
}

table.data-table td.num,
table.data-table th.num {
  text-align: right;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}

/* -------------------------------------------------------------
   STATUS BADGES
   ------------------------------------------------------------- */
.status-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  line-height: 1.2;
}

.badge-success {
  background-color: var(--success-bg);
  color: var(--success);
  border-color: var(--success-border);
}

.badge-warning {
  background-color: var(--warning-bg);
  color: #b45309;
  border-color: var(--warning-border);
}

.badge-danger {
  background-color: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger-border);
}

.badge-info {
  background-color: var(--info-bg);
  color: var(--primary);
  border-color: var(--info-border);
}

.badge-neutral {
  background-color: var(--surface-subtle);
  color: var(--text-muted);
  border-color: var(--border-light);
}

/* -------------------------------------------------------------
   FORMS & CONTROLS
   ------------------------------------------------------------- */
.form-group {
  margin-bottom: 1.1rem;
}

label.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

input.form-control,
select.form-control,
textarea.form-control {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--text-main);
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input.form-control:focus,
select.form-control:focus,
textarea.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.15);
}

.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.form-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }

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

/* -------------------------------------------------------------
   DATE FILTERS TOOLBAR
   ------------------------------------------------------------- */
.filter-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-xs);
}

.filter-pills {
  display: inline-flex;
  background: var(--surface-subtle);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}

.filter-pill {
  padding: 0.4rem 0.9rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: calc(var(--radius-sm) - 2px);
  text-decoration: none;
  transition: all 0.15s ease;
}

.filter-pill.active {
  background: #ffffff;
  color: var(--primary);
  box-shadow: var(--shadow-xs);
}

/* -------------------------------------------------------------
   ALERT BANNERS
   ------------------------------------------------------------- */
.alert-banner {
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.alert-danger {
  background-color: var(--danger-bg);
  color: #991b1b;
  border-color: var(--danger-border);
}

.alert-warning {
  background-color: var(--warning-bg);
  color: #92400e;
  border-color: var(--warning-border);
}

.alert-success {
  background-color: var(--success-bg);
  color: #065f46;
  border-color: var(--success-border);
}

/* -------------------------------------------------------------
   MODALS
   ------------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}

.modal-backdrop.show {
  display: flex;
}

.modal-dialog {
  background: #ffffff;
  border-radius: var(--radius-lg);
  max-width: 550px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-light);
  overflow: hidden;
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-body {
  padding: 1.5rem;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-light);
  background-color: var(--surface-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* -------------------------------------------------------------
   PRINT STYLING (Section 12, 14, 21)
   ------------------------------------------------------------- */
@media print {
  .erp-sidebar, .erp-topbar, .filter-toolbar, .btn, .no-print {
    display: none !important;
  }
  .erp-main, .erp-content {
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
  }
  .card, .table-responsive {
    border: 1px solid #000 !important;
    box-shadow: none !important;
  }
}
