/* Section 13 UI/UX Design System — LoadingReport */

:root {
  --lr-navy: #172554;
  --lr-primary: #2563EB;
  --lr-primary-hover: #1D4ED8;
  --lr-light-blue: #EFF6FF;
  --lr-slate: #475569;
  --lr-bg: #F8FAFC;
  --lr-surface: #FFFFFF;
  --lr-surface-muted: #F1F5F9;
  --lr-border: #E2E8F0;
  --lr-text: #0F172A;
  --lr-text-muted: #64748B;
  --lr-success: #16A34A;
  --lr-warning: #D97706;
  --lr-danger: #DC2626;
  --lr-info: #0891B2;
  --lr-sidebar-w: 248px;
  --lr-sidebar-collapsed-w: 72px;
  --lr-header-h: 60px;
  --lr-radius: 10px;
}

[data-bs-theme="dark"] {
  --lr-navy: #0B1120;
  --lr-primary: #3B82F6;
  --lr-primary-hover: #60A5FA;
  --lr-light-blue: rgba(59, 130, 246, 0.14);
  --lr-slate: #94A3B8;
  --lr-bg: #0B1120;
  --lr-surface: #111827;
  --lr-surface-muted: #1E293B;
  --lr-border: #1F2937;
  --lr-text: #F8FAFC;
  --lr-text-muted: #94A3B8;
  --bs-body-bg: #0B1120;
  --bs-body-color: #F8FAFC;
}

* {
  box-sizing: border-box;
}

