.project-manager-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 11000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  padding-top: calc(2rem + 140px);
  backdrop-filter: blur(4px);
}

.project-manager {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 1400px;
  height: calc(100vh - 140px - 4rem);
  max-height: 90vh;
  background: #ffffff;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 8px 24px rgba(0, 0, 0, 0.15);
  border: 1px solid #e1e4e8;
}

.project-manager-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: #ffffff;
  border-bottom: 1px solid #e1e4e8;
  min-height: 48px;
}

.project-manager-header h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: #24292e;
}

.project-manager-content {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 0;
  flex: 1;
  overflow: hidden;
}

.projects-list {
  border-right: 1px solid #e1e4e8;
  overflow-y: auto;
  background: #f5f6fa;
}

.projects-list.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
}

.projects-list.empty p {
  margin: 0.5rem 0;
  color: #6b7280;
}

.list-group {
  display: flex;
  flex-direction: column;
}

.list-group-item {
  padding: 12px 16px;
  border-bottom: 1px solid #e1e4e8;
  cursor: pointer;
  transition: all 0.2s ease;
  background: #ffffff;
  border-left: 3px solid transparent;
}

.list-group-item:hover {
  background: #f6f8fa;
  border-left-color: #e1e4e8;
}

.list-group-item.active {
  background: #e0e7ff;
  color: #4338ca;
  border-left-color: #818cf8;
  font-weight: 500;
}

.list-group-item.active .text-muted {
  color: #6366f1 !important;
}

.project-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.project-info {
  flex: 1;
  min-width: 0;
}

.project-info h4 {
  margin: 0 0 0.5rem 0;
  font-size: 1rem;
  font-weight: 600;
  color: inherit;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-info p {
  margin: 0 0 0.5rem 0;
  font-size: 0.875rem;
  color: #6c757d;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.project-info small {
  font-size: 0.75rem;
  color: #adb5bd;
}

.project-actions {
  display: flex;
  gap: 0.5rem;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.list-group-item:hover .project-actions {
  opacity: 1;
}

.project-details {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #ffffff;
}

.project-details.empty {
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-state {
  text-align: center;
  padding: 3rem;
  color: #6c757d;
}

.empty-state i {
  margin-bottom: 1.5rem;
  opacity: 0.5;
}

.empty-state h3 {
  margin: 1rem 0 0.5rem 0;
  color: #212529;
  font-weight: 600;
}

.empty-state p {
  margin: 0;
  color: #6c757d;
}

.project-details-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid #e1e4e8;
  background: #ffffff;
  min-height: 48px;
}

.project-details-header h3 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: #24292e;
}

.datasets-list {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

.datasets-list.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
}

.datasets-list.empty p {
  margin: 0.5rem 0;
  color: #6c757d;
}

/* Section Headers */
.project-sections {
  display: flex;
  flex-direction: column;
  gap: 0;
  flex: 1;
  overflow: hidden;
}

.datasets-section,
.datasources-section {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.datasets-section {
  flex: 1;
  border-bottom: 1px solid #e1e4e8;
  min-height: 300px;
}

.datasources-section {
  min-height: 200px;
}

.datasets-section h4,
.datasources-section h4 {
  margin: 0;
  padding: 16px 24px;
  font-size: 14px;
  font-weight: 600;
  color: #24292e;
  background: #f6f8fa;
  border-bottom: 1px solid #e1e4e8;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.025em;
  position: sticky;
  top: 0;
  z-index: 5;
}

.datasets-section h4 i,
.datasources-section h4 i {
  font-size: 16px;
  color: #6366f1;
}

#datasources-container {
  padding: 16px 24px;
  overflow-y: auto;
}

#datasources-container:empty::after {
  content: 'Keine Datenquellen vorhanden\AKlicke auf "Daten laden" um eine Datenquelle hinzuzufügen';
  white-space: pre-wrap;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  color: #6b7280;
  font-size: 13px;
  line-height: 1.6;
}

.table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
  font-size: 13px;
  margin: 0;
}

.table thead {
  background: #ffffff;
  position: sticky;
  top: 0;
  z-index: 10;
}

.table thead th {
  padding: 12px 24px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  color: #6b7280;
  border-bottom: 1px solid #e1e4e8;
  background: #ffffff;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.table tbody tr {
  border-bottom: 1px solid #e1e4e8;
  transition: background 0.15s ease;
}

.table tbody tr:nth-child(even) {
  background: #fafbfc;
}

.table tbody tr:hover {
  background: #f6f8fa;
}

.table tbody tr:last-child {
  border-bottom: none;
}

.table tbody td {
  padding: 12px 24px;
  color: #24292e;
  font-size: 13px;
  vertical-align: middle;
}

