/* assets/css/style.css */

/* ===================================== */
/* ========== Basislayout ============= */
/* ===================================== */

html, body {
  height: 100%;
  margin: 0;
  overflow-x: hidden;
  font-family: system-ui, sans-serif;
  background: #f8f9fa;
}

body > .d-flex {
  height: 100dvh;
  display: flex;
  flex-direction: row;
  overflow: hidden;
}

/* =============================== */
/* === Dezente Scrollbar CSS ==== */
/* =============================== */

/* Chrome, Edge, Safari */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: #f8f9fa;
}

::-webkit-scrollbar-thumb {
  background-color: #ced4da; /* leichtes Grau wie in Hover-Zuständen */
  border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
  background-color: #adb5bd; /* etwas dunkleres Grau */
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: #ced4da #f8f9fa;
}

/* ===================================== */
/* ========== Sidebar ================= */
/* ===================================== */

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 250px;
  min-width: 250px;
  background-color: #dee2e6;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow-y: auto;
  padding-bottom: 1rem;
  z-index: 1000;
}

.sidebar.collapsed {
  width: 74px;
  min-width: 74px;
  padding: 0.5rem 0.25rem;
  padding-bottom: 1rem;
  overflow-x: hidden;
  overflow-y: auto;
}


/* ========== Sidebar Header ========== */

.sidebar-header {
  text-align: center;
  margin-bottom: 1.5rem;
  height: 85px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
}

.sidebar.collapsed .sidebar-header img {
  width: 40px;
  height: auto;
  margin-top: 2.5rem;
}

.sidebar.collapsed .sidebar-header h4 {
  display: none;
}

.sidebar.collapsed .sidebar-stammdaten-label {
  display: none !important;
}

/* ========== Sidebar Footer ========== */

.sidebar footer {
  margin-top: auto;
  text-align: center;
  font-size: 0.75rem;
  padding: 0.75rem;
}


/* ===================================== */
/* ========== Navigation ============== */
/* ===================================== */

.nav-list {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  padding-left: 0;
  list-style: none;
  margin: 0;
  overflow-y: auto;
}

.nav-list li {
  margin: 0 0 0.75rem 0;
}

.nav-list li a,
.sidebar .nav-link {
  text-decoration: none;
  color: #000;
  display: flex;
  align-items: center;
  padding: 0.5rem 0rem;
  padding-left: 12px;
  gap: 8px;
  border-radius: 0.25rem;
}

.nav-list li a span,
.sidebar .nav-link span {
  margin-left: 0;
}

.nav-list li a.active,
.sidebar .nav-link.active {
  font-weight: bold;
  color: #2596be;
  background-color: #e9ecef;
  box-shadow: inset 2px 0 0 #2596be;
}

.nav-list li a:hover,
.sidebar .nav-link:hover {
  color: #0d6efd;
  background-color: #ced4da;
  text-decoration: none;
  box-shadow: inset 2px 0 0 #2596be;
}

.nav-list li.logout {
  margin-top: auto;
}


/* ========== Accordion (Stammdaten & Extras) ========== */

.accordion-button {
  background-color: transparent !important;
  color: #000;
  box-shadow: none;
  padding-left: 12px;
  border-radius: 0.25rem;
}

.accordion-button:hover {
  background-color: #ced4da !important;
  color: #0d6efd !important;
  box-shadow: inset 2px 0 0 #2596be !important;
}

.accordion-button:not(.collapsed) {
  background-color: #f1f3f5 !important;
  color: #2596be;
  font-weight: bold;
  box-shadow: inset 2px 0 0 #2596be !important;
}

.accordion-button:not(.collapsed):hover {
  background-color: #ced4da !important;
  color: #0d6efd !important;
  box-shadow: inset 2px 0 0 #2596be !important;
}

.accordion-item {
  background-color: transparent;
  border: none;
}

/* ========== Nav-Titel ========== */

.nav-title {
  font-weight: bold;
  color: #495057;
  margin: 1rem 0 0.5rem 0.5rem;
  text-transform: uppercase;
  font-size: 0.85rem;
  user-select: none;
}


/* ========== Collapse-Verhalten ====== */

.sidebar.collapsed .nav-list li a {
  text-align: center;
  padding: 0.5rem;
  font-size: 1.25rem;
}

.sidebar.collapsed .accordion-button span:not(.accordion-icon) {
  display: none !important;
}

