/**
 * Samarth Industries ERP - Design System & Custom Stylesheet
 * Brand Palette extracted from official logo:
 * Primary: #2F2562 (Royal Navy / Indigo)
 * Accent:  #E37D18 (Warm Amber / Saffron)
 * Neutral: #F5F7FB (Background), #1A1633 (Sidebar)
 */

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

:root {
  /* Brand Colors */
  --samarth-primary: #2F2562;
  --samarth-primary-dark: #1F1843;
  --samarth-primary-light: #44378A;
  --samarth-primary-subtle: #ECEAF5;

  --samarth-accent: #E37D18;
  --samarth-accent-dark: #C6680D;
  --samarth-accent-light: #FCEBD9;
  --samarth-accent-subtle: #FFF6EC;

  /* Neutrals & Surfaces */
  --samarth-bg: #F5F7FB;
  --samarth-surface: #FFFFFF;
  --samarth-border: #E2E8F0;
  --samarth-border-subtle: #EDF2F7;
  --samarth-text-main: #1E293B;
  --samarth-text-muted: #64748B;
  --samarth-text-light: #94A3B8;

  /* Sidebar */
  --samarth-sidebar-bg: #1A1633;
  --samarth-sidebar-active: #2F2562;
  --samarth-sidebar-hover: #262046;
  --samarth-sidebar-text: #CBD5E1;
  --samarth-sidebar-text-active: #FFFFFF;

  /* Functional Status Colors */
  --samarth-success: #10B981;
  --samarth-warning: #F59E0B;
  --samarth-danger: #EF4444;
  --samarth-info: #3B82F6;
  --samarth-purple: #8B5CF6;

  /* Typographic Scale Tokens */
  --font-title: 26px;
  --font-section: 20px;
  --font-card: 16px;
  --font-body: 14px;
  --font-label: 13px;
  --font-sm: 12px;
  --font-xs: 11px;
}

/* Global Reset & Base */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: var(--font-body);
  color: var(--samarth-text-main);
  background-color: var(--samarth-bg);
  line-height: 1.5;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

/* Typographic Scale */
h1, .h1 { font-size: var(--font-title); font-weight: 700; color: var(--samarth-primary); letter-spacing: -0.02em; }
h2, .h2 { font-size: var(--font-section); font-weight: 600; color: var(--samarth-text-main); }
h3, .h3 { font-size: var(--font-card); font-weight: 600; color: var(--samarth-text-main); }
h4, .h4 { font-size: 15px; font-weight: 600; }
h5, .h5 { font-size: 14px; font-weight: 600; }
.form-label { font-size: var(--font-label); font-weight: 500; color: var(--samarth-text-main); margin-bottom: 4px; }
.text-xs { font-size: var(--font-xs) !important; }
.text-sm { font-size: var(--font-sm) !important; }
.fs-xs { font-size: var(--font-xs) !important; }

/* Buttons & Controls */
.btn {
  font-size: var(--font-body);
  font-weight: 500;
  border-radius: 6px;
  padding: 0.45rem 0.9rem;
  transition: all 0.15s ease-in-out;
}
.btn-sm {
  font-size: var(--font-sm);
  padding: 0.25rem 0.55rem;
}
.btn-primary {
  background-color: var(--samarth-primary);
  border-color: var(--samarth-primary);
  color: #FFFFFF;
}
.btn-primary:hover, .btn-primary:focus {
  background-color: var(--samarth-primary-dark);
  border-color: var(--samarth-primary-dark);
}
.btn-accent {
  background-color: var(--samarth-accent);
  border-color: var(--samarth-accent);
  color: #FFFFFF;
}
.btn-accent:hover, .btn-accent:focus {
  background-color: var(--samarth-accent-dark);
  border-color: var(--samarth-accent-dark);
  color: #FFFFFF;
}
.btn-outline-primary {
  color: var(--samarth-primary);
  border-color: var(--samarth-primary);
}
.btn-outline-primary:hover {
  background-color: var(--samarth-primary);
  color: #FFFFFF;
}

