/*
------------------------------------------------------------------------------
 NodeSniff Agent - Lightweight Linux metrics collector

 Author: Sebastian Zieba <sebastian@zieba.art>
 License: GNU GPL v3 (non-commercial use only)

 This software is licensed under the terms of the GNU General Public License
 version 3 (GPLv3) as published by the Free Software Foundation, for
 non-commercial use only.

 For commercial licensing, please contact the author directly.
------------------------------------------------------------------------------
*/

/* Root layout */
html,
body {
  width: 100%;
  height: 100%;
  font-family:
    system-ui,
    -apple-system,
    'Segoe UI',
    Roboto,
    'Helvetica Neue',
    Arial,
    sans-serif;
  background-color: #f8f9fa;
  background-size: cover;
  flex-direction: column;
  overflow-y: scroll;
  overflow-x: hidden;
  padding-top: 60px; /* space for fixed navbar */
}

/* ========================
   Server list styling
   ======================== */

/* Active list item with blue vertical rails */
.list-group-item {
  position: relative;
  overflow: visible;
  z-index: 1;
}

.list-group-item:hover {
  background-color: #f8f9fa;
  border-left: 4px solid #6c757d;
}

.list-group-item.active {
  position: relative;
  background-color: #f1f1f1 !important;
  font-weight: 600;
  color: #000 !important;
  border: 1px solid #dee2e6;
  border-left: none !important;
  z-index: 1;
  overflow: visible;
}

/* Left rail */
.list-group-item.active::before {
  content: '';
  position: absolute;
  top: -1px;
  left: -4px;
  width: 4px;
  height: calc(100% + 2px);
  background-color: #0d6efd;
  z-index: 2;
}

/* Right rail */
.list-group-item.active::after {
  content: '';
  position: absolute;
  top: -1px;
  right: -3px;
  width: 3px;
  height: calc(100% + 2px);
  background-color: #0d6efd;
  z-index: 2;
}

/* OS icon and inline edit icon */
.os-icon {
  height: 14px;
  width: auto;
  vertical-align: middle;
  opacity: 0.85;
  margin-left: 3px;
  filter: grayscale(100%) brightness(85%);
  opacity: 0.85;
  vertical-align: middle;
}

.server-edit-icon {
  font-size: 12px;
  color: #000;
  cursor: pointer;
  line-height: 1;
  padding-left: 2px;
  opacity: 0.6;
}
.server-edit-icon:hover {
  color: #444;
  opacity: 1;
}

/* Consistent typography */
.server-details p,
#servers li,
h5,
h6,
#servers li strong {
  font-size: 1rem;
  line-height: 1.2;
}

/* Empty state (no servers) */
#empty-dashboard {
  position: fixed;
  inset: 0;
  z-index: 800;
  display: flex;
  justify-content: center;
  align-items: center;
  background: none; /* no overlay */
}

.empty-dashboard-card {
  min-width: 367px;
  max-width: 630px;
  width: 100%;
  background: #fff;
  border-radius: 0 !important;
  box-shadow: none;
  border: 1px solid #d2d2d2;
  padding: 34px 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  justify-content: center;
}

/* Sort dropdown spacing */
#sort-select {
  margin-right: 0px;
}

/* Server details headings and columns */
.server-details h5 {
  font-size: 1.1rem;
  margin-bottom: 1.6rem;
  font-weight: 600;
  border-bottom: 1px solid #dee2e6;
  padding-bottom: 0.2rem;
}
.server-details .col-md-4 {
  padding: 15px;
}

/* Button normalization */
.server-actions .btn,
button.btn {
  font-size: 0.875rem;
  padding: 0.35rem 0.75rem;
  border-radius: 0 !important;
}

/* Initial full‑page spinner */
.fullpage-spinner {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: white;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Server list items */
#servers li {
  padding: 0.15rem 0.3rem;
  border: 1px solid #dee2e6;
  border-radius: 0 !important;
  margin-top: 4px;
  margin-right: 4px;
}
#servers li:last-child {
  margin-bottom: 4px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  min-width: 60px;
  text-align: center;
  transform: translateY(0.5px);
}

/* Variants */
.status-online {
  background-color: #198754;
  color: #fff;
}

.status-offline {
  background-color: #dc3545;
  color: #fff;
}

