/* Admin Selector */
.admin-selector {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  padding: 16px;
  background: rgba(37, 99, 235, 0.04);
  border-radius: 8px;
  border: 1px solid rgba(37, 99, 235, 0.1);
}

.admin-selector label {
  font-weight: 500;
  color: rgba(0, 0, 0, 0.8);
  white-space: nowrap;
}

.admin-menu-select {
  flex: 1;
  max-width: 400px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.95);
  font-size: 1rem;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
}

.admin-menu-select:hover {
  border-color: rgba(37, 99, 235, 0.2);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.04);
}

.admin-menu-select:focus {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
  border-color: rgba(37, 99, 235, 0.2);
}

/* Admin Sections */
.admin-section {
  display: none;
  animation: fadeIn 0.2s ease;
}

.admin-section.active {
  display: block;
}

/* Employees List */
.employees-list-container {
  margin-bottom: 32px;
  padding: 16px;
  background: rgba(0, 0, 0, 0.02);
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.employees-list-container h3 {
  margin-top: 0;
  margin-bottom: 16px;
  font-size: 1rem;
}

.employees-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.employee-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  transition: all 0.2s ease;
}

.employee-item:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 0, 0, 0.12);
}

.employee-info {
  flex: 1;
}

.employee-name {
  font-weight: 500;
  color: rgba(0, 0, 0, 0.9);
  margin-bottom: 4px;
}

.employee-details {
  font-size: 0.85rem;
  color: rgba(0, 0, 0, 0.6);
  display: flex;
  gap: 16px;
}

.employee-actions {
  display: flex;
  gap: 8px;
  margin-left: 16px;
}

.employee-actions button {
  padding: 6px 12px;
  font-size: 0.85rem;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.employee-actions .btn-edit {
  background: rgba(37, 99, 235, 0.1);
  color: #2563eb;
  border: 1px solid rgba(37, 99, 235, 0.2);
}

.employee-actions .btn-edit:hover {
  background: rgba(37, 99, 235, 0.2);
  border-color: rgba(37, 99, 235, 0.3);
}

.employee-actions .btn-delete {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.employee-actions .btn-delete:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.3);
}

.loading-state {
  padding: 24px;
  text-align: center;
  color: rgba(0, 0, 0, 0.5);
  font-style: italic;
}

.empty-state {
  padding: 24px;
  text-align: center;
  color: rgba(0, 0, 0, 0.5);
}

/* Roles List */
.roles-list-container {
  margin-bottom: 32px;
  padding: 16px;
  background: rgba(0, 0, 0, 0.02);
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.roles-list-container h3 {
  margin-top: 0;
  margin-bottom: 16px;
  font-size: 1rem;
}

.roles-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.role-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  transition: all 0.2s ease;
}

.role-item:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 0, 0, 0.12);
}

.role-info {
  flex: 1;
}

.role-name {
  font-weight: 500;
  color: rgba(0, 0, 0, 0.9);
  margin-bottom: 4px;
}

.role-description {
  font-size: 0.85rem;
  color: rgba(0, 0, 0, 0.6);
}

.role-actions {
  display: flex;
  gap: 8px;
  margin-left: 16px;
}

.role-actions button {
  padding: 6px 12px;
  font-size: 0.85rem;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.role-actions .btn-edit {
  background: rgba(37, 99, 235, 0.1);
  color: #2563eb;
  border: 1px solid rgba(37, 99, 235, 0.2);
}

.role-actions .btn-edit:hover {
  background: rgba(37, 99, 235, 0.2);
  border-color: rgba(37, 99, 235, 0.3);
}

.role-actions .btn-delete {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.role-actions .btn-delete:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.3);
}

/* Kategorien List (match Roles/Employees styling) */
.kategorien-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kategorie-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  transition: all 0.2s ease;
}

.kategorie-item:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 0, 0, 0.12);
}

.kategorie-info {
  flex: 1;
}

.kategorie-name {
  font-weight: 500;
  color: rgba(0, 0, 0, 0.9);
  margin-bottom: 4px;
}

.kategorie-beschreibung {
  font-size: 0.85rem;
  color: rgba(0, 0, 0, 0.6);
}

.kategorie-actions {
  display: flex;
  gap: 8px;
  margin-left: 16px;
}

