/* Sidebar (Details Panel) Styles */

#close-panel {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

#close-panel:hover {
  background-color: #f1f5f9;
  color: var(--text-primary);
}

#panel-content h2 {
  margin-top: 0;
  font-size: 1.5rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

#panel-content p {
  margin: 0.5rem 0;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

#panel-content strong {
  color: var(--text-primary);
  font-weight: 500;
}

#panel-content hr {
  border: 0;
  height: 1px;
  background: var(--border-color);
  margin: 1.5rem 0;
}

#panel-content .panel-action-buttons button {
  width: 100%;
  padding: 0.75rem;
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

#panel-content .panel-action-buttons button:hover {
  background-color: #f8fafc;
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.detail-chip {
  display: inline-block;
  padding: 3px 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 500;
  white-space: nowrap;
}

.principal-relationship-slot {
  min-height: 0;
  display: flex;
  align-items: flex-start;
  margin-bottom: 12px;
  width: 100%;
}

.principal-relationship-list {
  display: flex;
  flex-wrap: wrap;
  column-gap: 8px;
  row-gap: 6px;
  align-items: flex-start;
  width: 100%;
  max-width: 100%;
}

.principal-relationship {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  margin: 0;
  max-width: 100%;
}

.principal-relationship--interactive {
  all: unset;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 0 !important;
  box-shadow: none !important;
  cursor: pointer;
  padding: 0;
  font: inherit;
  text-align: left;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  border-radius: 0;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  vertical-align: top;
}

.principal-relationship--interactive:focus,
.principal-relationship--interactive:active,
.principal-relationship--interactive:focus-visible {
  outline: none;
  box-shadow: none;
}

.principal-relationship__label {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #991b1b;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease;
}

.principal-relationship--interactive:focus-visible
  .principal-relationship__label,
.principal-relationship--interactive:hover .principal-relationship__label {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}

.principal-relationship--affinal .principal-relationship__label {
  border-color: #fde68a;
  background: #fef3c7;
  color: #92400e;
}

.principal-relationship--sidebar .principal-relationship__label {
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
}

.principal-relationship-list--sidebar {
  justify-content: center;
}

.principal-relationship-list--sidebar .principal-relationship,
.principal-relationship-list--sidebar .principal-relationship--interactive {
  max-width: 100%;
}

.principal-relationship-list--sidebar .principal-relationship__label {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
  justify-content: center;
}

/* Mobile Sidebar Fixes */
@media (max-width: 768px) {
  .principal-relationship-slot {
    justify-content: center;
    width: 100%;
    margin-bottom: 14px;
  }

  .principal-relationship-list {
    justify-content: center;
    width: 100%;
  }
}