.status-warn {
  background-color: #ffc107;
  color: #fff;
}

.status-alert,
.status-crit {
  background-color: #dc3545;
  color: #fff;
}

/* Metric bars (large view) */
.metric-bar {
  height: 6px;
  background: #e9ecef;
  margin-bottom: 4px;
  overflow: hidden;
  border-radius: 5px;
}
.metric-fill {
  height: 100%;
  transition: width 0.3s ease;
  border-radius: 5px;
}
.metric-fill.cpu,
.metric-fill.ram,
.metric-fill.disk {
  background-color: #0d6efd;
}
.metric-fill.warn {
  background-color: #ffc107 !important;
}
.metric-fill.crit {
  background-color: #dc3545 !important;
}

/* Top processes table helpers */
#top-processes-section td {
  vertical-align: middle;
}

.ram-bar,
.cpu-bar {
  height: 8px;
  border-radius: 4px;
  background-color: #e9ecef;
  overflow: hidden;
}
.ram-bar-fill,
.cpu-bar-fill {
  height: 100%;
  background-color: #0d6efd;
}
.ram-high .ram-bar-fill {
  background-color: #dc3545;
}
.cpu-high .cpu-bar-fill {
  background-color: #dc3545;
} /* red for high CPU */

/* Cards grid helpers */
#top-processes-section,
#server-location-card {
  min-height: 280px;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.row-eq-height {
  display: flex;
  flex-wrap: wrap;
}
.row-eq-height > [class*='col-'] {
  display: flex;
  flex-direction: column;
}
.row-eq-height .card {
  flex: 1;
}

.card,
.card-body,
.list-group,
.list-group-item {
  border-radius: 0 !important;
}

/* Sidebar (server list) */
#servers-wrapper {
  position: fixed;
  top: 60px; /* below navbar */
  left: 0;
  width: 25% !important;
  height: calc(100vh - 60px - 42px); /* minus navbar and bottom toolbar */
  background-color: #f8f9fa;
  margin: 0;
  padding-left: 8px;
  padding-right: 0;
  padding-top: 8px;
  overflow-y: auto;
  z-index: 100;
  overflow-x: hidden;
}

/* Main column layout (details area) */
#main-content > .row {
  display: flex;
  align-items: stretch;
  margin: 0;
  padding: 0;
}
#main-content {
  margin-left: 25%;
}
#main-content > .row > .col-md-9 {
  width: 75% !important;
  max-width: 75% !important;
  flex: 0 0 75% !important;
}

/* Server details card fills container */
#serverDetails {
  position: relative;
  flex: 1 1 auto;
  margin-bottom: 0 !important;
  padding-bottom: 0 !important;
}

/* Map and spinner */
#geoip-spinner {
  z-index: 20;
}
#server-location-card .card-body {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}
#ip-map {
  flex-grow: 1;
  min-height: 200px;
  height: 100%;
  width: 100%;
  border: 1px solid #dee2e6;
  border-radius: 0;
}
.leaflet-container {
  height: 100% !important;
  width: 100% !important;
}

/* Detail overlay spinner anchored to details column */
#detail-spinner {
  position: fixed;
  z-index: 1050;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 75vw; /* matches details column width */
  height: 100vh;
  top: 0;
  left: 25vw; /* offset to the right of sidebar */
  pointer-events: none;
}

@media (max-width: 768px) {
  #detail-spinner {
    width: 100vw !important;
    left: 0 !important;
  }
}

/* Semi‑transparent overlay inside cards */
.spinner-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 20;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(255, 255, 255, 0.6);
  pointer-events: none;
}

/* Expand/collapse top processes */
#toggle-process-btn {
  font-size: 0.8rem;
  color: #6c757d;
  background-color: #fff;
  border: 1px solid #dee2e6;
  border-radius: 0;
  padding: 0.35rem 0.75rem;
  transition: background-color 0.2s ease;
  cursor: pointer;
}
#toggle-process-btn:hover {
  background-color: #f8f9fa;
  color: #6c757d;
}

/* Filters (time range + custom date) */
.time-range-select,
#custom-date,
#reset-now-btn {
  height: calc(1.5em + 0.5rem + 2px);
  border-radius: 0 !important;
  background-color: #fff;
  border: 1px solid #dee2e6;
  color: #6c757d;
  box-shadow: none !important;
}