.kategorie-actions button {
  padding: 6px 12px;
  font-size: 0.85rem;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.kategorie-actions .btn-edit {
  background: rgba(37, 99, 235, 0.1);
  color: #2563eb;
  border: 1px solid rgba(37, 99, 235, 0.2);
}

.kategorie-actions .btn-edit:hover {
  background: rgba(37, 99, 235, 0.2);
  border-color: rgba(37, 99, 235, 0.3);
}

.kategorie-actions .btn-delete {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.kategorie-actions .btn-delete:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.3);
}

/* Datenfeld (Konfiguration) actions - match Mitarbeiter styles */
.datenfeld-actions {
  display: flex;
  gap: 8px;
  margin-left: 16px;
}

.datenfeld-actions button {
  padding: 6px 12px;
  font-size: 0.85rem;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.datenfeld-actions .btn-edit {
  background: rgba(37, 99, 235, 0.1);
  color: #2563eb;
  border: 1px solid rgba(37, 99, 235, 0.2);
}

.datenfeld-actions .btn-edit:hover {
  background: rgba(37, 99, 235, 0.2);
  border-color: rgba(37, 99, 235, 0.3);
}

.datenfeld-actions .btn-delete {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.datenfeld-actions .btn-delete:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.3);
}

/* Form Separator */
.form-separator {
  margin: 32px 0;
  border: none;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.modal-header h2 {
  margin: 0;
  font-size: 1.2rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: rgba(0, 0, 0, 0.5);
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: rgba(0, 0, 0, 0.05);
  color: rgba(0, 0, 0, 0.8);
}

#admin-edit-user {
  padding: 20px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.admin-section h2 {
  margin-top: 0;
  margin-bottom: 16px;
  color: rgba(0, 0, 0, 0.9);
  font-size: 1.2rem;
}

.admin-section p {
  color: rgba(0, 0, 0, 0.7);
  margin-bottom: 16px;
}

/* style_admin.css - Admin-spezifische Styles (aus style.css verschoben) */
.admin-form {
  max-width: 720px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 18px;
  align-items: start;
  margin-top: 12px;
}

.admin-form .form-row {
  display: flex;
  flex-direction: column;
}

.admin-form .form-row label {
  font-size: 0.85rem;
  color: rgba(0, 0, 0, 0.7);
  margin-bottom: 6px;
}

.admin-form input,
.admin-form select {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.95);
  outline: none;
}

.admin-form textarea {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.95);
  outline: none;
  font-family: inherit;
  font-size: 1rem;
  resize: vertical;
  min-height: 80px;
}

.admin-form input:focus,
.admin-form select:focus,
.admin-form textarea:focus {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
  border-color: rgba(37, 99, 235, 0.2);
}

.admin-form .form-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

/* Single-column on small screens */
@media (max-width: 800px) {
  .admin-form {
    grid-template-columns: 1fr;
  }

  .admin-selector {
    flex-direction: column;
    align-items: flex-start;
  }

  .admin-menu-select {
    max-width: 100%;
    width: 100%;
  }
}

/* Tree View Styles */
.gliederung-container {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 20px;
  margin-top: 20px;
}

.gliederung-tree-panel {
  background: rgba(0, 0, 0, 0.02);
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  padding: 16px;
  height: fit-content;
  max-height: 70vh;
  overflow-y: auto;
}

.gliederung-tree-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 10px;
}

.gliederung-tree-header h3 {
  margin: 0;
  font-size: 1rem;
}

.btn-small {
  padding: 6px 12px;
  font-size: 0.85rem;
}

