/* ========================================
   TARVIS CSS – Kapitelübersicht
========================================
   1. Design-Variablen (:root)
   2. Grundlayout (html, body)
   3. Header & Footer
   4. Inhaltsbereiche (Content, Wrapper)
   5. Loginbereich
   6. Sidebar (Main, Help, Profil)
   7. Globale Box / Card-Struktur
   8. Spaltensystem (.row / .col-*)
   9. Formulare & Buttons
  10. Responsive Verhalten (Media Queries)
======================================== */


/* ========================================
   1. Design-Variablen (:root)
======================================== */
:root {
  /* Farben */
  --color-main: #2A4FAC;
  --color-accent: #446bd2;
  --color-bg: #E6E9F0;
  --color-white: #fff;
  --color-text: #232629;
  --color-gray: #666;

/* Akzentfarbe Türkis Sidebbar Icon Button */
  --color-turquoise: #00d9e0;

  /* Schrift & Layout */
  --font-base: 'Verdana', Arial, sans-serif;
  --radius-md: 0.2rem;
  --shadow-soft: 0 2px 8px rgba(42, 79, 172, 0.5);

  /* Spalten- und Formsystem */
  --gap: 1rem;
  --col-gap: 1.5rem;

  --input-bg: #fff;
  --input-border: #ccc;

  --button-bg: #E0E0E0;
  --button-hover: #CCCCCC;
  --button-text: #000;
}

/* ========================================
   2. Grundlayout (Body, Scroll, Schrift)
======================================== */
html, body {
  font-family: var(--font-base);
  color: var(--color-text);
  background-color: var(--color-bg);
  font-size: 16px;
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: auto;
  overflow-x: hidden;
  line-height: 1.6;
}


/* ========================================
   3. Header & Footer – Layout & Farben
======================================== */
.top-header {
  background-color: var(--color-main); /* Feste Hauptfarbe */
  color: var(--color-white);
  padding: 1em;
  display: flex;
  align-items: center;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
}

.bottom-footer {
  background-color: var(--color-main);
  color: var(--color-white);
  text-align: center;
  font-size: 0.8em;
  padding: 1em;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
}

.bottom-footer a {
  color: #fff;
  text-decoration: none;
  margin: 0 5px;
}
.bottom-footer a:hover {
  text-decoration: underline;
}

.footer-copy {
  margin-top: 0.7em;
}

.logo-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 10px;
}

.logo-box img {
  height: 40px;
  margin-right: 5px;
}

.logo-title {
  font-size: 1.4em;
  font-weight: bold;
  color: white;
}


/* ========================================
   4. Inhaltsbereiche (Content, Wrapper)
======================================== */
.main-area {
  flex: 1;
  padding: 0 1em 4em;
  overflow-y: auto;
  position: relative;
  z-index: 1; /* Profilmenü kann überlappen */
}

.content-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin-left: 250px; /* Sidebar-Breite berücksichtigen */
  height: auto;
  z-index: 1;
}


/* ========================================
   5. Loginbereich (zentriert, modern)
======================================== */
.login-center {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
}

.login-outer-box {
  background-color: var(--color-main);
  padding: 2.5em;
  border-radius: 10px;
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.15);
}

.login-inner-box {
  width: 360px;
  min-height: 320px;
}

.login-button.final {
  width: 100%;
  padding: 10px;
  background: #E0E0E0;
  border: none;
  color: black;
  font-size: 1em;
  border-radius: 5px;
  cursor: pointer;
}
.login-button.final:hover {
  background: #CCCCCC;
}

.login-title.white {
  color: white;
  text-align: center;
  margin-bottom: 20px;
}

.login-error {
  color: red;
  text-align: center;
  margin-top: 10px;
}

#forgot-password {
  margin-top: 10px;
  font-size: 0.85em;
  text-align: center;
}

#forgot-password a {
  color: white;
  text-decoration: underline;
}


/* ========================================
   6. Sidebar – Navigation, Help, Profil
======================================== */
.sidebar {
  width: 250px;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  background-color: var(--color-main);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding-top: 20px;
  z-index: 2000;
}

.sidebar ul {
  list-style: none;
  margin-top: 5px;
  padding: 0 20px 0 5px;
  flex-grow: 1;
}