#reset-now-btn:hover {
  background-color: #f8f9fa;
}

.time-range-select {
  width: 120px;
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
  line-height: 1.5;
  appearance: none;
}
.time-range-select:focus {
  border-color: #ced4da;
  outline: none;
}
.time-range-select:hover,
#custom-date:hover {
  cursor: pointer;
}

#custom-date {
  width: 120px;
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
  line-height: 1.5;
  font-family:
    system-ui,
    -apple-system,
    'Segoe UI',
    Roboto,
    'Helvetica Neue',
    Arial,
    sans-serif;
}
#custom-date:focus {
  border-color: #dee2e6;
  outline: none;
}

#reset-now-btn {
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
  line-height: 1.5;
}

/* Superuser greeting color */
.superuser-welcome {
  color: #dc3545 !important; /* Bootstrap red */
  font-weight: bold;
}

/* Card borders in details area */
.server-details .card {
  border: 1px solid #dee2e6 !important;
  border-radius: 0 !important;
}

/* Generic modal shell */
.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.4);
  align-items: center;
  justify-content: center;
}
.modal.show {
  display: flex;
}

/* Server modal tweaks */
#serverModal .modal-content {
  border-radius: 0 !important;
  border: none;
}
#serverModal .form-control-lg {
  font-size: 1.1rem;
  padding: 0.7rem 1rem;
}
#serverModal .modal-header,
#serverModal .modal-footer {
  background: #f8f9fa;
}

/* Form components reset */
input.form-control,
button.btn,
.btn,
.form-control {
  border-radius: 0 !important;
}

.alert {
  border-radius: 0 !important;
}

/* Scroll container for server list */
#servers {
  flex-grow: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Server modal input sizing */
#serverModal input.form-control {
  font-size: 1.1rem;
  padding: 0.7rem 1rem;
  width: 100%;
  min-width: 30ch;
}

/* Empty server list hint */
#servers-empty-msg {
  border-radius: 10px;
}

/* Details empty overlay */
.empty-overlay {
  position: fixed;
  top: 62px;
  left: 0;
  width: 100vw;
  height: calc(100vh - 62px);
  z-index: 2000;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
}
.empty-overlay > div {
  max-width: 480px;
  margin: 0 auto;
}

/* Company key input (empty state) */
#companyKeyInput {
  font-size: 0.72rem;
  background-color: #f8f9fa;
  color: #333;
  width: 100px;
  min-width: 0;
  user-select: none;
  text-align: center;
  letter-spacing: 0.01em;
}

/* Spacing utility override */
.me-2 {
  margin-right: 0.5rem !important;
}

/* ========================
   Profile modal
   ======================== */
#profileModal .modal-content {
  margin-top: 60px;
  border-radius: 0 !important;
  border: none;
}
#profileModal .form-control-lg {
  font-size: 1.1rem;
  padding: 0.7rem 1rem;
}
#profileModal .modal-header,
#profileModal .modal-footer {
  background: #f8f9fa;
}
#profileModal input.form-control,
#profileModal button.btn,
#profileModal .btn,
#profileModal .form-control {
  border-radius: 0 !important;
}
#profileModal .alert {
  border-radius: 0 !important;
}

#profileDial {
  height: 38px;
  padding: 0.375rem 0.75rem;
  font-size: 1rem;
  border-radius: 0 !important;
  background-color: #e9ecef;
  text-align: center;
  margin-top: 2px;
}
#profilePhone {
  height: 38px;
  padding: 0.375rem 0.75rem;
  font-size: 1rem;
  border-radius: 0 !important;
  max-width: 150x; /* note: likely a typo: 150px? */
}
.input-group-text {
  height: 38px;
  padding: 0.375rem 0.75rem;
  font-size: 1rem;
  border-radius: 0 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}
.input-group {
  flex-shrink: 0;
}

/* ========================
   API key modal
   ======================== */
#apiKeyModal .modal-dialog {
  width: 90vw;
  max-width: 500px;
  margin: 1.75rem auto;
}
@media (min-width: 768px) {
  #apiKeyModal .modal-dialog {
    width: 35%;
    max-width: none;
  }
}
#apiKeyModal .modal-content {
  border-radius: 0 !important;
}