.table tbody td:first-child {
  font-weight: 500;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 1rem;
  backdrop-filter: blur(4px);
}

.modal-content {
  background: #ffffff;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 8px 24px rgba(0, 0, 0, 0.15);
  border: 1px solid #e1e4e8;
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid #dee2e6;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: #212529;
}

.close-modal {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #6c757d;
  cursor: pointer;
  padding: 0;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s;
}

.close-modal:hover {
  background: #e9ecef;
  color: #212529;
}

.modal-body {
  padding: 2rem;
  overflow-y: auto;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: #212529;
  font-size: 0.875rem;
}

.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #e1e4e8;
  border-radius: 6px;
  background: #ffffff;
  color: #24292e;
  font-size: 13px;
  transition: all 0.2s;
  font-family: inherit;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.form-control:focus {
  outline: none;
  border-color: #818cf8;
  box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.1);
}

.form-control::placeholder {
  color: #6b7280;
}

textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

.form-text {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: #6c757d;
  line-height: 1.4;
}

.form-text.text-muted {
  color: #6c757d;
}

.upload-progress {
  margin: 1.5rem 0;
  text-align: center;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: #e9ecef;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #0d6efd, #0a58ca);
  border-radius: 4px;
  transition: width 0.3s ease;
  width: 0;
}

.progress-text {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: #212529;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid #dee2e6;
}

.btn {
  padding: 8px 16px;
  border: 1px solid #e1e4e8;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(180deg, #818cf8 0%, #6366f1 100%);
  color: white;
  border-color: #6366f1;
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #6366f1 0%, #4f46e5 100%);
  border-color: #4f46e5;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(99, 102, 241, 0.3);
}

.btn-secondary {
  background: linear-gradient(180deg, #ffffff 0%, #f6f8fa 100%);
  color: #24292e;
  border: 1px solid #e1e4e8;
}

.btn-secondary:hover:not(:disabled) {
  background: linear-gradient(180deg, #f6f8fa 0%, #e9ecef 100%);
  border-color: #818cf8;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-danger {
  background: #ef4444;
  color: white;
}

.btn-danger:hover:not(:disabled) {
  background: #dc2626;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-info {
  background: #3b82f6;
  color: white;
}

.btn-info:hover:not(:disabled) {
  background: #2563eb;
}

.btn-success {
  background: #10b981;
  color: white;
}

.btn-success:hover:not(:disabled) {
  background: #059669;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-sm {
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  min-width: 36px;
}

.btn i {
  font-size: 1em;
}

.table tbody td button {
  margin-right: 0.5rem;
}

.table tbody td button:last-child {
  margin-right: 0;
}

/* Data Source Form - Card Grid Layout */
.inline-datasource-form {
  padding: 24px;
  background: #f6f8fa;
  border-bottom: 1px solid #e1e4e8;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.inline-datasource-form h4 {
  margin: 0 0 20px 0;
  font-size: 16px;
  font-weight: 600;
  color: #24292e;
}

.source-type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.source-type-card {
  background: #ffffff;
  border: 2px solid #e1e4e8;
  border-radius: 8px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.source-type-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #818cf8, #6366f1);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.source-type-card:hover {
  border-color: #818cf8;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}

.source-type-card:hover::before {
  transform: scaleX(1);
}

.source-type-card:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(99, 102, 241, 0.1);
}

.source-icon {
  font-size: 48px;
  margin-bottom: 12px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.source-type-card h5 {
  margin: 0 0 8px 0;
  font-size: 14px;
  font-weight: 600;
  color: #24292e;
}

.source-type-card p {
  margin: 0;
  font-size: 12px;
  color: #6b7280;
  line-height: 1.5;
}

.form-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 2px solid #e1e4e8;
}

.form-header h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #24292e;
  display: flex;
  align-items: center;
  gap: 8px;
}

.text-muted {
  color: #6c757d !important;
}

.text-secondary {
  color: #6c757d !important;
}

@media (max-width: 1024px) {
  .project-manager-content {
    grid-template-columns: 300px 1fr;
  }
}

@media (max-width: 768px) {
  .project-manager-content {
    grid-template-columns: 1fr;
  }

  .projects-list {
    border-right: none;
    border-bottom: 1px solid #dee2e6;
    max-height: 40vh;
  }

  .project-manager-header {
    padding: 1rem 1.5rem;
  }

  .project-details-header {
    padding: 1rem 1.5rem;
  }

  .datasets-list {
    padding: 1rem 1.5rem;
  }

  .table {
    font-size: 0.8125rem;
  }

  .table thead th,
  .table tbody td {
    padding: 0.75rem 0.5rem;
  }

  .modal-content {
    max-width: 100%;
    margin: 1rem;
  }
}