.sidebar li {
  margin-bottom: 10px;
}

.sidebar a {
  display: flex;
  align-items: center;
  padding: 10px;
  height: 30px;
  font-size: 14px;
  box-sizing: border-box;
  color: #fff;
  text-decoration: none;
  border-radius: 5px;
  transition: background-color 0.2s ease;
}

.sidebar a:hover {
  background-color: var(--color-accent);
}

.sidebar a svg {
  margin-right: 10px;
  width: 20px;
  height: 20px;
  stroke-width: 1.8;
  flex-shrink: 0;
  color: var(--color-turquoise);
}

.link-text {
  position: relative;
  top: -2px;
}

.sidebar .logo-image-large,
.sidebar .logo-image-small {
  margin-top: -10px;
}

/* ========================================
   6.1 Sidebar – TOGGLE
======================================== */

.sidebar-toggle-button {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 25px;
  height: 30px;
  background-color: var(--color-main);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 0 5px 5px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1em;
  cursor: pointer;
  box-shadow: 0 0 5px rgba(0,0,0,0.2);
  z-index: 3000;
}

.sidebar-toggle-button:hover {
  background-color: #3B64D8;
}

/* ========================================
   6.2 Sidebar – Help
======================================== */

/* Help-Menü in Sidebar */
.dropdown-arrow {
  margin-left: auto;
  margin-right: 5px;
  width: 16px;
  height: 16px;
}

.help-chevron svg {
  stroke: #FFF !important;
}

.sidebar .help-chevron {
  width: 16px;
  height: 16px;
  margin-left: auto;
}

.sidebar-submenu {
  list-style: none;
  margin: 0;
  padding-left: 20px;
}

.sidebar-submenu li a {
  display: flex;
  align-items: center;
  font-size: 14px;
  color: #fff;
  text-decoration: none;
  padding: 8px 10px;
  gap: 10px;
}

.sidebar-submenu li a:hover {
  background-color: var(--color-accent);
  border-radius: 5px;
}

.sidebar-submenu i {
  width: 18px;
  height: 18px;
  stroke-width: 1.8;
  flex-shrink: 0;
}

.sidebar-scroll {
  flex-grow: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-fixed-bottom {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

/* ========================================
   6.3 Sidebar – Profil
======================================== */

/* Profilmenü unten */
.sidebar-userbar {
  position: relative;
  bottom: 0;
  width: 100%;
  padding: 10px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid #ccc;
  background-color: inherit;
  box-sizing: border-box;
  z-index: 3000;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid #fff;
  object-fit: cover;
  flex-shrink: 0;
}

.user-name {
  flex-grow: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 14px;
  color: #FFF;
}

.user-menu-toggle {
  background: none;
  border-radius: 6px;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  color: #FFF;
}

.user-menu-toggle:hover {
  background-color: #3B64D8;
}

.profile-dropdown {
  position: fixed;
  bottom: 52px;
  left: 200px;
  background-color: #26469e;
  border: 1px solid #ccc;
  border-radius: 6px;
  box-shadow: inset -0.5 -0.5px 0 #ccc;
  width: 120px;
  padding: 6px 0;
  display: none;
  z-index: 3000;
}

.profile-dropdown::after {
  content: "";
  position: absolute;
  bottom: -12px;
  left: 10px;
  border-width: 6px;
  border-style: solid;
  border-color: #ccc transparent transparent transparent;
}

.profile-dropdown a {
  display: block;
  padding: 8px 16px;
  font-size: 14px;
  color: #FFF;
  text-decoration: none;
}

.profile-dropdown a:hover {
  background-color: #3B64D8;
}

/* ========================================
   7. Globale Box / Card-Struktur
======================================== */

.card {
  background-color: var(--color-white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  padding: 1.25rem;
  margin-bottom: 0rem;
  border: 1px solid rgba(42, 79, 172, 0.30);
  padding-top: 1.25rem;
  padding-right: 1.25rem;
  padding-left: 1.25rem;
  padding-bottom: 0.7rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
}

.card h3 {
  margin-top: -10px;                      /* Obere Außenabstände entfernen */
  margin-bottom: 0.5rem;                /* Unten genug Abstand lassen */
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--color-main);
  display: flex;
  align-items: center;
}

.card h3 i,
.card h3 [data-lucide] {
  margin-right: 0.50rem;           /* Vergrößert den Abstand zwischen Icon und Text */
}

/* ========================================
   7.1 Icon Farbvarianten
======================================== */

.icon-light {
  color: var(--color-white); /* für dunkle Hintergründe */
  
}

.icon-dark {
  color: var(--color-main);  /* für helle Hintergründe (Blau) */
}


/* ========================================
   8. Spaltensystem (.row / .col-*)
======================================== */
.row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--col-gap);
  margin-top: 1rem;
  margin-bottom: 1rem;
  align-items: stretch; /* Kinder nehmen gleiche Höhe */
}