#companyKeyInputModal {
  font-size: 0.72rem;
  background-color: #f8f9fa;
  color: #333;
  width: 100px;
  user-select: none;
  text-align: center;
  letter-spacing: 0.01em;
  border-radius: 0 !important;
}
#companyKeyInputModal:focus {
  outline: none !important;
  box-shadow: none !important;
}

/* Refresh icon RT animation (unused; rotation handled via JS) */
@keyframes rotate {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}
#refreshIcon {
  display: inline-block;
  transition: transform 0.1s linear;
}

/* ========================
   Footer / page frame
   ======================== */
#page-wrapper {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding-top: 56px;
  box-sizing: border-box;
}
#main-content,
#empty-dashboard {
  flex-grow: 1;
  flex-direction: column;
  z-index: 10002;
}
#initial-loader {
  z-index: 10001;
}

/* ========================
   Map modal
   ======================== */
#mapModal .modal-content {
  border-radius: 0 !important;
  z-index: 2000;
}
#mapModal .modal-header,
#mapModal .modal-footer {
  background: #f8f9fa;
}
#mapModal .modal-header {
  border-bottom: 1px solid #dee2e6;
}
#mapModal .modal-footer {
  border-top: 1px solid #dee2e6;
}
#mapModal .modal-title {
  font-weight: 600;
}
#mapModal .modal-body {
  height: 70vh !important;
  min-height: 320px;
  padding: 0 !important;
  position: relative;
}
#leaflet-map-container-modal {
  width: 100%;
  height: 100% !important;
  min-height: 320px;
  display: block !important;
  border-radius: 0 !important;
}
#map-spinner {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 480px;
  z-index: 2;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(255, 255, 255, 0.8);
}
#mapModal .modal-dialog {
  margin: auto;
  margin-top: 60px;
  max-width: 90vw;
  margin: 3vh auto;
}
#map-refresh-spinner {
  vertical-align: middle;
}
.modal-footer {
  justify-content: space-between;
}

.map-legend > div {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  white-space: nowrap;
}

#leaflet-map-inner {
  width: 100%;
  height: 100%;
  position: relative;
  pointer-events: auto;
}

/* Leaflet popups (compact) */
.leaflet-popup-content-wrapper {
  padding: 1px 1px;
  border-radius: 3px;
  font-size: 0.75rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  display: inline-block;
  margin-top: 4px;
}

/* Ensure map area is interactive */
#mapModal .modal-body,
#leaflet-map-inner,
.leaflet-container {
  pointer-events: auto !important;
  z-index: 10 !important;
}

/* Hide “Welcome” on small screens */
@media (max-width: 768px) {
  #welcome {
    display: none !important;
  }
}

/* Sticky header for server list */
#servers-header {
  position: sticky;
  top: 0;
  background-color: #f8f9fa;
  z-index: 9998;
  padding: 6px 12px;
  border-bottom: 1px solid #dee2e6;
  margin-left: 0;
  margin-right: 0;
}

/* Bottom toolbar for server list */
#servers-toolbar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 25% !important;
  height: 42px;
  background-color: #f8f9fa;
  border-top: 1px solid #dee2e6;
  padding: 6px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #212529;
  z-index: 999;
  margin-left: 8px;
  padding-right: 25px;
}

.toolbar-icon {
  font-size: 18px;
  color: #6c757d;
  cursor: pointer;
  padding: 4px;
  border-radius: 0 !important;
  transition:
    background-color 0.2s ease,
    color 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.toolbar-icon:hover {
  background-color: #e2e6ea;
  color: #343a40;
}
.toolbar-icon.active {
  background-color: #ced4da;
  color: #212529;
}

.toolbar-left,
.toolbar-right {
  display: flex;
  gap: 10px;
  align-items: center;
  color: #fff;
}

/* Compact vs default server list views */
#servers.compact-view .metric-block {
  display: none;
}
#servers:not(.compact-view) .mini-bar-group {
  display: none;
}

/* “Powered by” text */
.powered-by {
  font-size: 0.55rem;
  color: #212529 !important;
  user-select: none;
  line-height: 1;
}