body {
  background-color: var(--lr-bg);
  color: var(--lr-text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

.btn-primary {
  background-color: var(--lr-primary);
  border-color: var(--lr-primary);
}
.btn-primary:hover, .btn-primary:focus {
  background-color: var(--lr-primary-hover);
  border-color: var(--lr-primary-hover);
}
.btn-outline-primary {
  color: var(--lr-primary);
  border-color: var(--lr-primary);
}
.btn-outline-primary:hover {
  background-color: var(--lr-primary);
  border-color: var(--lr-primary);
}
.text-primary { color: var(--lr-primary) !important; }
.text-success { color: var(--lr-success) !important; }
.text-warning { color: var(--lr-warning) !important; }
.text-danger { color: var(--lr-danger) !important; }
.text-info { color: var(--lr-info) !important; }

.saas-card {
  background-color: var(--lr-surface);
  border: 1px solid var(--lr-border);
  border-radius: var(--lr-radius);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  overflow: hidden;
}

.saas-card-header {
  padding: 0.85rem 1.15rem;
  border-bottom: 1px solid var(--lr-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.saas-card-body {
  padding: 1.15rem;
}

/* Login */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background-color: var(--lr-bg);
}

.login-card {
  width: 100%;
  max-width: 420px;
  background-color: var(--lr-surface);
  border: 1px solid var(--lr-border);
  border-radius: 14px;
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.08);
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background-color: var(--lr-navy);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

/* App Shell */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* Collapsible Left Sidebar */
.sidebar {
  width: var(--lr-sidebar-w);
  background-color: var(--lr-navy);
  color: #E2E8F0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 1040;
  transition: width 0.2s ease, transform 0.2s ease;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar.collapsed {
  width: var(--lr-sidebar-collapsed-w);
}

.sidebar-header {
  height: var(--lr-header-h);
  padding: 0 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.brand-icon-sm {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 8px;
  background-color: var(--lr-primary);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
}

.sidebar.collapsed .brand-text,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .sidebar-user-meta {
  display: none !important;
}

.sidebar.collapsed .sidebar-header {
  justify-content: center;
  padding: 0 0.4rem;
  gap: 0.3rem;
}

.sidebar.collapsed .brand-icon-sm {
  width: 30px;
  height: 30px;
  min-width: 30px;
  font-size: 0.95rem;
}

.sidebar.collapsed .sidebar-collapse-btn {
  padding: 0.18rem 0.3rem;
  font-size: 0.78rem;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.75rem 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.85rem;
  border-radius: 8px;
  color: #CBD5E1;
  font-weight: 500;
  font-size: 0.88rem;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
  text-decoration: none;
}

.sidebar.collapsed .sidebar-nav .nav-link {
  justify-content: center !important;
  padding: 0.65rem 0.45rem;
  gap: 0;
}

.sidebar-nav .nav-link i {
  font-size: 1.08rem;
  min-width: 20px;
  text-align: center;
}

.sidebar-nav .nav-link:hover {
  background-color: rgba(255, 255, 255, 0.08);
  color: #FFFFFF;
}

.sidebar-nav .nav-link.active {
  background-color: var(--lr-primary);
  color: #FFFFFF;
}

.sidebar-menu-panel {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.nav-section-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #94A3B8;
  padding: 0.45rem 0.8rem 0.25rem;
}

.sidebar.collapsed .nav-section-title {
  display: none;
}

.nav-group-items {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
}

.sidebar-switch-btn {
  background-color: rgba(255, 255, 255, 0.06);
  color: #E2E8F0 !important;
}

.sidebar-switch-btn:hover,
.sidebar-switch-btn.section-active {
  background-color: rgba(37, 99, 235, 0.28) !important;
  color: #FFFFFF !important;
}

.sidebar-home-btn {
  background-color: rgba(255, 255, 255, 0.1);
  color: #FFFFFF !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.sidebar-home-btn:hover {
  background-color: var(--lr-primary) !important;
}

.nav-switch-arrow {
  font-size: 0.78rem !important;
  opacity: 0.8;
}

.sidebar.collapsed .nav-switch-arrow {
  display: none !important;
}

.sidebar-footer {
  padding: 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar.collapsed .sidebar-footer {
  padding: 0.65rem 0.45rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.sidebar.collapsed .sidebar-footer > div {
  justify-content: center !important;
}

.sidebar.collapsed .sidebar-footer .d-flex.gap-1 {
  flex-direction: column;
  align-items: center;
}

.sidebar-collapse-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #CBD5E1;
  border-radius: 6px;
  padding: 0.2rem 0.45rem;
  font-size: 0.82rem;
}
.sidebar-collapse-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* Main Content Wrapper */
.main-wrapper {
  flex: 1;
  margin-left: var(--lr-sidebar-w);
  display: flex;
  flex-direction: column;
  min-width: 0;
  transition: margin-left 0.2s ease;
}

body.sidebar-collapsed .main-wrapper {
  margin-left: var(--lr-sidebar-collapsed-w);
}

/* Top Navigation Header */
.topbar {
  height: var(--lr-header-h);
  background-color: var(--lr-surface);
  border-bottom: 1px solid var(--lr-border);
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 1020;
}

.breadcrumb-trail {
  font-size: 0.75rem;
  color: var(--lr-text-muted);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.global-search-wrap {
  position: relative;
  width: 280px;
}

.global-search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background-color: var(--lr-surface);
  border: 1px solid var(--lr-border);
  border-radius: 10px;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.14);
  z-index: 1060;
  max-height: 340px;
  overflow-y: auto;
}

.global-search-item {
  padding: 0.55rem 0.8rem;
  border-bottom: 1px solid var(--lr-border);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.84rem;
}
.global-search-item:last-child { border-bottom: none; }
.global-search-item:hover { background-color: var(--lr-light-blue); }

.content-area {
  padding: 1.25rem 1.5rem;
  flex: 1;
  min-width: 0;
  overflow-x: hidden;
}

/* KPI Metric Cards */
.kpi-card {
  background-color: var(--lr-surface);
  border: 1px solid var(--lr-border);
  border-radius: var(--lr-radius);
  padding: 1rem 1.1rem;
  transition: border-color 0.15s ease, transform 0.12s ease;
  height: 100%;
}

.kpi-card.clickable {
  cursor: pointer;
}
.kpi-card.clickable:hover {
  border-color: var(--lr-primary);
  transform: translateY(-1px);
}

.kpi-icon-box {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.kpi-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--lr-text-muted);
}

.kpi-value {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--lr-text);
  margin-top: 0.2rem;
}

.kpi-delta {
  font-size: 0.75rem;
  font-weight: 500;
  margin-top: 0.25rem;
}

/* Tables (Sticky headers, readable typography) */
.saas-table-wrap {
  overflow-x: auto;
  max-height: 62vh;
}

.saas-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-bottom: 0;
}

.saas-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background-color: var(--lr-surface-muted);
  color: var(--lr-slate);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.6rem 0.65rem;
  border-bottom: 1px solid var(--lr-border);
  white-space: nowrap;
}

.saas-table th.sortable {
  cursor: pointer;
  user-select: none;
}
.saas-table th.sortable:hover {
  color: var(--lr-primary);
}

.saas-table tbody td {
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--lr-border);
  font-size: 0.84rem;
  vertical-align: middle;
  white-space: nowrap;
}