.sidebar.collapsed .nav-list li a span,
.sidebar.collapsed .nav-title {
  display: none !important;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Leeren Platz nur im collapsed-Modus */
.sidebar.collapsed .nav-title::before {
  content: '';
  display: block;
  height: 1.5rem;
}

.sidebar.collapsed .nav-title {
  display: block !important;
  height: 0;
  margin: 0;
  padding: 0;
  font-size: 0;
  overflow: hidden;
  color: transparent;
}


/* ===================================== */
/* ========== Hauptinhalt ============= */
/* ===================================== */

main {
  margin-left: 250px;
  height: 100dvh;
  overflow-y: auto;
  flex-grow: 1;
  padding: 1rem 2rem;
}

main.collapsed {
  margin-left: 60px;
}

/* ========== Spaltenbreite ausser Dashboard ========== */

/* Bisherige Regeln für alle außer dashboard/shopping/print */
body:is(:not(.dashboard):not(.shopping):not(.print)) th:nth-child(1),
body:is(:not(.dashboard):not(.shopping):not(.print)) td:nth-child(1) {
  width: 75%;
}

body:is(:not(.dashboard):not(.shopping):not(.print)) th:nth-child(2),
body:is(:not(.dashboard):not(.shopping):not(.print)) td:nth-child(2),
body:is(:not(.dashboard):not(.shopping):not(.print)) th:nth-child(3),
body:is(:not(.dashboard):not(.shopping):not(.print)) td:nth-child(3) {
  width: 10%;
  text-align: center;
}

body:is(:not(.dashboard):not(.shopping):not(.print)) th:nth-child(4),
body:is(:not(.dashboard):not(.shopping):not(.print)) td:nth-child(4),
body:is(:not(.dashboard):not(.shopping):not(.print)) th:nth-child(5),
body:is(:not(.dashboard):not(.shopping):not(.print)) td:nth-child(5) {
  width: 10%;
  text-align: center;
}

/* Neu für print.php */
body.print {
  --column-count:
}

body.print th:nth-child(1),
body.print td:nth-child(1) {
  width: 5%;
  text-align: center;
}

body.print th:nth-child(2),
body.print td:nth-child(2) {
  width: 25%;
  text-align: left;
}

/* Spalten 3 bis 8 alle gleich breit */
body.print th:nth-child(n+3):nth-child(-n+8),
body.print td:nth-child(n+3):nth-child(-n+8) {
  width: calc(70% / 6);
  text-align: center;
}

/* ===================================== */
/* ========== Statistik =========== */
/* ===================================== */

/* Eingabefelder innerhalb der Tabs auf max. 60% Breite beschränken */
.tab-pane input.form-control[type="search"] {
  width: 40%;
  max-width: 100%;
  min-width: 200px;
  margin-left: auto;
  margin-right: auto;
  display: block;
}

/* Hover für die Tabellen */
.list-group-item.unit-item:hover {
  background-color: #cfe2ff;
  cursor: default;
}
.list-group-item.location-item:hover {
  background-color: #d1e7dd;
  cursor: default;
}



/* ===================================== */
/* ========== Toggle-Button =========== */
/* ===================================== */

#sidebarToggle {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 1030;
  padding: 6px 10px;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid #5a9df9;
  background-color: transparent;
  color: #0d6efd;
}

#sidebarToggle:hover {
  background-color: #0d6efd;
  color: white;
  border-color: #0d6efd;
}

/* ===================================== */
/* ========== Formulare / Inputs ======= */
/* ===================================== */

.optional-field select,
.optional-field input {
  background-color: #fff8dc;
  border-color: #ffeb3b;
}

/* ===================================== */
/* ========== Login-Bereich =========== */
/* ===================================== */

.login-box {
  max-width: 400px;
  margin: 8% auto;
  padding: 2rem;
  background: #fff;
  border-radius: 0.75rem;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
  text-align: center;
}

.login-box img {
  margin-bottom: 1rem;
}

/* ===================================== */
/* ========== Diverses =========== */
/* ===================================== */

/* ========== Responsive für Charts ========== */
canvas {
  min-height: 300px;
}

/* ========== Hover bei Tabellenzeilen ========== */
.custom-hover tbody tr:hover td {
  background-color: #e9f7ff !important;
  transition: background-color 0.2s ease-in-out;
}
/* ========== Verhindert beim Hover über die Zeile, dass MHD die Farbe verliert ========== */
/* Initiale Farben (dezent) */
td.bg-danger {
  background-color: #f8d7da !important; /* Helles Rot */
  color: #842029 !important; /* Dunkler Rotton für Text */
  font-weight: bold;
  transition: background-color 0.3s ease;
}

td.bg-success {
  background-color: #d1e7dd !important; /* Helles Grün */
  color: #0f5132 !important; /* Dunkler Grünton für Text */
  font-weight: bold;
  transition: background-color 0.3s ease;
}

/* Hover Farben */
.custom-hover tbody tr:hover td.bg-danger {
  background-color: #f5c2c7 !important; /* Etwas dunkleres Pastellrot */
  color: #6f1a1f !important;
}

.table tbody tr:hover td.bg-danger {
  background-color: #e4a0a7 !important; /* Noch dunkler beim Hover */
  color: #5c141a !important;
}

.custom-hover tbody tr:hover td.bg-success {
  background-color: #a3cfbb !important; /* Etwas dunkleres Pastellgrün */
  color: #0b2e17 !important;
}

.table tbody tr:hover td.bg-success {
  background-color: #7bb590 !important; /* Noch dunkler beim Hover */
  color: #06411a !important;
}