/* Mini bars (compact view) */
.mini-bar-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}
.mini-bar-group {
  display: flex;
  gap: 6px;
  align-items: center;
}
.mini-bar {
  width: 40px;
  height: 6px;
  background-color: #e9ecef;
  border-radius: 3px;
  overflow: hidden;
}
.mini-bar-fill {
  height: 100%;
  border-radius: 3px;
  background-color: #0d6efd; /* default (OK) */
}
.mini-bar.warn .mini-bar-fill {
  background-color: #ffc107;
}
.mini-bar.crit .mini-bar-fill {
  background-color: #dc3545;
}

.mini-bar-labeled {
  display: flex;
  align-items: center;
  gap: 2px;
}
.mini-bar-labeled.align-right {
  margin-left: auto;
}
.mini-label,
.mini-value {
  font-size: 0.78rem;
  color: #6c757d;
  user-select: none;
  white-space: nowrap;
}

/* Compact view: wrapping on small screens */
#servers.compact-view .mini-bar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
#servers.compact-view .mini-bar-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1 1 auto;
  min-width: 0;
  order: 0;
  justify-content: flex-start;
}
#servers.compact-view .mini-bar-labeled.align-right {
  display: flex;
  align-items: center;
  white-space: nowrap;
  margin-left: auto;
  order: 1;
  flex-shrink: 0;
}
/* Hide “Seen” in compact view */
#servers.compact-view .mini-bar-labeled.align-right {
  display: none !important;
}

/* Responsive: collapse sidebar to full width on small screens */
@media (max-width: 768px) {
  #servers-wrapper,
  #servers-toolbar {
    width: 100% !important;
    min-width: 280px;
    max-width: none;
    position: relative;
    height: auto;
  }
  #servers-wrapper {
    top: 0 !important;
    padding-top: 0 !important;
    margin-top: 0 !important;
  }
  #main-content {
    margin-left: 0 !important;
    padding: 0 12px;
  }
  #main-content > .row {
    flex-wrap: wrap;
    gap: 0px;
  }
  #main-content > .row > .col-md-9 {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
  }
}

/* Make key modals float above all */
#mapModal,
#serverModal,
#profileModal,
#apiKeyModal,
#emailAlertModal {
  z-index: 11000 !important;
}

/* Compact server-details text */
.server-details p {
  font-size: 0.85rem;
  margin-bottom: 0.3rem;
  line-height: 1.2;
}
.server-details h6 {
  font-size: 1rem;
  margin-bottom: 0.6rem;
  padding-bottom: 0.2rem;
  border-bottom: none;
}
.server-details .col-md-4 {
  padding: 8px;
}
.card.compact-card {
  padding-top: 0.5rem;
  padding-right: 0.82rem;
  padding-bottom: 0.4rem;
  padding-left: 0.82rem;
}

/* Mobile details stack */
@media (max-width: 768px) {
  .server-details .row.text-start {
    flex-direction: column;
  }
  .server-details .col-md-4 {
    width: 100%;
    padding: 6px 12px;
  }
}

/* Copy tooltip + button (profile / empty state) */
.copy-tooltip {
  position: absolute;
  top: -28px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #198754; /* green */
  color: white;
  padding: 3px 8px;
  font-size: 0.75rem;
  border-radius: 3px;
  white-space: nowrap;
  opacity: 0;
  animation: fade-in 0.3s forwards;
  z-index: 9999;
  pointer-events: none;
}
.copy-btn {
  position: relative;
  padding: 4px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  line-height: 1;
}
.copy-icon {
  font-size: 18px;
  line-height: 1;
  display: inline-block;
}
.copy-tooltip.error {
  background-color: #dc3545; /* red */
}

@keyframes fade-in {
  to {
    opacity: 1;
  }
}
.fade-out {
  animation: fade-out 0.4s forwards;
}
@keyframes fade-out {
  to {
    opacity: 0;
    transform: translateX(-50%) translateY(-5px);
  }
}

/* Left column spinner (server list) */
.spinner-overlay-left {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 3000;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(255, 255, 255, 0.6);
  pointer-events: none;
}

/* Scrollbar (WebKit) */
::-webkit-scrollbar {
  width: 5px;
  height: 0px;
}
::-webkit-scrollbar-thumb {
  background-color: #ced4da;
  border-radius: 0;
}
::-webkit-scrollbar-track {
  background-color: #f1f1f1;
}

