@import url('/static/css/nexus_dark_theme.css');

:root {
  --ent-bg: #060d22;
  --ent-surface: #0f1b36;
  --ent-surface-2: #122448;
  --ent-text: #e7eefb;
  --ent-muted: #9eb0d1;
  --ent-border: #24385f;
  --ent-brand: #3b82f6;
  --ent-brand-2: #93c5fd;
}

body {
  background:
    radial-gradient(circle at 12% -8%, rgba(59, 130, 246, 0.2) 0%, transparent 34%),
    radial-gradient(circle at 88% 8%, rgba(56, 189, 248, 0.11) 0%, transparent 26%),
    linear-gradient(145deg, #070f25 0%, #091531 48%, #060d22 100%);
  color: var(--ent-text);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  padding: 0;
}

.card,
.modal-content,
.list-group-item,
.dropdown-menu {
  background-color: var(--ent-surface);
  color: var(--ent-text);
  border-color: var(--ent-border);
}

.table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--ent-text);
  --bs-table-border-color: rgba(159, 180, 214, 0.18);
  --bs-table-striped-bg: rgba(255, 255, 255, 0.03);
  --bs-table-hover-bg: rgba(59, 130, 246, 0.14);
}

.form-control,
.form-select {
  background: rgba(255, 255, 255, 0.06);
  color: var(--ent-text);
  border: 1px solid rgba(159, 180, 214, 0.32);
}

.form-control,
.form-select,
.input-group-text,
.form-check-input,
.form-range {
  color: var(--ent-text) !important;
}

.form-control:focus,
.form-select:focus {
  background: rgba(255, 255, 255, 0.09);
  color: var(--ent-text);
  border-color: #3b82f6;
  box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.24);
}

.form-control::placeholder {
  color: #9eb0d1;
}

.bg-light,
.bg-white,
.text-bg-light,
.badge.text-bg-light,
[class*="bg-light"] {
  background: rgba(159, 180, 214, 0.12) !important;
  color: var(--ent-text) !important;
  border-color: rgba(159, 180, 214, 0.25) !important;
}

.text-dark,
.link-dark,
.btn-close,
.dropdown-item-text {
  color: var(--ent-text) !important;
}

.border,
.border-top,
.border-bottom,
.border-start,
.border-end,
hr {
  border-color: rgba(159, 180, 214, 0.24) !important;
}

.card,
.list-group-item,
.dropdown-menu,
.modal-content,
.offcanvas,
.accordion-item,
.accordion-button,
.toast,
.popover {
  background-color: var(--ent-surface) !important;
  color: var(--ent-text) !important;
  border-color: rgba(159, 180, 214, 0.22) !important;
}

.accordion-button:not(.collapsed) {
  background: linear-gradient(135deg, #112548, #0f1f3f) !important;
  color: #ffffff !important;
}

.table,
.table > :not(caption) > * > * {
  color: var(--ent-text) !important;
  border-color: rgba(159, 180, 214, 0.2) !important;
}

.table-light,
.table thead,
.table thead th {
  background: rgba(159, 180, 214, 0.1) !important;
  color: #eaf1ff !important;
}

.nav-tabs {
  border-bottom-color: rgba(159, 180, 214, 0.25);
}

.nav-tabs .nav-link {
  color: var(--ent-muted);
  border-color: transparent;
}

.nav-tabs .nav-link.active,
.nav-tabs .nav-item.show .nav-link {
  color: #ffffff;
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(159, 180, 214, 0.3);
}

.pagination .page-link {
  background: var(--ent-surface);
  color: var(--ent-text);
  border-color: rgba(159, 180, 214, 0.24);
}

.pagination .page-link:hover,
.pagination .page-item.active .page-link {
  background: #1d4ed8;
  color: #ffffff;
  border-color: #3b82f6;
}

/* Legacy template panel harmonization */
.svg-container,
.doc-panel,
.tech-table-wrap,
.preview-canvas,
.panel,
.kpi,
.stat-tile,
.flow-stage,
.tool-row-card,
.sheet-row,
.edge-log,
.wear-item,
#weldonVisual,
#weldonWorkshopDrawing,
#insertInfo,
#holderInfo,
#out {
  background: rgba(15, 27, 54, 0.92) !important;
  color: var(--ent-text) !important;
  border-color: rgba(159, 180, 214, 0.24) !important;
}

