/* ============================================
   NFR - Northeast Frontier Railway Theme
   Government of India | Ministry of Railways
   ============================================ */

:root {
  --nfr-navy:     #0d2137;
  --nfr-blue:     #1a3d6e;
  --nfr-red:      #9e1b1b;
  --nfr-gold:     #c9870c;
  --nfr-light:    #f0f4f8;
  --nfr-white:    #ffffff;
  --nfr-text:     #1a2535;
  --nfr-muted:    #6b7a8d;
  --nfr-border:   #d0dbe8;
  --nfr-success:  #1a6e3f;
  --nfr-warning:  #b06000;
  --nfr-danger:   #9e1b1b;
  --nfr-info:     #1a5a8a;
  --sidebar-w:    260px;
  --header-h:     64px;
  --radius:       8px;
  --shadow-sm:    0 1px 3px rgba(0,0,0,.10);
  --shadow-md:    0 4px 12px rgba(0,0,0,.12);
  --shadow-lg:    0 8px 24px rgba(0,0,0,.15);
  --transition:   0.2s ease;
}

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

/* ---- Reset / Base ---- */
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--nfr-light);
  color: var(--nfr-text);
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
}
a { color: var(--nfr-blue); text-decoration: none; }
a:hover { color: var(--nfr-gold); }
img { max-width: 100%; }
h1,h2,h3,h4,h5,h6 { font-weight: 700; color: var(--nfr-navy); margin-top: 0; }
ul { list-style: none; padding: 0; margin: 0; }

/* ---- Layout Shell ---- */
#nfr-wrapper { display: flex; min-height: 100vh; }

/* ---- Sidebar ---- */
#nfr-sidebar {
  width: var(--sidebar-w);
  background: var(--nfr-navy);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 1000;
  transition: transform var(--transition);
  overflow-y: auto;
}
#nfr-sidebar::-webkit-scrollbar { width: 4px; }
#nfr-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 4px; }

.sidebar-brand {
  padding: 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--nfr-blue);
}
.sidebar-brand img { width: 44px; height: 44px; object-fit: contain; }
.sidebar-brand-text { line-height: 1.3; }
.sidebar-brand-text .org { font-size: 11px; color: rgba(255,255,255,.55); text-transform: uppercase; letter-spacing: .5px; }
.sidebar-brand-text .name { font-size: 13px; font-weight: 700; color: #fff; }

/* Sidebar Nav */
.sidebar-nav { padding: 12px 0; flex: 1; }
.sidebar-section-label {
  padding: 14px 20px 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  color: rgba(255,255,255,.35);
  text-transform: uppercase;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: rgba(255,255,255,.72);
  font-size: 13.5px;
  transition: background var(--transition), color var(--transition);
  border-left: 3px solid transparent;
}
.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: rgba(255,255,255,.08);
  color: #fff;
  border-left-color: var(--nfr-gold);
}
.sidebar-nav a .nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: .75;
}
.sidebar-nav a:hover .nav-icon,
.sidebar-nav a.active .nav-icon { opacity: 1; }

/* Submenu */
.sidebar-submenu { display: none; background: rgba(0,0,0,.18); }
.sidebar-submenu.open { display: block; }
.sidebar-submenu a {
  padding-left: 52px;
  font-size: 13px;
  border-left: none;
}
.has-submenu > a .arrow {
  margin-left: auto;
  font-size: 10px;
  transition: transform var(--transition);
}
.has-submenu.open > a .arrow { transform: rotate(90deg); }

/* Sidebar Footer */
.sidebar-footer {
  padding: 14px 20px;
  border-top: 1px solid rgba(255,255,255,.08);
  font-size: 12px;
  color: rgba(255,255,255,.4);
  text-align: center;
}

/* ---- Top Header ---- */
#nfr-header {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  height: var(--header-h);
  background: var(--nfr-white);
  border-bottom: 1px solid var(--nfr-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 900;
  box-shadow: var(--shadow-sm);
}
.header-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--nfr-navy);
}
.header-right { display: flex; align-items: center; gap: 16px; }
.header-user {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  position: relative;
}
.header-user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--nfr-blue);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 14px;
}
.header-user-info { line-height: 1.3; }
.header-user-info .uname { font-size: 13px; font-weight: 600; color: var(--nfr-navy); }
.header-user-info .urole { font-size: 11px; color: var(--nfr-muted); }