.gliederung-tree {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tree-node {
  margin-left: 0;
}

.tree-node.level-1 {
  margin-left: 0;
}

.tree-node.level-2 {
  margin-left: 20px;
}

.tree-node.level-3 {
  margin-left: 40px;
}

.tree-node.level-4 {
  margin-left: 60px;
}

.tree-node.level-5 {
  margin-left: 80px;
}

.tree-node-content {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  background: rgba(255, 255, 255, 0.5);
}

.tree-node-content:hover {
  background: rgba(37, 99, 235, 0.06);
  border-color: rgba(37, 99, 235, 0.1);
}

.tree-node-content.active {
  background: rgba(37, 99, 235, 0.12);
  border-color: rgba(37, 99, 235, 0.2);
  font-weight: 500;
}

.tree-toggle {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.75rem;
  color: rgba(0, 0, 0, 0.5);
  user-select: none;
}

.tree-toggle.collapsed::before {
  content: "▶";
}

.tree-toggle.expanded::before {
  content: "▼";
}

.tree-toggle.no-children {
  visibility: hidden;
}

.tree-node-label {
  flex: 1;
  font-size: 0.9rem;
  color: rgba(0, 0, 0, 0.8);
}

.tree-node-children {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tree-node-children.hidden {
  display: none;
}

/* Detail Panel */
.gliederung-detail-panel {
  background: rgba(0, 0, 0, 0.02);
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  padding: 20px;
  height: fit-content;
  max-height: 70vh;
  overflow-y: auto;
}

.gliederung-detail {
  display: flex;
  flex-direction: column;
}

.detail-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  color: rgba(0, 0, 0, 0.5);
  text-align: center;
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.detail-header h3 {
  margin: 0;
  font-size: 1.1rem;
}

.detail-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.detail-actions button {
  padding: 6px 12px;
  font-size: 0.85rem;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.detail-actions .btn-edit {
  background: rgba(37, 99, 235, 0.1);
  color: #2563eb;
  border: 1px solid rgba(37, 99, 235, 0.2);
}

.detail-actions .btn-edit:hover {
  background: rgba(37, 99, 235, 0.2);
  border-color: rgba(37, 99, 235, 0.3);
}

.detail-actions .btn-add-sub {
  background: rgba(34, 197, 94, 0.1);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.detail-actions .btn-add-sub:hover {
  background: rgba(34, 197, 94, 0.2);
  border-color: rgba(34, 197, 94, 0.3);
}

.detail-actions .btn-delete {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.detail-actions .btn-delete:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.3);
}

.detail-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 0.9rem;
  color: rgba(0, 0, 0, 0.6);
  flex-wrap: wrap;
}

.detail-breadcrumb span {
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-breadcrumb .separator {
  color: rgba(0, 0, 0, 0.4);
}

.detail-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.detail-info-row {
  display: flex;
  flex-direction: column;
}

.detail-info-label {
  font-size: 0.75rem;
  color: rgba(0, 0, 0, 0.6);
  margin-bottom: 4px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.detail-info-value {
  font-size: 0.95rem;
  color: rgba(0, 0, 0, 0.9);
}

.detail-children {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.detail-children h4 {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 0.95rem;
}

.detail-children-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-child-item {
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.detail-child-item:hover {
  background: rgba(255, 255, 255, 0.8);
  border-color: rgba(37, 99, 235, 0.2);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

/* Responsive Grid */
@media (max-width: 1200px) {
  .gliederung-container {
    grid-template-columns: 1fr;
  }

  .gliederung-tree-panel,
  .gliederung-detail-panel {
    max-height: none;
  }
}

/* Datenfelder List */
.datenfelder-list-container {
  margin-bottom: 32px;
  padding: 16px;
  background: rgba(0, 0, 0, 0.02);
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.datenfelder-list-container h3 {
  margin-top: 0;
  margin-bottom: 16px;
  font-size: 1rem;
}

.datenfelder-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.datenfeld-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  transition: all 0.2s ease;
}

.datenfeld-item:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 0, 0, 0.12);
}

.datenfeld-info {
  flex: 1;
}

.datenfeld-name {
  font-weight: 500;
  color: rgba(0, 0, 0, 0.9);
  margin-bottom: 4px;
}

.datenfeld-details {
  font-size: 0.85rem;
  color: rgba(0, 0, 0, 0.6);
}

.datenfeld-details span {
  margin-right: 16px;
}

.datenfeld-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* Datenfelder Access List */
.datenfelder-access-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.02);
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.datenfeld-access-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.datenfeld-access-label {
  flex: 1;
  font-weight: 500;
  color: rgba(0, 0, 0, 0.8);
  margin: 0;
}

.datenfeld-access-select {
  min-width: 160px;
  padding: 8px 10px;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.95);
  font-size: 0.9rem;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
}

.datenfeld-access-select:hover {
  border-color: rgba(37, 99, 235, 0.2);
}

.datenfeld-access-select:focus {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
  border-color: rgba(37, 99, 235, 0.2);
}