.row:not(:last-of-type) {
  border-bottom: 2px solid rgba(42, 79, 172, 0.20); /* TARVIS-Blau mit 15% Sichtbarkeit */
  margin-bottom: 1rem;
  padding-bottom: 1rem;
}

.row > .col-2 {
  display: flex;
  flex-direction: column;
}

.row > .col-2 > .card {
  flex: 1; /* nimmt volle verfügbare Höhe */
  display: flex;
  flex-direction: column;
}

.row > .col-3 {
  display: flex;
  flex-direction: column;
  align-items: stretch; /* Verhindert, dass die Boxen unterschiedliche Höhen haben */
}

.row > .col-3 > .card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%; /* Setzt die Höhe der Box auf 100% */
}

.col-1 {
  flex: 1 1 100%;
  min-width: 100%;
}

.col-2 {
  flex: 1 1 calc(50% - var(--col-gap));
  min-width: 280px;
}

.col-3 {
  flex: 1 1 calc(33.33% - var(--col-gap));
  min-width: 180px;
}

.col-4 {
  flex: 1 1 calc(25% - var(--col-gap));
  min-width: 140px;                        /* kleiner als vorher, damit 4 Spalten reinpassen */
}

.col-5 {
  flex: 1 1 calc(20% - var(--col-gap));
  min-width: 110px;
}

.row > [class^="col-"] {
  display: flex;
  flex-direction: column;
}

.row > [class^="col-"] > .card {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* ========================================
   8.1 Spaltensystem Links
======================================== */

.card p.mt-2.text-sm a {
  font-size: 0.85rem;           /* kleinere Schrift */
  text-decoration: none;        /* kein Unterstrich */
  color: var(--color-main);     /* Farbe bleibt passend */
  font-weight: bold;       /* fett */
  cursor: pointer;              /* Zeigt, dass es klickbar ist */
}

.card p.mt-2.text-sm a:hover {
  text-decoration: underline;    /* Unterstrich nur beim Hover */
}



/* ========================================
   9. Formulare & Buttons
======================================== */
.form {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap);
  padding: 0;
  margin: 0;
  background: none;
  border: none;
  box-shadow: none;
}

.input,
  select.input,
  textarea.input {
  flex: 0 0 auto;
  align-self: stretch;  width: 100%;
  padding: 0.4rem 0.6rem;
  font-size: 0.9rem;
  line-height: 1.0rem;
  height: auto;                           /* statt 42px !important */
  box-sizing: border-box;
  border: 1px solid rgba(42, 79, 172, 0.50); /* extrem dezent */  
  border-radius: var(--radius-md);    /* ? Nur die Rundung bleibt */
  box-shadow: none !important;        /* ? Kein innerer Schatten */
  outline: none !important;           /* ? Kein Fokus-Rahmen */
  box-shadow: none !important;
  outline: none !important;
  margin: 6px 0;
  display: block;
  flex: 0 0 auto;
  align-self: flex-start;
}

.input-row {
  display: flex;
  gap: var(--gap);
  flex-wrap: nowrap;
}

.input-row .input {
  flex: 1 1 auto;
  min-width: 150px;
}

input:focus,
select:focus,
textarea:focus {
  box-shadow: none !important;
  outline: none !important;
  border-color: var(--color-main); /* optional: TARVIS-Blau als aktiver Rand */
}