/* ========================
   Alerts dropdown
   ======================== */
.alert-dropdown {
  position: absolute;
  top: 60px;
  right: 120px;
  width: 500px;
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 0;
  z-index: 9999;
  max-height: 70vh;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  font-size: 0.92rem;
  display: none;
}

/* Colored left bar per alert severity */
.alert-left-bar {
  position: relative;
  background-color: #fff !important;
  color: #000;
  border: 1px solid #dee2e6;
  padding-left: 12px;
}
.alert-left-bar::before {
  content: '';
  position: absolute;
  top: -1px;
  left: -3px;
  width: 3px;
  height: calc(100% + 2px);
  background-color: #dc3545; /* default (danger) */
}
.alert-left-bar.alert-danger::before {
  background-color: #dc3545;
}
.alert-left-bar.alert-warning::before {
  background-color: #ffc107;
}
.alert-left-bar.alert-secondary::before {
  background-color: #0d6efd;
}

.alert-title {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
  color: #000;
  font-family:
    system-ui,
    -apple-system,
    'Segoe UI',
    Roboto,
    'Helvetica Neue',
    Arial,
    sans-serif;
}
.alert-description {
  font-size: 0.85rem;
  color: #6c757d;
}
.system-alerts-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  padding-top: 5px;
}

/* Dropdown header */
.alert-dropdown-header {
  padding: 10px 12px;
  font-weight: 600;
  border-bottom: 1px solid #dee2e6;
  background: #f8f9fa;
  position: sticky;
  top: 0;
  z-index: 1;
  gap: 6px;
}

.alert-dropdown-header span {
  flex-grow: 1;
}

/* Alerts list (scrollable) */
.alert-dropdown-list {
  position: relative;
  max-height: 440px; /* 500px minus navbar */
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 0;
}
.alert-dropdown-list .alert {
  padding: 4px 6px;
  margin-bottom: 4px;
  border-radius: 0;
  line-height: 1.2;
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: relative;
}

/* Dismiss button inside alert row */
.ns-alert-dismiss {
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 16px;
  background: transparent;
  border: none;
  color: #6c757d;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.ns-alert-dismiss:hover {
  color: #000;
}

/* Section holding actual alerts */
#alert-items {
  padding-left: 8px;
  padding-right: 8px;
  padding-top: 8px;
  border: none !important;
}

/* Empty state inside dropdown */
.ns-alert-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 500;
  text-align: center;
  margin-bottom: 12px;
}
.ns-alert-empty .material-icons {
  font-size: 20px;
  color: #0d6efd;
  margin-right: 6px;
}

/* Centered loading / info slot */
.spinner-box {
  flex-grow: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 0.9rem;
  color: #6c757d;
}
.spinner-box.d-none,
.alert-empty-message.d-none {
  display: none !important;
}

/* Badge on the bell icon */
#alertIcon {
  position: relative;
}
#alertIcon::after {
  content: attr(data-count);
  position: absolute;
  top: -6px;
  right: -4px;
  color: #ff0000;
  font-size: 12px;
  font-weight: bold;
  font-family: sans-serif !important;
  display: none;
}
#alertIcon[data-count]:not([data-count='0'])::after {
  display: inline;
}

/* Modal spinners + dimming */
.ns-modal-spinner {
  text-align: center;
  padding: 2rem;
}
.ns-modal-dim {
  opacity: 0.5;
  pointer-events: none;
}
#profileModalSpinner {
  z-index: 10;
}
.modal-body {
  position: relative;
}

/* Alerts list minimum height */
#alert-list {
  min-height: 60px;
}

/* Overlay spinner positioned to the list’s viewport (JS sets rect) */
#alert-spinner {
  position: fixed; /* kept fixed; JS sets size/pos */
  width: 0;
  height: 0; /* start collapsed; prevents reflows */
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 9999;
  visibility: hidden;
  opacity: 0;
}
#alert-spinner.visible {
  visibility: visible;
  opacity: 1;
}
#alert-spinner > * {
  margin: 0 !important;
}
#alert-spinner.is-fixed {
  position: fixed;
} /* explicit label */
#alert-spinner.active {
  display: flex;
}

