/* ============================================================
   InstruNexus Engineering Suite — Application Stylesheet
   Brand: Deep Navy #182D46 | Slate Blue #414F5E | Off White #F6F5F2 | Light Grey #C8C2C2
   ============================================================ */

:root {
  --navy:       #182D46;
  --slate:      #414F5E;
  --off-white:  #F6F5F2;
  --light-grey: #C8C2C2;
  --sidebar-w:  240px;
  --topbar-h:   56px;
  --font-sans:  'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:  'JetBrains Mono', 'Courier New', monospace;
  --radius:     8px;
  --shadow-sm:  0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow:     0 4px 6px -1px rgba(0,0,0,.08), 0 2px 4px -1px rgba(0,0,0,.06);
  --shadow-lg:  0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);
  --transition: 180ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: var(--font-sans);
  font-size: 14px;
  color: #1a2332;
  background: #f0f2f5;
  margin: 0;
  line-height: 1.5;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--navy);
  color: rgba(255,255,255,.85);
  z-index: 1000;
  transition: transform var(--transition);
  overflow: hidden;
}

.sidebar-header {
  border-bottom: 1px solid rgba(255,255,255,.1);
  background: rgba(0,0,0,.2);
}

.logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, #2E86AB, #44BBA4);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: white;
  flex-shrink: 0;
}

.logo-title { font-size: 15px; font-weight: 700; color: white; line-height: 1.2; }
.logo-sub   { font-size: 10px; opacity: .6; text-transform: uppercase; letter-spacing: .05em; }

.sidebar-project { background: rgba(255,255,255,.05); border-bottom: 1px solid rgba(255,255,255,.08); }
.project-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600; color: rgba(255,255,255,.8);
  background: rgba(255,255,255,.1); border-radius: 4px; padding: 3px 8px;
}

.sidebar-nav { padding: 8px 0; }

.nav-link {
  color: rgba(255,255,255,.7);
  border-radius: var(--radius);
  padding: 8px 12px;
  margin: 1px 0;
  display: flex; align-items: center; gap: 10px;
  font-size: 13.5px;
  transition: background var(--transition), color var(--transition);
  text-decoration: none;
}
.nav-link:hover { background: rgba(255,255,255,.08); color: white; }
.nav-link.active { background: rgba(255,255,255,.15); color: white; font-weight: 600; }
.nav-link .bi { font-size: 15px; width: 18px; text-align: center; flex-shrink: 0; }

.nav-section-label {
  font-size: 10px; font-weight: 700; letter-spacing: .1em;
  color: rgba(255,255,255,.35); padding: 12px 12px 4px;
  list-style: none;
}

.sidebar-footer {
  border-top: 1px solid rgba(255,255,255,.1);
  background: rgba(0,0,0,.15);
}

.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, #2E86AB, #44BBA4);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: white; flex-shrink: 0;
}
.user-name { font-size: 13px; font-weight: 600; color: white; }
.user-role { font-size: 11px; color: rgba(255,255,255,.5); }

.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 999;
}

/* ============================================================
   MAIN LAYOUT
   ============================================================ */
.main-wrapper {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex; flex-direction: column;
  transition: margin var(--transition);
}

.topbar {
  position: sticky; top: 0; z-index: 100;
  height: var(--topbar-h);
  background: white;
  border-bottom: 1px solid #e5e7eb;
  box-shadow: var(--shadow-sm);
}

.page-content { flex: 1; }
.page-footer { border-top: 1px solid #e5e7eb; background: white; }

.page-title  { font-size: 22px; font-weight: 700; color: var(--navy); margin: 0; }
.page-subtitle { color: #6b7280; margin: 2px 0 0; font-size: 13px; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  border: 1px solid #e5e7eb;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  background: white;
}
.card-header {
  background: transparent;
  border-bottom: 1px solid #f0f2f5;
  padding: 12px 16px;
  font-size: 13.5px;
}

/* ============================================================
   STAT CARDS
   ============================================================ */
.stat-card {
  background: white; border: 1px solid #e5e7eb; border-radius: var(--radius);
  padding: 16px; display: flex; align-items: center; gap: 14px;
  box-shadow: var(--shadow-sm); transition: box-shadow var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow); }