/* Background utilities */
.bg-samarth-primary { background-color: var(--samarth-primary) !important; color: #FFFFFF; }
.bg-samarth-accent { background-color: var(--samarth-accent) !important; color: #FFFFFF; }
.bg-purple { background-color: var(--samarth-purple) !important; }
.text-samarth-primary { color: var(--samarth-primary) !important; }
.text-samarth-accent { color: var(--samarth-accent) !important; }

/* ERP App Layout */
.erp-wrapper {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* Sidebar */
.erp-sidebar {
  width: 260px;
  min-width: 260px;
  background-color: var(--samarth-sidebar-bg);
  color: var(--samarth-sidebar-text);
  display: flex;
  flex-direction: column;
  transition: all 0.25s ease-in-out;
  z-index: 1000;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.05);
}

.erp-sidebar .brand-header {
  padding: 1.2rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 12px;
  background-color: #141128;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.erp-sidebar .brand-logo-img {
  max-height: 40px;
  border-radius: 4px;
  background: #FFF;
  padding: 2px;
}
.erp-sidebar .brand-title {
  font-size: 15px;
  font-weight: 700;
  color: #FFFFFF;
  line-height: 1.2;
}
.erp-sidebar .brand-subtitle {
  font-size: 11px;
  color: var(--samarth-accent);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.sidebar-nav-container {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0;
}

.nav-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748B;
  font-weight: 700;
  padding: 0.75rem 1.25rem 0.25rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0.55rem 1.25rem;
  color: var(--samarth-sidebar-text);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.15s ease-in-out;
  border-left: 3px solid transparent;
}
.sidebar-link i {
  font-size: 16px;
  width: 20px;
  text-align: center;
  color: #94A3B8;
  transition: color 0.15s ease-in-out;
}
.sidebar-link:hover {
  background-color: var(--samarth-sidebar-hover);
  color: #FFFFFF;
}
.sidebar-link:hover i {
  color: var(--samarth-accent);
}
.sidebar-link.active {
  background-color: var(--samarth-sidebar-active);
  color: #FFFFFF;
  border-left-color: var(--samarth-accent);
  font-weight: 600;
}
.sidebar-link.active i {
  color: var(--samarth-accent);
}

/* Main Content Area */
.erp-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-x: hidden;
}

/* Top Navbar */
.erp-topbar {
  background-color: var(--samarth-surface);
  border-bottom: 1px solid var(--samarth-border);
  padding: 0.65rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 999;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 15px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 15px;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px;
  border-radius: 6px;
  text-decoration: none;
  color: var(--samarth-text-main);
}
.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--samarth-primary-subtle);
  color: var(--samarth-primary);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

/* Content Area */
.erp-content {
  flex: 1;
  padding: 1.5rem;
}

/* Page Header & Breadcrumb */
.page-header {
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 15px;
}
.breadcrumb {
  margin-bottom: 0.25rem;
  font-size: var(--font-xs);
}
.breadcrumb-item a {
  color: var(--samarth-text-muted);
  text-decoration: none;
}
.breadcrumb-item.active {
  color: var(--samarth-primary);
  font-weight: 600;
}

/* Cards & Surfaces */
.card {
  background-color: var(--samarth-surface);
  border: 1px solid var(--samarth-border);
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  margin-bottom: 1.5rem;
}
.card-header {
  background-color: transparent;
  border-bottom: 1px solid var(--samarth-border);
  padding: 0.85rem 1.25rem;
  font-weight: 600;
  font-size: var(--font-card);
  color: var(--samarth-text-main);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-body {
  padding: 1.25rem;
}

/* KPI Card */
.kpi-card {
  border-left: 4px solid var(--samarth-primary);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.06);
}
.kpi-card.accent-card { border-left-color: var(--samarth-accent); }
.kpi-card.success-card { border-left-color: var(--samarth-success); }
.kpi-card.warning-card { border-left-color: var(--samarth-warning); }
.kpi-card.danger-card { border-left-color: var(--samarth-danger); }
.kpi-card.info-card { border-left-color: var(--samarth-info); }
.kpi-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--samarth-text-main);
  line-height: 1.1;
  margin-top: 4px;
}
.kpi-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--samarth-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Data Tables */
.table {
  font-size: var(--font-body);
  margin-bottom: 0;
  vertical-align: middle;
}
.table thead th {
  background-color: #F8FAFC;
  color: #475569;
  font-size: 12.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 2px solid var(--samarth-border);
  padding: 0.7rem 0.85rem;
  white-space: nowrap;
}
.table tbody td {
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid var(--samarth-border-subtle);
}
.table-hover tbody tr:hover {
  background-color: #F8FAFC;
}

/* Filter Card */
.filter-bar {
  background-color: #FFFFFF;
  border: 1px solid var(--samarth-border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}

/* Timeline & Stepper */
.workflow-stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  margin: 1.5rem 0;
}
.stepper-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 2;
  text-align: center;
  flex: 1;
}
.step-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: #E2E8F0;
  color: #64748B;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 6px;
  transition: all 0.2s ease;
}
.stepper-step.completed .step-circle {
  background-color: var(--samarth-success);
  color: #FFFFFF;
}
.stepper-step.active .step-circle {
  background-color: var(--samarth-primary);
  color: #FFFFFF;
  box-shadow: 0 0 0 4px var(--samarth-primary-subtle);
}
.step-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--samarth-text-muted);
}
.stepper-step.active .step-label {
  color: var(--samarth-primary);
  font-weight: 600;
}

/* Print Specific */
@media print {
  .erp-sidebar, .erp-topbar, .btn, .filter-bar, .breadcrumb, .no-print {
    display: none !important;
  }
  .erp-main, .erp-content, body {
    margin: 0 !important;
    padding: 0 !important;
    background: #FFF !important;
  }
  .card {
    border: none !important;
    box-shadow: none !important;
  }
}

/* Responsive adjustments */
@media (max-width: 991.98px) {
  .erp-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: -260px;
  }
  .erp-sidebar.show {
    left: 0;
  }
  .sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 998;
  }
}
