/* =========================================================================
   User-Admin Panel
   ========================================================================= */

#userAdminView {
  max-width: 1200px;
  margin: 0 auto;
}

#userAdminView h2 {
  margin: 0 0 20px;
  font-size: 22px;
}

/* Tabs --------------------------------------------------------------------- */
.ua-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid #e5e7eb;
  margin-bottom: 20px;
}

.ua-tab {
  background: transparent;
  border: 0;
  padding: 10px 18px;
  font-size: 15px;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
}

.ua-tab:hover { color: #111827; background: #f9fafb; }

.ua-tab.active {
  color: #4f46e5;
  border-bottom-color: #4f46e5;
}

/* Toolbar ------------------------------------------------------------------ */
.ua-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.ua-toolbar input[type="text"] {
  flex: 1;
  max-width: 360px;
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
}

.ua-count {
  color: #6b7280;
  font-size: 14px;
}

.ua-hint {
  margin-top: 12px;
  font-size: 13px;
  color: #6b7280;
  font-style: italic;
}

/* Tabellen ----------------------------------------------------------------- */
.ua-table-wrap {
  overflow-x: auto;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.ua-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.ua-table th,
.ua-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #f1f5f9;
}

.ua-table thead th {
  background: #f9fafb;
  font-weight: 600;
  color: #374151;
  border-bottom: 2px solid #e5e7eb;
}

.ua-table tbody tr:hover { background: #f9fafb; }

.ua-input-inline,
.ua-select-inline {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 14px;
  background: #fff;
}

/* Toggle Switch ------------------------------------------------------------ */
.ua-toggle {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
}

.ua-toggle input { opacity: 0; width: 0; height: 0; }

.ua-toggle span {
  position: absolute; inset: 0;
  background: #cbd5e1;
  border-radius: 22px;
  cursor: pointer;
  transition: 0.2s;
}

.ua-toggle span::before {
  content: "";
  position: absolute;
  left: 3px; top: 3px;
  width: 16px; height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: 0.2s;
}

.ua-toggle input:checked + span { background: #10b981; }
.ua-toggle input:checked + span::before { transform: translateX(18px); }

/* Rollen-Karten ------------------------------------------------------------ */
.ua-roles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.ua-role-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ua-role-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ua-role-head h3 {
  margin: 0;
  font-size: 16px;
}

.ua-badge {
  display: inline-block;
  padding: 2px 8px;
  background: #e0e7ff;
  color: #4338ca;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  margin-left: 4px;
  vertical-align: middle;
}

.ua-role-count {
  font-size: 12px;
  color: #6b7280;
  background: #f3f4f6;
  padding: 3px 8px;
  border-radius: 10px;
}

.ua-role-desc {
  margin: 4px 0 0;
  color: #4b5563;
  font-size: 13px;
  min-height: 18px;
}

.ua-role-pages {
  margin: 4px 0 0;
  color: #6b7280;
  font-size: 13px;
}

.ua-role-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

/* Permission-Grid (im Rollen-Modal) --------------------------------------- */
#uaInlineEditor .ua-perms {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  padding: 12px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}

#uaInlineEditor .ua-perm-group {
  display: block;
}

#uaInlineEditor .ua-perm-group h4 {
  margin: 0 0 8px;
  font-size: 12px;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 700;
}

#uaInlineEditor .ua-perm-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

#uaInlineEditor label.ua-perm-item {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  width: auto !important;
  margin: 0 !important;
  background: transparent;
}

#uaInlineEditor label.ua-perm-item:hover { background: #ffffff; }

#uaInlineEditor label.ua-perm-item input[type="checkbox"] {
  width: 16px !important;
  height: 16px !important;
  margin: 0 !important;
  padding: 0 !important;
  flex-shrink: 0;
  cursor: pointer;
}

/* Tri-State Buttons (None / View / Edit) ---------------------------------- */
#uaInlineEditor .ua-wildcard {
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: 6px;
  padding: 10px 12px;
  margin: 16px 0 8px;
}

#uaInlineEditor .ua-tri {
  display: inline-flex;
  gap: 0;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
}

#uaInlineEditor .ua-tri-btn {
  background: #fff;
  border: 0;
  padding: 6px 10px;
  font-size: 13px;
  cursor: pointer;
  color: #6b7280;
  border-right: 1px solid #e5e7eb;
  transition: all 0.15s;
}

