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

:root {
  --font-primary: 'Roboto', 'Segoe UI', Arial, sans-serif;
}

html[data-font='roboto'] { --font-primary: 'Roboto', 'Segoe UI', Arial, sans-serif; }
html[data-font='inter'] { --font-primary: 'Inter', 'Segoe UI', Arial, sans-serif; }
html[data-font='poppins'] { --font-primary: 'Poppins', 'Segoe UI', Arial, sans-serif; }

body,
button,
input,
select,
textarea,
.btn,
.navbar,
.main-header,
.main-sidebar,
.content-wrapper,
.modal,
.table {
  font-family: var(--font-primary) !important;
}

/* =========================
   ADMIN SHELL
========================= */
:root {
  --modern-bg: #f3f6fb;
  --modern-surface: #ffffff;
  --modern-surface-2: #f8fbff;
  --modern-text: #0f172a;
  --modern-muted: #64748b;
  --modern-border: #e2e8f0;
  --modern-primary: #2563eb;
  --modern-primary-2: #1d4ed8;
  --modern-success: #16a34a;
}

body.modern-ui {
  background: var(--modern-bg);
  color: var(--modern-text);
}

body.modern-ui .wrapper { background: var(--modern-bg); }
body.modern-ui .main-header .logo {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-weight: 700;
  letter-spacing: 0.2px;
}
body.modern-ui .main-header .navbar {
  background: #ffffff;
  border-bottom: 1px solid var(--modern-border);
  box-shadow: 0 6px 24px rgba(15, 23, 42, 0.06);
}
body.modern-ui .main-header .navbar .nav > li > a { color: #0f172a; }
body.modern-ui .main-header .navbar .nav > li > a:hover,
body.modern-ui .main-header .navbar .nav > li > a:focus {
  background: #eff6ff;
  color: var(--modern-primary-2);
}
body.modern-ui .main-sidebar {
  background: linear-gradient(180deg, #0f172a 0%, #111827 100%);
  box-shadow: 6px 0 24px rgba(15, 23, 42, 0.25);
}
body.modern-ui .sidebar-menu > li.header { color: #93c5fd; }
body.modern-ui .sidebar-menu > li > a {
  color: #cbd5e1;
  border-left: 3px solid transparent;
  margin: 2px 10px;
  border-radius: 10px;
}
body.modern-ui .sidebar-menu > li:hover > a,
body.modern-ui .sidebar-menu > li.active > a {
  background: rgba(37, 99, 235, 0.2);
  color: #fff;
  border-left-color: #60a5fa;
}
body.modern-ui .sidebar-menu .treeview-menu { background: transparent; }
body.modern-ui .sidebar-menu .treeview-menu > li > a {
  color: #cbd5e1;
  margin: 2px 10px 2px 24px;
  border-radius: 8px;
}
body.modern-ui .sidebar-menu .treeview-menu > li.active > a,
body.modern-ui .sidebar-menu .treeview-menu > li > a:hover {
  color: #ffffff;
  background: rgba(148, 163, 184, 0.16);
}
body.modern-ui .user-panel { border-bottom: 1px solid rgba(148, 163, 184, 0.2); }
body.modern-ui .user-panel > .info,
body.modern-ui .user-panel > .info > a { color: #e2e8f0; }
body.modern-ui .content-wrapper,
body.modern-ui .right-side { background: var(--modern-bg); }
body.modern-ui .content-header > h1 { font-weight: 700; color: #0f172a; }
body.modern-ui .box {
  border: 1px solid var(--modern-border);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}
body.modern-ui .box-header { border-bottom: 1px solid #eef2f7; }
body.modern-ui .btn-primary {
  background: linear-gradient(135deg, var(--modern-primary), var(--modern-primary-2));
  border-color: var(--modern-primary-2);
}
body.modern-ui .btn-success {
  background: linear-gradient(135deg, #22c55e, var(--modern-success));
  border-color: var(--modern-success);
}
body.modern-ui .btn-default { border-color: #d0d8e6; color: #334155; }
body.modern-ui .table > thead > tr > th {
  background: var(--modern-surface-2);
  border-bottom: 1px solid var(--modern-border);
  color: #334155;
}
body.modern-ui .table > tbody > tr:hover { background: #f8fbff; }
body.modern-ui .label-wo-total { background: linear-gradient(135deg, #1d4ed8, #1e3a8a) !important; }
body.modern-ui .main-footer {
  border-top: 1px solid var(--modern-border);
  background: #fff;
  color: #64748b;
}
body.modern-ui .modal-content {
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 20px 35px rgba(15, 23, 42, 0.2);
}

/* =========================
   ADMIN PAGES
========================= */
body.modern-ui .modern-workorder-page,
body.modern-ui .modern-maintenance-page {
  --mp-bg: #f8fafc;
  --mp-card: #ffffff;
  --mp-border: #e2e8f0;
  --mp-text: #0f172a;
}
body.modern-ui .modern-workorder-page .small-box {
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
  overflow: hidden;
}
body.modern-ui .modern-workorder-page .small-box .icon { opacity: 0.22; top: 12px; }
body.modern-ui .modern-workorder-page .small-box-footer { background: rgba(2, 6, 23, 0.12); color: #fff; font-weight: 600; }
body.modern-ui .modern-workorder-page p { color: var(--mp-text); }
body.modern-ui .modern-workorder-page .progress {
  border-radius: 999px;
  height: 22px;
  background: #e2e8f0;
  box-shadow: inset 0 1px 3px rgba(15, 23, 42, 0.12);
}
body.modern-ui .modern-workorder-page .progress .progress-bar { line-height: 22px; font-size: 12px; font-weight: 600; }
body.modern-ui .modern-workorder-page #search,
body.modern-ui .modern-maintenance-page .form-control,
body.modern-ui .modern-workorder-page .form-control {
  border-radius: 10px;
  border: 1px solid #cfd8e3;
  box-shadow: none;
}
body.modern-ui .modern-workorder-page .box,
body.modern-ui .modern-maintenance-page .box {
  border: 1px solid var(--mp-border);
  border-radius: 14px;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.06);
  background: var(--mp-card);
}
body.modern-ui .modern-maintenance-page .box-header.with-border { border-bottom: 1px solid #e9eff6; padding: 14px; }
body.modern-ui .modern-maintenance-page .box-header .btn,
body.modern-ui .modern-workorder-page .btn { border-radius: 10px; font-weight: 600; }
body.modern-ui .modern-maintenance-page .btn-success { background: linear-gradient(135deg, #22c55e, #16a34a); border-color: #15803d; }
body.modern-ui .modern-maintenance-page .btn-info { background: linear-gradient(135deg, #0ea5e9, #0284c7); border-color: #0369a1; }
body.modern-ui .modern-maintenance-page .btn-primary,
body.modern-ui .modern-workorder-page .btn-primary { background: linear-gradient(135deg, #2563eb, #1d4ed8); border-color: #1e40af; }
body.modern-ui .modern-maintenance-page .modal-body,
body.modern-ui .modern-workorder-page .modal-body { background: #f8fbff !important; }
body.modern-ui #ems-dashboard-root.modern-home-dashboard .ems-dash-header { box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08); }
body.modern-ui #ems-dashboard-root.modern-home-dashboard .card,
body.modern-ui #ems-dashboard-root.modern-home-dashboard .kpi-card { border-radius: 16px; box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06); }
body.modern-ui #ems-dashboard-root.modern-home-dashboard .kpi-value { letter-spacing: -0.03em; }
body.modern-ui #ems-dashboard-root.modern-home-dashboard .mode-tab.active { background: #1d4ed8; border-color: #1d4ed8; color: #fff; }

/* =========================
   AUTH (LOGIN)
========================= */
body.modern-auth {
  min-height: 100vh;
  margin: 0;
  background: linear-gradient(135deg, #020617 0%, #0b1120 55%, #172554 100%);
  color: #dbeafe;
}
body.modern-auth .modern-auth-shell { min-height: 100vh; display: flex; flex-direction: column; }
body.modern-auth .modern-auth-topbar { display: flex; justify-content: flex-end; padding: 18px 24px 0; }
body.modern-auth .modern-auth-topbar a { color: #c7d2fe !important; text-decoration: none; font-size: 13px; }
body.modern-auth .modern-auth-main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
body.modern-auth .modern-auth-card {
  width: 100%;
  max-width: 420px;
  background: rgba(15, 23, 42, 0.86);
  border: 1px solid rgba(99, 102, 241, 0.28);
  box-shadow: 0 25px 60px rgba(2, 6, 23, 0.5);
  border-radius: 16px;
  padding: 28px 24px 24px;
}
body.modern-auth .modern-auth-logo { text-align: center; margin-bottom: 10px; }
body.modern-auth .modern-auth-logo img { width: 42px; height: 42px; object-fit: contain; }
body.modern-auth .modern-auth-card h1 { margin: 0 0 18px; text-align: center; font-size: 28px; font-weight: 700; color: #f8fafc; }
body.modern-auth .modern-alert { margin-bottom: 14px; border-radius: 10px; font-size: 13px; }
body.modern-auth .modern-auth-form .modern-field { margin-bottom: 14px; }
body.modern-auth .modern-auth-form label { display: block; margin-bottom: 6px; font-size: 13px; color: #93c5fd; font-weight: 500; }
body.modern-auth .modern-field-meta { display: flex; justify-content: space-between; align-items: center; }
body.modern-auth .modern-field-meta a { color: #93c5fd !important; font-size: 12px; text-decoration: none; }
body.modern-auth .modern-field-meta a:hover { text-decoration: underline; }
body.modern-auth .modern-auth-card h1 { color: #93c5fd; }
body.modern-auth .gui-input {
  width: 100%;
  height: 42px;
  background: rgba(30, 41, 59, 0.92);
  border: 1px solid #334155;
  border-radius: 10px;
  color: #f1f5f9;
  font-size: 16px;
  line-height: 1.35;
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
/* Autofill: Chrome paints a light blue/yellow background; without overriding it, light text is invisible. */
body.modern-auth .gui-input:-webkit-autofill,
body.modern-auth .gui-input:-webkit-autofill:hover,
body.modern-auth .gui-input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 1000px rgb(30, 41, 59) inset !important;
  box-shadow: 0 0 0 1000px rgb(30, 41, 59) inset !important;
  -webkit-text-fill-color: #f1f5f9 !important;
  caret-color: #f1f5f9;
  font-size: 16px;
  line-height: 1.35;
  transition: background-color 99999s ease-out 0s;
}
body.modern-auth .gui-input:-webkit-autofill:focus {
  border-color: #1d4ed8;
  -webkit-box-shadow: 0 0 0 1000px rgb(30, 41, 59) inset, 0 0 0 3px rgba(29, 78, 216, 0.35) !important;
  box-shadow: 0 0 0 1000px rgb(30, 41, 59) inset, 0 0 0 3px rgba(29, 78, 216, 0.35) !important;
  -webkit-text-fill-color: #f1f5f9 !important;
  caret-color: #f1f5f9;
  font-size: 16px;
  line-height: 1.35;
}
/* Avoid overriding autofill inset shadow (must follow autofill rules). */
body.modern-auth .gui-input:focus:not(:-webkit-autofill) {
  border-color: #1d4ed8;
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.2);
}
body.modern-auth .modern-password-wrap { position: relative; }
body.modern-auth .modern-password-input { padding-right: 42px; }
body.modern-auth .modern-password-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: #94a3b8;
  padding: 4px;
  line-height: 1;
}
body.modern-auth .modern-password-toggle:hover,
body.modern-auth .modern-password-toggle:focus {
  color: #cbd5e1;
  outline: none;
}
body.modern-auth .modern-remember { display: flex; align-items: center; gap: 8px; margin: 6px 0 16px; font-size: 13px; color: #93c5fd; }
body.modern-auth .modern-signin-btn {
  width: 100%;
  height: 42px;
  border: 0;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(90deg, #1d4ed8, #16a34a);
}
body.modern-auth .modern-auth-footer { text-align: center; color: #94a3b8; font-size: 12px; padding: 14px 10px 18px; }

/* =========================
   USER SHELL
========================= */
body.modern-user-ui { background: #f3f6fb; color: #0f172a; }
body.modern-user-ui .main-header .navbar {
  margin-left: 0 !important;
  background: #0f172a !important;
  border: 0;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.28);
}
body.modern-user-ui .navbar .nav > li > a { color: #e2e8f0 !important; font-weight: 600; }
body.modern-user-ui .navbar .nav > li > a:hover,
body.modern-user-ui .navbar .nav > li > a:focus { background: rgba(59, 130, 246, 0.22) !important; color: #fff !important; }
body.modern-user-ui .navbar .dropdown-menu {
  border: 1px solid #dbe3ef;
  border-radius: 12px;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.2);
  overflow: hidden;
  background: #ffffff;
}
body.modern-user-ui .modern-user-dropdown { background: #ffffff !important; }
body.modern-user-ui .navbar .dropdown-menu > li > a { padding: 10px 14px; color: #0f172a !important; }
body.modern-user-ui .navbar .dropdown-menu > li > a:hover { background: #eff6ff !important; color: #1d4ed8 !important; }
body.modern-user-ui .label-danger,
body.modern-user-ui .badge.bg-danger { background: linear-gradient(135deg, #1d4ed8, #eab308) !important; }
body.modern-user-ui .navbar .nav > li > a .label.label-pill {
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  margin-left: 4px;
}
body.modern-user-ui .content-wrapper {
  margin-left: 0 !important;
  background: #f3f6fb;
  min-height: calc(100vh - 108px);
}
body.modern-user-ui .content { padding-top: 18px; }
body.modern-user-ui .box {
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.07);
}
body.modern-user-ui .box-header { border-bottom: 1px solid #eef2f7; }
body.modern-user-ui .btn-primary { background: linear-gradient(135deg, #2563eb, #1d4ed8); border-color: #1e40af; }
body.modern-user-ui .btn-default { border-color: #d3dce8; color: #334155; }
body.modern-user-ui .modal-content {
  border-radius: 14px;
  border: 1px solid #dbe3ef;
  box-shadow: 0 20px 38px rgba(15, 23, 42, 0.24);
}
body.modern-user-ui .modal-header { border-bottom: 1px solid #e9eff6; background: #f8fbff; }
body.modern-user-ui .modal-title.text-success,
body.modern-user-ui .modal-header .label-success {
  color: #1d4ed8 !important;
}
body.modern-user-ui .main-footer {
  margin-left: 0 !important;
  border-top: 1px solid #e2e8f0;
  background: #fff;
  color: #64748b;
}