.font-monospace.bg-light,
pre.bg-light,
div.bg-light.border.rounded,
.small.bg-light.border.rounded {
  background: rgba(159, 180, 214, 0.12) !important;
  color: var(--ent-text) !important;
}

canvas,
svg {
  max-width: 100%;
}

.btn,
.btn-primary,
.btn-secondary,
.btn-success,
.btn-danger,
.btn-warning,
.btn-info,
.btn-light,
.btn-dark,
.btn[class*="btn-outline-"] {
  background: linear-gradient(120deg, #2563eb, #1d4ed8) !important;
  border-color: #3b82f6 !important;
  color: #ffffff !important;
}

.btn:hover,
.btn:focus,
.btn:active,
.btn-primary:hover,
.btn-secondary:hover,
.btn-success:hover,
.btn-danger:hover,
.btn-warning:hover,
.btn-info:hover,
.btn-light:hover,
.btn-dark:hover,
.btn[class*="btn-outline-"]:hover {
  background: linear-gradient(120deg, #1d4ed8, #1e40af) !important;
  border-color: #60a5fa !important;
  color: #ffffff !important;
}

.btn:disabled,
.btn.disabled {
  background: linear-gradient(120deg, #1e3a8a, #1e40af) !important;
  border-color: #3b82f6 !important;
  color: rgba(255, 255, 255, 0.8) !important;
}

.enterprise-shell-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5000;
  backdrop-filter: blur(12px);
  background: rgba(11, 18, 32, 0.97);
  border-bottom: 1px solid #1e293b;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
  height: auto;
  min-height: 46px;
  max-height: none;
  overflow: visible;
  padding: 0.2rem 0.35rem !important;
}

.enterprise-shell-nav .container-fluid {
  padding-left: 0.6rem;
  padding-right: 0.6rem;
  min-height: 42px;
  align-items: center;
}

.enterprise-shell-nav .navbar-brand {
  font-size: 0.95rem !important;
  padding: 0.15rem 0;
  margin-right: 0.5rem;
}

.enterprise-shell-nav .navbar-collapse,
.enterprise-shell-nav .container-fluid {
  overflow: visible !important;
}

.enterprise-shell-nav #mainMenuLinks,
.enterprise-shell-nav .enterprise-shell-links {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.28rem;
  margin-left: 0.35rem;
  /* overflow clips absolute dropdown menus — keep visible */
  overflow: visible;
  max-width: none;
  flex: 1 1 auto;
  padding-bottom: 0;
}

.enterprise-shell-wrap {
  max-width: 1460px;
  margin: 0 auto;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.enterprise-shell-brand {
  font-weight: 800;
  color: #e6f0ff;
  letter-spacing: 0.02em;
  text-decoration: none;
  white-space: nowrap;
  font-size: 0.9rem;
}

.enterprise-shell-brand span {
  color: var(--ent-brand);
}

.enterprise-shell-links {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-left: 8px;
  flex-wrap: nowrap;
}

.enterprise-shell-link,
.enterprise-shell-dd-btn {
  border: 1px solid rgba(148, 163, 184, 0.32);
  background: rgba(148, 163, 184, 0.1);
  color: #e2e8f0;
  font-size: 0.74rem;
  font-weight: 600;
  text-decoration: none;
  padding: 0.28rem 0.55rem;
  border-radius: 6px;
  line-height: 1.2;
  white-space: nowrap;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.enterprise-shell-nav #navbarRight {
  gap: 0.45rem !important;
  flex-wrap: nowrap !important;
}

.enterprise-shell-nav .es-global-search {
  min-width: 160px !important;
  max-width: 220px !important;
  width: 180px !important;
}

.enterprise-shell-nav .es-global-search-input {
  height: 28px !important;
  font-size: 0.75rem !important;
  padding: 0 8px !important;
}

h1, h2, h3, h4, h5, h6,
label,
.form-label,
.table th,
.table td,
.card-title,
.card-text {
  color: var(--ent-text);
}

.text-muted,
.small,
.form-text {
  color: var(--ent-muted) !important;
}

.navbar,
.nav,
.nav-link,
.dropdown-item,
.dropdown-toggle {
  color: var(--ent-text);
}

.dropdown-item:hover,
.dropdown-item:focus {
  background: rgba(59, 130, 246, 0.2);
  color: #ffffff;
}

.modal-header,
.modal-footer {
  border-color: rgba(159, 180, 214, 0.2);
}

.btn {
  font-weight: 600;
}

.alert {
  color: var(--ent-text);
  border-color: rgba(159, 180, 214, 0.25);
}

.alert-secondary { background: rgba(148, 163, 184, 0.14); }
.alert-info { background: rgba(59, 130, 246, 0.18); }
.alert-success { background: rgba(34, 197, 94, 0.18); }
.alert-warning { background: rgba(245, 158, 11, 0.18); }
.alert-danger { background: rgba(239, 68, 68, 0.18); }

.enterprise-shell-link:hover,
.enterprise-shell-dd-btn:hover {
  border-color: #60a5fa;
  background: rgba(59, 130, 246, 0.22);
  color: #ffffff;
  transform: none;
}

.btn-icon,
a.btn-icon,
button.btn-icon {
  background: linear-gradient(120deg, #2563eb, #1d4ed8) !important;
  border-color: #3b82f6 !important;
  color: #ffffff !important;
}

.btn-icon:hover,
a.btn-icon:hover,
button.btn-icon:hover,
.btn-icon:focus,
a.btn-icon:focus,
button.btn-icon:focus {
  background: linear-gradient(120deg, #1d4ed8, #1e40af) !important;
  border-color: #60a5fa !important;
  color: #ffffff !important;
}

.enterprise-shell-dd {
  position: relative;
}

.enterprise-shell-dd-menu {
  position: fixed;
  top: 0;
  left: 0;
  min-width: 280px;
  max-width: min(420px, 92vw);
  max-height: min(70vh, 560px);
  overflow-y: auto;
  display: none;
  border: 1px solid #334155;
  background: #0f172a;
  border-radius: 10px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
  padding: 6px;
  z-index: 6000;
}

@media (max-width: 1320px) {
  .enterprise-shell-pill {
    display: none;
  }
}

.enterprise-shell-dd.open .enterprise-shell-dd-menu {
  display: block;
}

.enterprise-shell-dd-menu a {
  display: block;
  text-decoration: none;
  color: #d9e7ff;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 7px 8px;
  border-radius: 8px;
}

.enterprise-shell-dd-menu a:hover {
  background: rgba(59, 130, 246, 0.2);
  color: #ffffff;
}

.enterprise-shell-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.enterprise-shell-pill {
  font-size: 0.74rem;
  color: #c0d2f3;
  border: 1px solid var(--ent-border);
  background: linear-gradient(120deg, #10213f, #16305d);
  border-radius: 999px;
  padding: 4px 10px;
}

.enterprise-shell-hide {
  display: none !important;
}

@media (max-width: 992px) {
  .enterprise-shell-wrap {
    flex-wrap: wrap;
  }
  .enterprise-shell-links {
    width: 100%;
    margin-left: 0;
  }
  .enterprise-shell-right {
    width: 100%;
    margin-left: 0;
    justify-content: flex-end;
  }
  .enterprise-shell-link,
  .enterprise-shell-dd-btn {
    font-size: 0.72rem;
    padding: 0.22rem 0.48rem;
  }
}

:root {
  --nexus-nav-h: 48px;
  --shell-bg: #0b1220;
  --shell-surface: #0f172a;
  --shell-border: #334155;
  --shell-text: #e2e8f0;
  --shell-muted: #94a3b8;
  --shell-accent: #60a5fa;
  --shell-content-pad: 1rem;
}

/* Shell contract helpers (base.html + standalone pages) */
body.shell-topnav #sidebar {
  display: none !important;
  width: 0 !important;
  min-width: 0 !important;
  border: none !important;
  flex: 0 0 0 !important;
}
body.shell-topnav #main-content {
  width: 100% !important;
  flex: 1 1 auto !important;
}

/* Legacy pages used ~84px top pad for the old tall navbar; body pad is now set by JS. */
body.has-enterprise-nav .page-wrap,
body.has-enterprise-nav .page,
body.has-enterprise-nav .wrap,
body.has-enterprise-nav .shell,
body.has-enterprise-nav .spc-wrap,
body.has-enterprise-nav .recall-wrap,
body.has-enterprise-nav .quality-dark-page .page,
body.has-enterprise-nav main.container-fluid {
  padding-top: 0.75rem !important;
}