/* Autofill-Schatten in Chrome komplett entfernen */
input:-webkit-autofill,
input:-webkit-autofill:focus {
  box-shadow: 0 0 0 1000px white inset !important;
  -webkit-box-shadow: 0 0 0 1000px white inset !important;
  -webkit-text-fill-color: #000 !important;
}

.button-light {
  padding: 0.5rem 1.2rem;
  font-size: 1em;
  color: var(--color-white);
  background-color: var(--color-main); /* dunkle Farbe */
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background-color 0.2s ease;
  max-width: 200px;
  align-self: flex-start;
  width: 100%;            /* optional für Responsiveness */
  margin-top: auto;
}

.button-light:hover {
  background-color: var(--color-accent);
}

.button-dark {
  padding: 0.5rem 1.2rem;
  font-size: 1em;
  color: var(--button-text);
  background-color: var(--button-bg); /* helle Farbe */
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background-color 0.2s ease;
  max-width: 200px;
  align-self: flex-start;
  width: 100%;            /* optional für Responsiveness */
  margin-top: auto;
}

.button-dark:hover {
  background-color: var(--button-hover);
}

.button-row {
  margin-top: -0.9rem; /* Weniger Abstand nach oben */
}

.table-link {
  cursor: pointer;
  display: inline-block;
  padding: 0.3em 0.5em;
  border-radius: 5px;
  transition: background-color 0.2s ease;
  color: #2A4FAC;
  font-weight: bold;
}

.table-link:hover {
  background-color: #D1D9E6;
}


#create-user-form {
  display: flex;
  flex-direction: column; /* Stapelt Input und Button vertikal */
  flex-wrap: rap;
  gap: var(--gap);
  align-items: flex-start;
}

#create-user-form input {
  flex: 1 1 auto;
  min-width: 150px;
}

#create-user-form button {
  flex: 0 0 auto;
  white-space: nowrap;
}

#create-group-form {
  display: flex;
  flex-direction: column; /* Stapelt Input und Button vertikal */
  flex-wrap: rap;
  gap: var(--gap);
  align-items: flex-start;
}

#create-group-form input {
  flex: 1 1 auto;
  min-width: 150px;
}

#create-group-form button {
  flex: 0 0 auto;
  white-space: nowrap;
}

#table-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0;
  list-style: none;
}

#table-list li {
  background-color: var(--color-white);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-weight: bold;
  color: var(--color-main);
  transition: background-color 0.2s ease;
}

#table-list li:hover {
  background-color: var(--color-accent);
  color: white;
}

#table-content {
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  padding-bottom: 8px;
}

#table-content table {
  border-collapse: separate !important;
  border-spacing: 5px 5px;
  width: max-content;
  min-width: 100%;
  white-space: nowrap;
}

#table-content td:empty::after {
  content: "\00a0"; /* non-breaking space */
  visibility: hidden;
}

td[contenteditable="true"] {
  background-color: #fdfde9;
  border: 1px dashed #999;
  padding: 4px;
}

td.saving {
  background-color: #fff3cd !important;
}

td.saved {
  background-color: #d4edda !important;
  transition: background-color 0.5s;
}

td.error {
  background-color: #f8d7da !important;
  transition: background-color 0.5s;
}

/* ========================================
   10. Responsive Verhalten (Media Queries)
======================================== */

@media (max-width: 768px) {
  /* ... deine bisherigen Regeln ... */

  /* Sicherstellen, dass Sidebar über allem liegt und volle Höhe hat */
  .sidebar {
    position: fixed !important;
    top: 0;
    bottom: 0;
    
    overflow-y: auto;
    max-width: 300px; /* Optional, maximale Breite */
  }
    
  /* Eventuell Hintergrund-Overlay für Sidebar */
  .sidebar-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 2999;
    display: none;
  }

  .sidebar.active + .sidebar-overlay {
    display: block;
  }
}

@media (max-width: 480px) {
  .login-outer-box {
    padding: 1.5em;
  }

  .login-inner-box {
    width: 100%;
  }

  .col-2, .col-3, .col-4, .col-5 {
    flex-basis: 100% !important;
    min-width: 0 !important;
  }
}

/* ========================================
   ? ENDE DER CSS – Erweiterungen darunter bitte abtrennen
======================================== */