html, body {
  height: 100%;
  margin: 0;
  border:none;
  background: #ffffff;
}

body {
  font-family: 'Outfit', sans-serif;
  margin: 0;
  color: #333;
  background: #ffffff;
}

header {
  background: #66267b;
  color: white;
  padding: 15px 20px;
  font-weight: 500;
  letter-spacing: 0.3px;
  display: none;
}

#container {
  display: flex;
  height: 100vh; /* volle Fensterhöhe */
  overflow: hidden;
}

/* --- Sidebar / Navigation --- */
#sidebar {
  width: 260px;
  background: #ffffff;
  overflow-y: auto;
  padding: 10px 12px;
  font-family: 'Outfit', sans-serif;
  height: 100%; /* Sidebar über gesamte Höhe */
  display: flex;
  flex-direction: column;
  resize: horizontal;     /* Sidebar horizontal vergrößer-/verkleinerbar */
  overflow: auto;         /* Scrollbar, falls Inhalt größer wird */
  min-width: 200px;       /* Mindestbreite */
  max-width: 600px;       /* Maximale Breite */
  /* border-right: 3px solid #e5e7eb; */
}

#sidebar h2 {
  font-size: 1em;
  margin: 0 0 12px 10px;
  color: #374151;
  font-weight: 600;
}

.active {
  background: #66267b !important;
  color: #ffffff;
  font-weight: 600;
}

.subcollection {
  margin-left: 15px;
  border-left: 1px solid #e5e7eb;
  padding-left: 10px;
}

/* --- Hauptbereich --- */
#mainContent {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 8px;
  border-bottom: 1px solid #e5e7eb;
}

th {
  background: #f3f4f6;
  text-align: left;
}

tr:hover {
  background: #f9fafb;
}

.abstractRow td {
  background: #fafafa;
  padding: 10px 15px;
  font-style: italic;
  color: #555;
  border-top: none;
}

.toggle-arrow {
  cursor: pointer;
  width: 20px;
  text-align: center;
}

/* Suchfeld */
#searchContainer {
  margin-bottom: 10px;
}

#searchInput {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.95em;
  transition: border 0.2s;
}

#searchInput:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

/* Hervorhebung */
.highlight {
  background-color: #ff66ff;
}

.groupTitle {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  color: #1f2937;
  margin-left: 8px;
  margin-bottom: 5px;
}

/* Liste in der Sidebar */
#collectionList {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.95em;
  color: #374151;
}

/* Eintrag (Ordner) */
.collection {
  display: flex;                /* Pfeil und Text nebeneinander */
  align-items: flex-start;
  gap: 6px;                     /* Abstand zwischen Pfeil und Text */
  cursor: pointer;
  border-radius: 4px;
  margin: 2px 0;
  padding: 5px 8px;
  white-space: normal;
  overflow-wrap: break-word;
}

/* Einrückung für Unterordner */
.collection[data-level="1"]   { padding-left: 20px; }
.collection[data-level="2"]   { padding-left: 35px; }
.collection[data-level="3"]   { padding-left: 50px; }
/* ggf. erweitern bei tieferen Ebenen */

/* Hover- und aktive Zustände */
.collection:hover {
  background: #f3f4f6;
}
.collection.active {
  background: #66267b;
  color: #ffffff;
  font-weight: 600;
}


/* Pfeil separat gestalten */
.collection .arrow {
  flex-shrink: 0;               /* Pfeil behält seine Breite */
  color: #6b7280;
  margin-top: 2px;
}

.arrow {
  display: inline-block;
  width: 14px;
  text-align: center;
  transition: transform 0.2s ease;
  color: #6b7280;
}

/* Unterlisten */
.sublist {
  list-style: none;
  margin: 0;
  padding: 0;
  /* border-left: 1px dashed #d1d5db;
  margin-left: 10px;
  padding-left: 6px; */
}

#loader {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #cbd5e1;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

#itemTable th {
  user-select: none;
  transition: background-color 0.2s;
}

#itemTable th:hover {
  background-color: #f3f4f6;
}

/* --- NEU NEU NEU NEU Sidebar-Griff (manuelles Ziehen) --- */
#dragbar {
  width: 4px;
  cursor: col-resize;
  background-color: #e5e7eb;
  transition: background-color 0.2s;
  flex-shrink: 0;
  position: relative;
  z-index: 3;
}

#dragbar:hover {
  background-color: #9ca3af;
}

/* Eintrag (Ordner) */
.collection {
  display: flex;
  align-items: flex-start;     /* Pfeil oben ausrichten */
  gap: 6px;                    /* Abstand zwischen Pfeil und Text */
  cursor: pointer;
  border-radius: 4px;
  margin: 2px 0;
  padding: 5px 8px;
  white-space: normal;
  overflow-wrap: break-word;
}

/* Pfeil */
.collection .arrow {
  display: inline-flex;
  align-items: flex-start;     /* oben an erste Textzeile angleichen */
  justify-content: center;
  width: 14px;
  line-height: 1;              /* verhindert zusätzliche vertikale Abstände */
  color: #6b7280;
  flex-shrink: 0;
  margin-top: 2px;             /* feine optische Korrektur */
}

/* Tabellenlinks mit lokalem Icon */
#itemTable a {
  position: relative;
  display: inline-block;
  width: 18px;
  height: 18px;
  background: url("img/link-solid-full.svg") center/contain no-repeat;
  opacity: 0.3;
  transition: transform 0.1s ease, opacity 0.1s ease;
}

#itemTable a:hover {
  opacity: 1;
}

#itemTable th:nth-child(1),
#itemTable td:nth-child(1) { width: 5%; }   /* Pfeil */
#itemTable th:nth-child(2),
#itemTable td:nth-child(2) { width: 50%; }  /* Titel */
#itemTable th:nth-child(3),
#itemTable td:nth-child(3) { width: 25%; }  /* Creator */
#itemTable th:nth-child(4),
#itemTable td:nth-child(4) { width: 6%; }  /* Jahr */
#itemTable th:nth-child(5),
#itemTable td:nth-child(5) { width: 7%; text-align: center; }  /* Link */
#itemTable th:nth-child(6),
#itemTable td:nth-child(6) { width: 7%; text-align: center; } /* Download */

/* --- Download Icon Styling --- */
.download-cell {
  text-align: center;
  position: relative; /* Wichtig für das Popup-Positioning */
}

.download-icon {
  cursor: pointer;
  width: 16px;
  height: 16px;
  opacity: 0.3;
  transition: opacity 0.1s ease, transform 0.1s ease;
}

.download-icon:hover {
  opacity: 1;
}

/* --- NEU: Download Popup-Menü --- */
.download-popup {
  position: absolute; /* Wird von JS positioniert */
  display: block;
  background-color: white;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  z-index: 100;
  min-width: 120px;
  padding: 5px 0;
}

.download-option {
  padding: 8px 15px;
  font-size: 0.9em;
  color: #333;
  cursor: pointer;
  white-space: nowrap;
}

.download-option:hover {
  opacity: 1;
}