#uaInlineEditor .ua-tri-btn:last-child { border-right: 0; }
#uaInlineEditor .ua-tri-btn:hover { background: #f9fafb; }

#uaInlineEditor .ua-tri-btn.active {
  background: #4f46e5;
  color: #fff;
  font-weight: 600;
}
#uaInlineEditor .ua-tri-btn.ua-tri-view.active { background: #3b82f6; }
#uaInlineEditor .ua-tri-btn.ua-tri-edit.active { background: #10b981; }

/* Kleinere Variante fuer Per-Page */
#uaInlineEditor .ua-tri-small .ua-tri-btn {
  padding: 4px 8px;
  font-size: 12px;
  min-width: 28px;
}

#uaInlineEditor .ua-perm-item {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 14px;
}

#uaInlineEditor .ua-perm-label {
  flex: 1;
  color: #374151;
}

/* Inline-Editor (kein Modal-Popup) ---------------------------------------- */
#uaInlineEditor {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 2px dashed #cbd5e1;
}

#uaInlineEditor .ua-editor-content {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.05);
  max-width: 720px;
  margin: 0 auto;
  display: block;
}

#uaInlineEditor .ua-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid #e5e7eb;
  background: linear-gradient(135deg, #eef2ff 0%, #f9fafb 100%);
  border-radius: 10px 10px 0 0;
}

#uaInlineEditor .ua-editor-header h3 {
  margin: 0;
  font-size: 17px;
}

#uaInlineEditor .ua-editor-close {
  background: transparent;
  border: 0;
  font-size: 18px;
  cursor: pointer;
  color: #6b7280;
  padding: 4px 8px;
}

#uaInlineEditor .ua-editor-close:hover { color: #ef4444; }

#uaInlineEditor .ua-editor-body { padding: 18px; }

#uaInlineEditor .ua-editor-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 18px;
  border-top: 1px solid #e5e7eb;
  background: #f9fafb;
  border-radius: 0 0 10px 10px;
}

#uaInlineEditor .ua-editor-body > label {
  display: block;
  font-size: 14px;
  color: #374151;
  margin-bottom: 12px;
  width: 100%;
  font-weight: 500;
}

#uaInlineEditor .modal-header,
#uaInlineEditor .modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid #e5e7eb;
}

#uaInlineEditor .modal-footer {
  border-bottom: 0;
  border-top: 1px solid #e5e7eb;
  gap: 8px;
}

#uaInlineEditor .modal-body {
  padding: 18px;
}

#uaInlineEditor .modal-close {
  background: transparent;
  border: 0;
  font-size: 18px;
  cursor: pointer;
  color: #6b7280;
}

#uaInlineEditor .modal-body > label {
  display: block !important;
  font-size: 14px;
  color: #374151;
  margin-bottom: 12px;
  width: 100%;
  font-weight: 500;
}

#uaInlineEditor .ua-field {
  display: block;
  margin-bottom: 14px;
  width: 100%;
}

#uaInlineEditor .ua-field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 6px;
}

#uaInlineEditor .ua-field input[type="text"],
#uaInlineEditor .ua-field input[type="email"] {
  display: block !important;
  width: 100% !important;
  padding: 8px 10px !important;
  border: 1px solid #d1d5db !important;
  border-radius: 6px !important;
  font-size: 14px !important;
  background: #fff !important;
  box-sizing: border-box;
}

#uaInlineEditor .ua-field input[disabled] {
  background: #f3f4f6 !important;
  color: #6b7280;
}

#uaInlineEditor .modal-body input[type="text"],
#uaInlineEditor .modal-body input[type="email"],
#uaInlineEditor .modal-body select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  margin-top: 4px;
  background: #fff;
}

/* Header-Admin-Button ------------------------------------------------------ */
#userAdminBtn { font-weight: 500; }

/* Start-Dashboard der Rolle (seit 10/2026) */
#uaInlineEditor .ua-field select {
  display: block !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 8px 10px !important;
  border: 1px solid #d1d5db !important;
  border-radius: 6px !important;
  font-size: 14px !important;
  background: #fff !important;
}
#uaInlineEditor .ua-field-hint {
  margin-top: 4px;
  font-size: 12px;
  color: #6b7280;
}