.alert-content-hidden {
  visibility: hidden;
}
#alert-scroll-spinner {
  display: flex;
  justify-content: center;
  padding: 8px 0 12px;
  position: sticky;
  bottom: 0;
  background: transparent;
}
#alert-scroll-spinner.d-none {
  display: none;
}

/* Hide list content and bottom spinner while overlay is visible */
#alert-list.overlay-active .alert-content-hidden {
  visibility: hidden;
}
#alert-list.overlay-active #alert-scroll-spinner {
  display: none !important;
}

/* --- Non-selectable toolbar/list icons --- */
.material-icons,
.ns-icon,
#alertIcon,
#alert-toggle-icon,
#view-default,
#view-compact {
  user-select: none;
  -webkit-user-select: none; /* Safari/iOS */
  -ms-user-select: none;
  -moz-user-select: none;
  -webkit-touch-callout: none; /* Disable "Copy/Define" balloon on iOS */
  -webkit-tap-highlight-color: transparent; /* Remove tap highlight on mobile */
}

/* Fallback: if the browser still renders selection, make it transparent */
.material-icons::selection,
.material-icons::-moz-selection,
.ns-icon::selection,
.ns-icon::-moz-selection {
  background: transparent;
}

/* Optionally – remove ugly focus outline when clicking with mouse,
   but keep it visible for keyboard navigation (a11y) */
.ns-icon:focus {
  outline: none;
}
.ns-icon:focus-visible {
  outline: 2px solid #0d6efd;
  outline-offset: 2px;
}

/* By defulat navi hidden on boot */
.boot-hide {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

/* After start smooth show */
.boot-show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

@media (max-width: 767px) {
  .alert-dropdown {
    right: 12px !important;
    left: auto !important;
    width: 92vw !important; /* opcjonalnie, aby nie wychodziło poza ekran */
    max-width: 480px; /* bezpieczna szerokość */
  }
}
@media (max-width: 767px) {
  #profileModal .modal-dialog {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 95vw !important;
    max-width: 95vw !important;
    margin: 0 !important;
    z-index: 9999;
  }

  #profileModal .modal-content {
    max-height: 90vh !important;
    width: 100%;
  }

  #profileModal .modal-body {
    max-height: 60vh !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 100px !important;
  }

  #profileModal .modal-footer {
    background: #f8f9fa !important;
    padding: 12px !important;
    border-top: 1px solid #dee2e6;
  }
}
/* Remove rounded corners from Flatpickr calendar */
.flatpickr-calendar,
.flatpickr-day,
.flatpickr-monthDropdown-months,
.flatpickr-current-month,
.flatpickr-time,
.flatpickr-time input,
.flatpickr-time .flatpickr-am-pm,
.flatpickr-weekday {
  border-radius: 0 !important;
}

/* --- Flatpickr arrow color fix (NodeSniff theme) --- */
.flatpickr-prev-month svg,
.flatpickr-next-month svg {
  fill: #6c757d !important; /* neutral gray */
  transition: fill 0.2s ease;
}

.flatpickr-day.today {
  border-color: #0d6efd !important;
}

.flatpickr-day:hover {
  background-color: #f8f9fa !important;
  color: #212529 !important;
}

.flatpickr-prev-month:hover svg,
.flatpickr-next-month:hover svg {
  fill: #0d6efd !important; /* NodeSniff blue on hover */
}

/* Optional: make month/year text consistent */
.flatpickr-current-month input.cur-year,
.flatpickr-current-month .cur-month {
  color: #212529 !important;
  font-weight: 500;
}
.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange,
.flatpickr-day.selected.inRange,
.flatpickr-day.selected.nextMonthDay,
.flatpickr-day.selected.prevMonthDay {
  background-color: #0d6efd !important;
  border-color: #0d6efd !important;
  color: #fff !important;
}

/* --- Add border highlight on hover for unselected days --- */
.flatpickr-day:not(.selected):hover {
  border: #f8f9fa !important; /* NodeSniff blue */
  background-color: #f8f9fa !important; /* keep white background */
  color: #000 !important;
}

.ns-truncate {
  max-width: 100%;
  display: inline-block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
}

.proc-nowrap {
  white-space: nowrap !important;
}