.saas-table tbody tr:hover {
  background-color: var(--lr-light-blue);
}

.saas-table tfoot td {
  padding: 0.65rem 0.65rem;
  background-color: var(--lr-surface-muted);
  border-top: 2px solid var(--lr-border);
  font-weight: 700;
  font-size: 0.84rem;
  white-space: nowrap;
}

/* Status & Category Badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  white-space: nowrap;
}
.status-badge.success { background: rgba(22, 163, 74, 0.12); color: var(--lr-success); }
.status-badge.warning { background: rgba(217, 119, 6, 0.14); color: var(--lr-warning); }
.status-badge.danger { background: rgba(220, 38, 38, 0.12); color: var(--lr-danger); }
.status-badge.info { background: rgba(8, 145, 178, 0.12); color: var(--lr-info); }
.status-badge.neutral { background: rgba(100, 116, 139, 0.14); color: var(--lr-slate); }

/* Priority New Loading Cost Summary Panel */
.cost-summary-panel {
  background-color: var(--lr-light-blue);
  border: 1px solid rgba(37, 99, 235, 0.25);
  border-radius: 12px;
  padding: 1.25rem;
}

.cost-total-amount {
  font-size: 2rem;
  font-weight: 800;
  color: var(--lr-primary);
  letter-spacing: -0.02em;
}

.capacity-meter {
  height: 10px;
  border-radius: 999px;
  background-color: var(--lr-surface-muted);
  overflow: hidden;
}

.capacity-meter-fill {
  height: 100%;
  transition: width 0.2s ease, background-color 0.2s ease;
}

/* Skeleton Loader */
.skeleton-line {
  height: 14px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--lr-surface-muted) 25%, var(--lr-border) 50%, var(--lr-surface-muted) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Report Left Category Rail */
.report-nav-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.8rem;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--lr-text);
  margin-bottom: 0.2rem;
}
.report-nav-item:hover {
  background-color: var(--lr-surface-muted);
}
.report-nav-item.active {
  background-color: var(--lr-light-blue);
  color: var(--lr-primary);
  font-weight: 600;
}

/* Loading Receipt Paper */
.receipt-sheet {
  background: #FFFFFF;
  color: #0F172A;
  border: 1px solid #CBD5E1;
  border-radius: 10px;
  padding: 1.5rem;
  max-width: 680px;
  margin: 0 auto;
}
.receipt-header-band {
  background-color: #172554;
  color: #FFFFFF;
  padding: 1rem 1.25rem;
  border-radius: 8px;
  margin-bottom: 1.25rem;
}

/* Mobile Responsive */
@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
    width: var(--lr-sidebar-w) !important;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 0 0 28px rgba(0, 0, 0, 0.35);
  }
  .main-wrapper,
  body.sidebar-collapsed .main-wrapper {
    margin-left: 0;
  }
  .global-search-wrap {
    display: none;
  }
  .content-area {
    padding: 1rem;
  }
}

/* Print-friendly Reports & Receipts */
@media print {
  .sidebar,
  .topbar,
  .no-print,
  .toast-container {
    display: none !important;
  }
  .main-wrapper,
  body.sidebar-collapsed .main-wrapper {
    margin-left: 0 !important;
  }
  .content-area {
    padding: 0 !important;
  }
  .saas-card,
  .printable-report,
  .receipt-sheet {
    box-shadow: none !important;
    border-color: #CBD5E1 !important;
  }
  .saas-table-wrap {
    max-height: none !important;
    overflow: visible !important;
  }
  body {
    background: #FFFFFF !important;
    color: #000000 !important;
  }
  body.printing-modal .app-shell {
    display: none !important;
  }
  body.printing-modal .modal {
    position: static !important;
    display: block !important;
  }
  body.printing-modal .modal-dialog {
    max-width: 100% !important;
    margin: 0 !important;
  }
  body.printing-modal .modal-header,
  body.printing-modal .modal-footer {
    display: none !important;
  }
}
