/************************************
 * SHINY / ADMINLTE: SIDEBAR STYLES
 * Skin: .skin-blue
 * Hinweise:
 * - Farb-Variablen stammen aus :root (z. B. --header-color, --active-color, --shadow, --border-color)
 * - Desktop-Standard oben, responsive Off-Canvas unten in Media Queries
 ************************************/

/* ----------------------------------
   1) Grundlayout & Typo
---------------------------------- */

/* Haupt-Sidebar (Desktop-Standard) */
.skin-blue .main-sidebar {
  /* Position/Box */
  margin-top: 96px;                         /* Höhe Header einkalkulieren */
  min-height: calc(100% - 106px);           /* volle Höhe minus Header/Padding */
  left: 10px;
  width: 14vw;                               /* flexible Breite (wird im Off-Canvas überschrieben) */
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: auto;
  z-index: 1000;

  /* Layout/Typo */
  display: flex;
  flex-direction: column;
  font-family: "Roboto", sans-serif;
  font-size: 1rem;

  /* Farben */
  padding-top: 0;
  background-color: var(--header-color);     /* Sidebar-Hintergrundfarbe */
}

/* Basis-Links in der Sidebar */
.skin-blue .sidebar a {
  color: #fff !important;  /* Weiße Links */
  font-size: 1.1rem;
  line-height: 1.3;
  padding: 6px 15px !important;
  text-decoration: none;
}

/* Sidebar-Menü: Top-Level-Links */
.skin-blue .sidebar-menu > li > a {
  border-left: none;
}

.main-sidebar .user-panel, .sidebar-menu, .sidebar-menu > li.header{
  white-space: nowrap;
  overflow: hidden;
  overflow: auto;
  height: calc(100vh - 15vh);
}

/* Treeview: Top-Level-Links mit Icon-Pfeil */
.skin-blue .sidebar-menu > li.treeview > a {
  padding-left: 16px;                         /* Abstand für Treeview-Links */
}

/* Aktiver/Hover-Zustand Top-Level */
.skin-blue .sidebar-menu > li.active > a,
.skin-blue .sidebar-menu > li:hover > a {
  background-color: var(--active-color);
  border-left-color: var(--active-color);
}

/* Erste Menüzeile: abgerundete Ecken (nur Desktop) */
.skin-blue .sidebar-menu > li.active:nth-child(1) > a,
.skin-blue .sidebar-menu > li:hover:nth-child(1) > a {
  border-top-right-radius: 12px;
  border-top-left-radius: 12px;
}

/* Treeview: Untermenü-Links */
.sidebar-menu .treeview-menu {
  padding: 0;
}

.skin-blue .treeview-menu > li > a:hover {
  background-color: var(--active-color);
  border-left: 8px solid var(--active-color);
  transition: padding-left 1s ease;
  padding-left: 15px;
}

/* Aktiver Unterpunkt */
.sidebar-menu .treeview-menu > li.active > a {
  background-color: var(--active-color);
  border-left: 10px solid var(--border-color);
  padding-left: 20px;
}

/* Pfeil rechts ausrichten */
.sidebar-menu li > a > .fa-angle-left {
  right: 0;
}

/* Langes Wort in erstem Eintrag umbrechen */
.treeview-menu li:nth-child(1) a {
  display: block;
  white-space: normal;
  word-wrap: break-word;
}

/* Sidebar-Unterstreichungen / Gruppen */
.sidebar-group {
  border-top: 1px solid #ffffff55;
  margin-top: 10px;
  padding-top: 10px;
}

.sidebar_themen_ergebnisse span {
  font-size: 1rem;
  margin-left: 10px;
}

.sidebar_studie {
  border-bottom: 1px solid #ffffff;
}

.sidebar_ergebnisse {
  border-bottom: 2px solid #ffffff;
}

.sidebar_presse {
  border-top: 1px solid #ffffff;
}

.skin-blue .sidebar-menu > li > .treeview-menu{
border-top-style: solid;
  border-top-width: 1px;
  border-bottom-width: 1px;
  border-bottom-style: solid;
  background: #3967d7;
}


/* Kleinere Typo-Anpassungen in Menüs */
.sidebar-menu p {
  margin: 5px 10px;
  font-size: 1.1rem;
}

.sidebar-menu .treeview-menu > li > a {
  font-size: 1rem;
}

/* Deaktivierter/Platzhalter-Tab */
.sidebar-menu > li > a[tabname='NULL'] {
  font-weight: bold;
  color: #ffffff;
  background-color: #1A237E;
  cursor: default;
}

/* ----------------------------------
   2) Fixe Links am unteren Rand
---------------------------------- */