/* Dropdown */
.header-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: #fff;
  border: 1px solid var(--nfr-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  min-width: 180px;
  display: none;
  z-index: 1100;
}
.header-dropdown.open { display: block; }
.header-dropdown a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  color: var(--nfr-text);
  font-size: 13px;
  transition: background var(--transition);
}
.header-dropdown a:hover { background: var(--nfr-light); }
.header-dropdown a.danger { color: var(--nfr-danger); }
.header-dropdown hr { border: none; border-top: 1px solid var(--nfr-border); margin: 4px 0; }

/* ---- Main Content ---- */
#nfr-main {
  margin-left: var(--sidebar-w);
  margin-top: var(--header-h);
  padding: 28px;
  min-height: calc(100vh - var(--header-h));
  width: calc(100% - var(--sidebar-w));
}

/* ---- Page Header ---- */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-header-left h1 {
  font-size: 22px;
  margin-bottom: 4px;
  color: var(--nfr-navy);
}
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--nfr-muted);
}
.breadcrumb a { color: var(--nfr-muted); }
.breadcrumb a:hover { color: var(--nfr-blue); }
.breadcrumb .sep { color: var(--nfr-border); }

/* ---- Cards ---- */
.nfr-card {
  background: var(--nfr-white);
  border: 1px solid var(--nfr-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.nfr-card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--nfr-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fafbfc;
}
.nfr-card-header h4 {
  font-size: 15px;
  margin: 0;
  color: var(--nfr-navy);
  display: flex;
  align-items: center;
  gap: 8px;
}
.nfr-card-header h4 .icon {
  width: 18px; height: 18px;
  color: var(--nfr-blue);
}
.nfr-card-body { padding: 20px; }

/* Stat Cards */
.stat-card {
  background: var(--nfr-white);
  border: 1px solid var(--nfr-border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 16px;
}
.stat-card-icon {
  width: 52px; height: 52px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 22px;
}
.stat-card-icon.blue  { background: #e8f0fb; color: var(--nfr-blue); }
.stat-card-icon.red   { background: #fbe8e8; color: var(--nfr-red); }
.stat-card-icon.gold  { background: #fbf3e8; color: var(--nfr-gold); }
.stat-card-icon.green { background: #e8fbef; color: var(--nfr-success); }
.stat-card-label { font-size: 12px; color: var(--nfr-muted); margin-bottom: 4px; }
.stat-card-value { font-size: 22px; font-weight: 800; color: var(--nfr-navy); line-height: 1; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), box-shadow var(--transition), transform var(--transition);
  text-decoration: none;
  line-height: 1.4;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(0); }
.btn-primary   { background: var(--nfr-blue);    color: #fff; }
.btn-primary:hover { background: #154f8f; color: #fff; }
.btn-danger    { background: var(--nfr-danger);  color: #fff; }
.btn-danger:hover { background: #7d1515; color: #fff; }
.btn-success   { background: var(--nfr-success); color: #fff; }
.btn-success:hover { background: #145531; color: #fff; }
.btn-warning   { background: var(--nfr-warning); color: #fff; }
.btn-warning:hover { background: #8a4c00; color: #fff; }
.btn-info      { background: var(--nfr-info);    color: #fff; }
.btn-info:hover { background: #144870; color: #fff; }
.btn-outline   { background: transparent; border: 1.5px solid var(--nfr-border); color: var(--nfr-text); }
.btn-outline:hover { border-color: var(--nfr-blue); color: var(--nfr-blue); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 11px 24px; font-size: 15px; }
.btn-block { width: 100%; justify-content: center; }

/* ---- Forms ---- */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--nfr-text); margin-bottom: 6px; }
.form-label .req { color: var(--nfr-red); margin-left: 2px; }
.form-control {
  display: block;
  width: 100%;
  padding: 9px 12px;
  font-size: 13.5px;
  color: var(--nfr-text);
  background: #fff;
  border: 1.5px solid var(--nfr-border);
  border-radius: var(--radius);
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none;
}
.form-control:focus {
  outline: none;
  border-color: var(--nfr-blue);
  box-shadow: 0 0 0 3px rgba(26,61,110,.12);
}
.form-control::placeholder { color: #aab2be; }
.form-hint { font-size: 11.5px; color: var(--nfr-muted); margin-top: 4px; }

/* Form sections */
.form-section { margin-bottom: 28px; }
.form-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--nfr-blue);
  padding-bottom: 8px;
  border-bottom: 2px solid var(--nfr-border);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.form-section-title::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 16px;
  background: var(--nfr-gold);
  border-radius: 2px;
}

/* ---- Tables ---- */
.nfr-table-wrap { overflow-x: auto; }
.nfr-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.nfr-table thead tr {
  background: var(--nfr-navy);
  color: #fff;
}
.nfr-table thead th {
  padding: 11px 14px;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .4px;
  white-space: nowrap;
  border: none;
}
.nfr-table tbody tr {
  border-bottom: 1px solid #edf0f5;
  transition: background var(--transition);
}
.nfr-table tbody tr:last-child { border-bottom: none; }
.nfr-table tbody tr:hover { background: #f4f7fc; }
.nfr-table td { padding: 12px 14px; vertical-align: top; color: var(--nfr-text); }
.nfr-table td .info-label { font-size: 11px; color: var(--nfr-muted); font-weight: 600; }
.nfr-table td .info-value { font-size: 13px; color: var(--nfr-text); }

/* ---- Badges / Status ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-pending  { background: #fff3e0; color: #b06000; }
.badge-review   { background: #e3f2fd; color: #1565c0; }
.badge-approved { background: #e8f5e9; color: #1a6e3f; }
.badge-printed  { background: #f3e5f5; color: #6a1b9a; }
.badge-dispatched { background: #e0f7fa; color: #00695c; }
.badge-declined { background: #fce4e4; color: #9e1b1b; }

/* ---- Progress Tracker ---- */
.progress-tracker {
  display: flex;
  align-items: center;
  gap: 0;
  margin: 20px 0;
  overflow-x: auto;
  padding-bottom: 8px;
}
.progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-width: 100px;
  position: relative;
}
.progress-step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 18px;
  left: 50%;
  right: -50%;
  height: 3px;
  background: var(--nfr-border);
  z-index: 0;
}
.progress-step.done:not(:last-child)::after { background: var(--nfr-success); }
.progress-step.active:not(:last-child)::after { background: var(--nfr-border); }
.step-circle {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 3px solid var(--nfr-border);
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--nfr-muted);
  z-index: 1;
  position: relative;
}
.progress-step.done .step-circle  { background: var(--nfr-success); border-color: var(--nfr-success); color: #fff; }
.progress-step.active .step-circle { background: var(--nfr-blue);    border-color: var(--nfr-blue);    color: #fff; }
.step-label { font-size: 11px; color: var(--nfr-muted); margin-top: 6px; text-align: center; }
.progress-step.active .step-label { color: var(--nfr-blue); font-weight: 600; }
.progress-step.done  .step-label  { color: var(--nfr-success); }

/* ---- Alerts ---- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 18px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13.5px;
  border-left: 4px solid;
}
.alert-success { background: #e8f5e9; border-color: var(--nfr-success); color: #1a4e2a; }
.alert-danger  { background: #fce4e4; border-color: var(--nfr-danger);  color: #6b1212; }
.alert-warning { background: #fff3e0; border-color: var(--nfr-gold);   color: #7a4500; }
.alert-info    { background: #e3f2fd; border-color: var(--nfr-info);   color: #0d3a63; }

/* ---- Modal ---- */
.nfr-modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 2000;
  align-items: center;
  justify-content: center;
}
.nfr-modal-overlay.open { display: flex; }
.nfr-modal {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn .2s ease;
}
@keyframes modalIn {
  from { transform: scale(.95); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}
.nfr-modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--nfr-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nfr-modal-header h5 { margin: 0; font-size: 15px; color: var(--nfr-navy); }
.nfr-modal-close {
  background: none; border: none; cursor: pointer;
  font-size: 18px; color: var(--nfr-muted); padding: 0; line-height: 1;
}
.nfr-modal-body  { padding: 20px; }
.nfr-modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--nfr-border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ---- Grid Utilities ---- */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .grid-2,.grid-3,.grid-4 { grid-template-columns: 1fr; }
  #nfr-sidebar { transform: translateX(-100%); }
  #nfr-sidebar.open { transform: translateX(0); }
  #nfr-main { margin-left: 0; width: 100%; padding: 16px; }
  #nfr-header { left: 0; }
  .page-header { flex-direction: column; }
}

/* ---- Row/Col Bootstrap-compat shims ---- */
.row { display: flex; flex-wrap: wrap; margin: 0 -10px; }
.row > [class*="col-"] { padding: 0 10px; }
.col-md-4 { width: 33.333%; }
.col-md-6 { width: 50%; }
.col-md-12 { width: 100%; }
@media (max-width: 768px) {
  .col-md-4,.col-md-6,.col-md-12 { width: 100%; }
}

/* ---- Utility Classes ---- */
.mt-0{margin-top:0}.mt-1{margin-top:6px}.mt-2{margin-top:12px}.mt-3{margin-top:18px}.mt-4{margin-top:24px}
.mb-0{margin-bottom:0}.mb-1{margin-bottom:6px}.mb-2{margin-bottom:12px}.mb-3{margin-bottom:18px}.mb-4{margin-bottom:24px}
.pt-0{padding-top:0}.pt-1{padding-top:6px}.pt-2{padding-top:12px}.pt-3{padding-top:18px}
.pb-0{padding-bottom:0}.pb-1{padding-bottom:6px}.pb-2{padding-bottom:12px}.pb-3{padding-bottom:18px}
.p-0{padding:0}.p-1{padding:6px}.p-2{padding:12px}.p-3{padding:18px}.p-4{padding:24px}
.d-flex{display:flex}.align-items-center{align-items:center}.justify-content-between{justify-content:space-between}
.gap-1{gap:6px}.gap-2{gap:12px}.gap-3{gap:18px}
.text-center{text-align:center}.text-right{text-align:right}.text-muted{color:var(--nfr-muted)}
.fw-bold{font-weight:700}.fw-600{font-weight:600}.text-sm{font-size:12px}.text-xs{font-size:11px}
.text-primary{color:var(--nfr-blue)}.text-danger{color:var(--nfr-danger)}.text-success{color:var(--nfr-success)}
.text-gold{color:var(--nfr-gold)}.text-navy{color:var(--nfr-navy)}.text-upper{text-transform:uppercase}
.w-100{width:100%}.rounded{border-radius:var(--radius)}.border{border:1px solid var(--nfr-border)}
.bg-light{background:var(--nfr-light)}.bg-white{background:#fff}
.flex-wrap{flex-wrap:wrap}
.actions-cell { display: flex; flex-direction: column; gap: 8px; min-width: 120px; }
.actions-row { display: flex; gap: 6px; flex-wrap: wrap; }
.dl-link { color: var(--nfr-blue); font-size: 12px; font-weight: 600; text-decoration: underline; }
.dl-link:hover { color: var(--nfr-gold); }
.info-block { font-size: 13px; line-height: 1.8; }
.info-block .lbl { font-size: 11px; color: var(--nfr-muted); font-weight: 600; display: block; }
.info-block .val { color: var(--nfr-text); font-weight: 600; text-transform: uppercase; }
.divider { border: none; border-top: 1px solid var(--nfr-border); margin: 20px 0; }

/* ---- Sidebar Toggle (hamburger) ---- */
.sidebar-toggle {
  display: none;
  background: none; border: none;
  cursor: pointer;
  padding: 6px;
  color: var(--nfr-navy);
}
@media (max-width: 640px) { .sidebar-toggle { display: flex; } }

/* ---- Welcome / Login Page ---- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  background: var(--nfr-navy);
}
.login-branding {
  flex: 1;
  background: linear-gradient(150deg, var(--nfr-navy) 0%, var(--nfr-blue) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: #fff;
  text-align: center;
}
.login-branding img { width: 90px; margin-bottom: 24px; }
.login-branding h1 { font-size: 26px; color: #fff; margin-bottom: 8px; }
.login-branding p { color: rgba(255,255,255,.65); font-size: 14px; max-width: 300px; margin: 0 auto; }
.login-branding .divider-gold { width: 60px; height: 3px; background: var(--nfr-gold); border-radius: 2px; margin: 20px auto; }
.login-form-panel {
  width: 440px;
  background: var(--nfr-white);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 40px;
}
@media (max-width: 768px) {
  .login-page { flex-direction: column; }
  .login-branding { padding: 32px 20px; }
  .login-form-panel { width: 100%; padding: 32px 24px; }
}
.login-form-panel h2 { font-size: 22px; margin-bottom: 6px; color: var(--nfr-navy); }
.login-form-panel .subtitle { color: var(--nfr-muted); font-size: 13px; margin-bottom: 28px; }