.stat-icon {
  width: 48px; height: 48px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: white; flex-shrink: 0;
}
.stat-value { font-size: 22px; font-weight: 700; color: var(--navy); line-height: 1; }
.stat-label { font-size: 12px; color: #6b7280; margin-top: 3px; }

/* ============================================================
   MODULE CARDS (Dashboard)
   ============================================================ */
.module-card {
  background: white; border: 1px solid #e5e7eb; border-radius: var(--radius);
  padding: 16px 12px; text-align: center; display: block;
  box-shadow: var(--shadow-sm); transition: all var(--transition);
  color: inherit;
}
.module-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); color: var(--navy); border-color: var(--navy); }
.module-icon { font-size: 28px; color: var(--navy); margin-bottom: 8px; }
.module-title { font-size: 13px; font-weight: 600; color: var(--navy); }
.module-desc  { font-size: 11px; color: #9ca3af; margin-top: 2px; }

/* ============================================================
   PROJECT CARDS
   ============================================================ */
.project-card { transition: all var(--transition); border: 1px solid #e5e7eb; }
.project-card:hover { box-shadow: var(--shadow); border-color: var(--navy); }
.project-number { font-size: 11px; font-weight: 700; color: var(--slate); letter-spacing: .05em; text-transform: uppercase; }
.project-title  { font-size: 14px; font-weight: 600; color: var(--navy); }
.project-meta   { line-height: 1.8; }

.project-module-card:hover { border-color: var(--navy); box-shadow: var(--shadow); }

/* ============================================================
   COMPONENT CARDS (Library)
   ============================================================ */
.component-card { transition: all var(--transition); }
.component-card:hover { box-shadow: var(--shadow); }
.component-thumb { width: 48px; height: 48px; object-fit: contain; border-radius: 4px; border: 1px solid #e5e7eb; }
.component-thumb-placeholder {
  width: 48px; height: 48px; border-radius: 4px; border: 1px solid #e5e7eb;
  background: #f9fafb; display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: #9ca3af; flex-shrink: 0;
}

/* ============================================================
   REPORT CARDS
   ============================================================ */
.report-card { transition: all var(--transition); }
.report-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.report-icon {
  width: 56px; height: 56px; border-radius: 14px;
  background: linear-gradient(135deg, var(--navy), var(--slate));
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; color: white;
}

/* ============================================================
   TABLES
   ============================================================ */
.io-table td, .io-table th { vertical-align: middle; white-space: nowrap; }
.table-dark { --bs-table-bg: var(--navy); }

/* ============================================================
   BADGES & CHIPS
   ============================================================ */
.badge-chip {
  display: inline-flex; border-radius: 20px;
  background: #f3f4f6; border: 1px solid #e5e7eb;
  overflow: hidden;
}
.badge-chip a {
  color: #374151; text-decoration: none;
  padding: 4px 12px; font-size: 12px; font-weight: 500;
  transition: background var(--transition), color var(--transition);
}
.badge-chip a:hover, .badge-chip.active a { background: var(--navy); color: white; }

.badge-xs { font-size: 9px; padding: 1px 5px; }
.badge-sm { font-size: 11px; }
.bg-navy   { background-color: var(--navy) !important; }
.bg-slate  { background-color: var(--slate) !important; }
.text-navy { color: var(--navy) !important; }

/* ============================================================
   FORMS
   ============================================================ */
.form-label.required::after { content: ' *'; color: #ef4444; }
.form-control:focus, .form-select:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(24,45,70,.15); }
.input-group-text { background: #f9fafb; border-color: #e5e7eb; color: #6b7280; }
.font-mono { font-family: var(--font-mono); font-size: 13px; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn { border-radius: 6px; font-size: 13.5px; font-weight: 500; }
.btn-primary { background: var(--navy); border-color: var(--navy); }
.btn-primary:hover { background: #1e3a5f; border-color: #1e3a5f; }
.btn-outline-primary { color: var(--navy); border-color: var(--navy); }
.btn-outline-primary:hover { background: var(--navy); }
.btn-xs { padding: 2px 8px; font-size: 11px; border-radius: 4px; }

/* ============================================================
   IO TABLE specifics
   ============================================================ */
.io-table { font-size: 12.5px; }

/* ============================================================
   UPLOAD ZONE
   ============================================================ */
.upload-zone {
  border: 2px dashed #d1d5db; border-radius: var(--radius);
  padding: 40px 24px; text-align: center;
  transition: all var(--transition); cursor: pointer; background: #fafafa;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--navy); background: rgba(24,45,70,.04);
}

/* ============================================================
   ACTIVITY FEED
   ============================================================ */
.activity-feed { padding: 8px 0; }
.activity-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 8px 16px; border-bottom: 1px solid #f3f4f6;
}
.activity-item:last-child { border-bottom: none; }
.activity-icon { margin-top: 7px; flex-shrink: 0; }

/* ============================================================
   NOTIFICATIONS
   ============================================================ */
.notification-panel { max-height: 360px; overflow-y: auto; }
.notification-item { padding: 10px 16px; border-bottom: 1px solid #f3f4f6; white-space: normal; }
.notification-item.unread { background: rgba(24,45,70,.04); }
.notification-item:last-child { border-bottom: none; }
.smaller { font-size: 11px; }

/* ============================================================
   AUTH LAYOUT
   ============================================================ */
.auth-body { background: var(--navy); min-height: 100vh; }
.auth-bg {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--navy) 0%, var(--slate) 100%);
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  padding: 24px;
}
.auth-container { width: 100%; max-width: 420px; }
.auth-card {
  background: white; border-radius: 14px; padding: 36px;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,.4);
}
.auth-logo-icon {
  width: 60px; height: 60px; border-radius: 14px;
  background: linear-gradient(135deg, #2E86AB, #44BBA4);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 28px; color: white; margin-bottom: 12px;
}
.auth-title { font-size: 24px; font-weight: 800; color: var(--navy); margin: 0; }
.auth-subtitle { color: #6b7280; font-size: 13px; margin: 4px 0 0; }
.auth-footer-text { color: rgba(255,255,255,.4); font-size: 12px; }

/* ============================================================
   BREADCRUMBS
   ============================================================ */
.breadcrumb { font-size: 12.5px; }
.breadcrumb-item a { color: var(--slate); text-decoration: none; }
.breadcrumb-item a:hover { color: var(--navy); }
.breadcrumb-item.active { color: #6b7280; }

/* ============================================================
   PROGRESS
   ============================================================ */
.progress { border-radius: 20px; background: #f0f2f5; }
.progress-bar { border-radius: 20px; font-size: 11px; font-weight: 600; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.show { display: block; }
  .main-wrapper { margin-left: 0; }
}

/* ============================================================
   DARK TABLE HEADER
   ============================================================ */
.table-dark th { background: var(--navy); color: white; font-size: 12px; font-weight: 600; letter-spacing: .03em; }

/* ============================================================
   MISC UTILITIES
   ============================================================ */
.bg-light-navy { background: rgba(24,45,70,.06); }
.border-navy { border-color: var(--navy) !important; }
.text-slate { color: var(--slate); }

/* Cabinet Builder specific */
.cabinet-layout {
  background: #f8f9fa; border: 2px solid var(--navy); border-radius: 8px;
  min-height: 400px; position: relative;
}
.rack-slot {
  height: 44px; border-bottom: 1px solid #e5e7eb;
  display: flex; align-items: center; padding: 0 12px; font-size: 12px;
  transition: background var(--transition); cursor: pointer;
}
.rack-slot:hover { background: rgba(24,45,70,.06); }
.rack-slot.occupied { background: rgba(24,45,70,.1); }
.rack-slot.spare { background: rgba(255,193,7,.1); }
.slot-number { width: 28px; font-weight: 700; color: var(--slate); font-family: var(--font-mono); }

/* Architecture Builder */
.arch-canvas { background: #f8f9fa; border: 1px solid #e5e7eb; border-radius: var(--radius); min-height: 500px; }

/* Print styles */
@media print {
  .sidebar, .topbar, .page-footer, .no-print { display: none !important; }
  .main-wrapper { margin-left: 0; }
  .card { box-shadow: none !important; break-inside: avoid; }
  body { background: white; }
}