.fixed-bottom-links {
  width: 100%;
  margin: 0;
}

.fixed-bottom-links li {
  list-style: none;
}

.fixed-bottom-links a {
  display: block;
  padding: 5px 15px !important;
  color: #ffffff;
  text-decoration: none;
}

.fixed-bottom-links > li > a {
  font-size: 0.9rem !important;
}

.fixed-bottom-links a:hover {
  background-color: var(--active-color);
  border-left-color: var(--active-color);
}



/* ----------------------------------
   3) Responsive Off-Canvas / Kompakte Ansicht
   - Gilt für kleinere/querformatige Bildschirme
   - Seitenleiste fährt ein und kann via Toggle angezeigt werden
---------------------------------- */

@media screen and (max-width: 1750px) and (max-height: 1023px),
       screen and (max-width: 1023px) and (max-height: 1750px) {

  /* Optionaler Hinweis/Tooltip (ausblendbar per JS) */
  #tooltip {
    position: fixed;
    left: 50px;
    top: 50%;
    background-color: #0400ff;
    color: white;
    padding: 10px 15px;
    border-radius: 12px;
    z-index: 9999;
    display: none;
    cursor: pointer;
    animation: pulse 2s infinite;
    box-shadow:
      0 2px 8px rgba(0, 0, 0, 0.3),
      0 0 10px rgba(0, 123, 255, 0.6);
  }

  @keyframes pulse {
    0%   { transform: scale(1);   box-shadow: 0 0 10px rgba(0, 123, 255, 0.6); }
    50%  { transform: scale(1.1); box-shadow: 0 0 20px rgba(0, 123, 255, 0.8); }
    100% { transform: scale(1);   box-shadow: 0 0 10px rgba(0, 123, 255, 0.6); }
  }

  /* Sidebar in schmaler Ansicht: Off-Canvas links */
  .skin-blue .main-sidebar {
    position: fixed !important;
    top: 0;
    left: -265px !important;                /* ausgeblendet */
    width: 265px;                            /* feste Breite */
    height: calc(100% - 80px);               /* volle Höhe unterhalb Header */
    margin-top: 80px;                        /* kompakter Header */
    border-radius: 0;
    border-right: 2px solid #ccc;            /* schmaler Rand rechts */
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    transition: left 0.3s ease;
    z-index: 1052;
  }

  /* Link-Typo etwas größer/kuschliger auf Touch-Geräten */
  .skin-blue .sidebar a {
    font-size: 1.1rem;
    padding: 10px 15px;
  }

  /* Erste Menüzeile ohne Rundung in kompakter Ansicht */
  .skin-blue .sidebar-menu > li.active:nth-child(1) > a,
  .skin-blue .sidebar-menu > li:hover:nth-child(1) > a {
    border-top-right-radius: 0;
    border-top-left-radius: 0;
  }

  /* Fixe Links unten lösen (wandern mit Inhalt) */
  .fixed-bottom-links {
    position: unset;
  }

  /* Letzter fixer Link ohne Rundung */
  .skin-blue .sidebar-menu .fixed-bottom-links > li.active:nth-child(3) > a,
  .skin-blue .sidebar-menu .fixed-bottom-links > li:hover:nth-child(3) > a {
    border-bottom-right-radius: 0;
    border-bottom-left-radius: 0;
  }

  /* Kompakter Headerbereich (als Container für Logo etc.) */
  .skin-blue .main-header {                    
    left: -265px;                            /* deckt die Sidebar-Breite ab */
    height: 80px;
    width: 265px;
    margin: 0;
    overflow: auto;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    transition: left 0.3s ease;
  }

  .skin-blue .main-header .logo {
    margin: 5px 0;
  }

  /* Toggle-Button zum Ein-/Ausfahren der Sidebar */
  .toggle-btn {
    position: fixed;
    top: 40%;
    left: 0;
    z-index: 1088;
    width: 30px;
    height: 150px;
    padding: 40px 5px;
    border: none;
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
    background-color: var(--header-color);
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    transition: left 0.29s ease, background-color 0.29s ease;
  }

  .toggle-btn:hover {
    background-color: var(--active-color);
  }

  #toggleButton p {
    transform: rotate(270deg);
  }

  /* Body-Klasse schaltet Sidebar sichtbar */
  body.show-sidebar .main-sidebar {
    left: 0 !important;
  }

  /* Toggle-Button rückt mit ausfahrender Sidebar mit */
  body.show-sidebar #toggleButton {
    left: 263px;
    transition: left 0.31s ease;
  }

  /* Header rückt bei geöffneter Sidebar mit */
  body.show-sidebar .main-header {
    left: 0 !important;
  }
}
