/* PORTAL_VISUAL_V2 */
html,
body,
button,
input,
select,
textarea {
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

body.portal-authenticated .portalShell {
  grid-template-columns: 224px minmax(0, 1fr);
}

.portalSidebar {
  background:
    radial-gradient(
      circle at top left,
      rgba(37, 99, 235, 0.24),
      transparent 260px
    ),
    #0b1424;
}

.sidebarBrand {
  padding-inline: 6px;
}

.sidebarLink {
  min-height: 42px;
  padding: 9px 12px;
  font-size: 0.86rem;
  font-weight: 650;
}

.portalMain {
  padding: 26px 32px 48px;
}

.portalMain .topBar {
  align-items: center;
  margin-bottom: 20px;
}

.portalMain .topBar h2 {
  font-size: 1.55rem;
  letter-spacing: -0.025em;
}

.portalMain .topBar .hint {
  margin-top: 5px;
}

.topBarActions button {
  min-width: auto;
  padding-inline: 15px;
}

/* Nur den globalen Aktualisieren-Button anzeigen */
#databasesSection .sectionHeader #refreshButton {
  display: none;
}

.portalLayout {
  grid-template-columns: 310px minmax(0, 1fr);
  gap: 22px;
}

.card {
  border-radius: 15px;
}

.stickyCard {
  top: 24px;
  padding: 21px;
}

.engineSelector {
  gap: 9px;
}

.engineCard {
  min-height: 70px;
  padding: 11px 13px;
  border-radius: 11px;
}

.engineLogo {
  width: 42px;
  height: 42px;
}

.engineLogo img {
  max-width: 31px;
  max-height: 31px;
}

.engineName {
  font-size: 1rem;
  font-weight: 750;
}

.engineDescription {
  font-size: 0.78rem;
  line-height: 1.3;
}

/* Datenbankbereich */
#databasesSection {
  padding: 22px;
}

.databaseList {
  gap: 12px;
}

.databaseItem {
  position: relative;
  padding: 18px 20px;
  border-radius: 13px;
  transition:
    border-color 0.16s ease,
    background 0.16s ease,
    transform 0.16s ease;
}

.databaseItem:hover {
  transform: translateY(-1px);
}

.databaseItem h3,
.databaseItem strong {
  letter-spacing: -0.015em;
}

.databaseItem p {
  margin: 4px 0;
  line-height: 1.35;
}

/* Aktionsbuttons kompakter und ruhiger */
.databaseItem button {
  min-height: 34px;
  margin: 6px 4px 0 0;
  padding: 6px 11px;
  border-radius: 8px;
  font-size: 0.76rem;
  font-weight: 650;
  box-shadow: none;
}

.databaseItem button:hover {
  transform: none;
}

/* Primäre Aktionen leicht hervorheben */
.databaseItem button:first-of-type,
.databaseItem button:nth-of-type(3) {
  border-color: rgba(96, 165, 250, 0.55);
  background: rgba(37, 99, 235, 0.1);
}

/* Gefährliche Aktion klar getrennt */
.databaseItem button:last-of-type {
  margin-left: 4px;
  background: #dc2626;
  border-color: #dc2626;
  color: #fff;
}

/* Statusmeldung als Badge */
#status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  margin-bottom: 13px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.77rem;
  font-weight: 700;
}

/* Dunkelmodus mit klarerer Tiefenwirkung */
html[data-theme="dark"] {
  --portal-bg: #07101e;
  --portal-surface: #101c2e;
  --portal-surface-muted: #16243a;
  --portal-border: #263850;
  --portal-text: #eaf1fb;
  --portal-muted: #9fb0c7;
}

html[data-theme="dark"] .portalMain {
  background:
    radial-gradient(
      circle at top right,
      rgba(37, 99, 235, 0.06),
      transparent 440px
    ),
    var(--portal-bg);
}

html[data-theme="dark"] .card,
html[data-theme="dark"] .databaseItem {
  background: linear-gradient(
    180deg,
    rgba(18, 31, 50, 0.98),
    rgba(14, 26, 43, 0.98)
  );
}

html[data-theme="dark"] .databaseItem:hover {
  border-color: #3b5270;
  background: #132238;
}

html[data-theme="dark"] .databaseItem button {
  color: #dce8f8;
  background: #0c1829;
  border: 1px solid #2b405c;
}

html[data-theme="dark"] .databaseItem button:hover {
  background: #172943;
  border-color: #456181;
}

html[data-theme="dark"] .databaseItem button:last-of-type {
  color: #fff;
  background: #dc2626;
  border-color: #dc2626;
}

html[data-theme="dark"] #status {
  color: #5eead4;
  background: rgba(13, 148, 136, 0.12);
  border: 1px solid rgba(45, 212, 191, 0.2);
}

@media (max-width: 1180px) {
  body.portal-authenticated .portalShell {
    grid-template-columns: 205px minmax(0, 1fr);
  }

  .portalLayout {
    grid-template-columns: 280px minmax(0, 1fr);
  }

  .portalMain {
    padding-inline: 22px;
  }
}

@media (max-width: 900px) {
  .portalLayout {
    grid-template-columns: 1fr;
  }

  .stickyCard {
    position: static;
  }
}


/* PORTAL_VISUAL_V2_CORRECTIONS */

/* Verbindungs- und Detailinformationen lesbar darstellen */
html[data-theme="dark"] .detailsBox,
html[data-theme="dark"] .detailsBox pre,
html[data-theme="dark"] .detailsBox code,
html[data-theme="dark"] .databaseItem pre,
html[data-theme="dark"] .databaseItem code {
  color: #b9d5f5;
}

html[data-theme="dark"] .detailsBox {
  background: #0b1728;
  border-color: #2a405c;
}

.detailsBox pre,
.databaseItem pre {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family:
    "SFMono-Regular",
    Consolas,
    "Liberation Mono",
    monospace;
  font-size: 0.78rem;
  line-height: 1.55;
}

/* Datenbank-Aktionszeile ruhiger gestalten */
.databaseItem button:last-of-type {
  float: right;
  margin-left: 12px;
}

.databaseItem::after {
  content: "";
  display: block;
  clear: both;
}

/* Sidebar darf immer nur einen aktiven Eintrag zeigen */
.sidebarLink.active {
  box-shadow: inset 3px 0 0 #60a5fa;
}

/* Etwas kompaktere linke Spalte */
@media (min-width: 1181px) {
  .portalLayout {
    grid-template-columns: 290px minmax(0, 1fr);
  }
}
