/**
 * @file
 * Admin styling for the canonical (view) page of the four knowledge entities:
 * aml_regulation, aml_procedure, aml_obligation, aml_update.
 *
 * Two concerns:
 *  1. A "Home / Dashboard" navigation bar injected above the local task tabs
 *     (.aml-kb-topnav).
 *  2. Turning the default field dump — where the label and the value stack with
 *     identical typography and are impossible to tell apart — into a readable
 *     card, without needing per-entity markup (.aml-kb-detail + .field styling).
 *
 * Rendered inside the Gin admin theme. Everything is scoped under .aml-kb-* /
 * .aml-kb-detail so nothing leaks into other admin screens. Gin CSS custom
 * properties are used with explicit fallbacks (the page can also be viewed with
 * the front-end theme by anonymous users on published regulations).
 */

/* ------------------------------------------------------------------ *
 * Top nav bar (Home / Dashboard) — injected into page.header
 * ------------------------------------------------------------------ */
.aml-kb-topnav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 0.75rem;
}

.aml-kb-topnav__link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.9rem;
  border-radius: 6px;
  border: 1px solid var(--gin-border-color, #d3d4d7);
  background: var(--gin-bg-layer2, #fff);
  color: var(--gin-color-text, #1b1b1d);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.aml-kb-topnav__link:hover,
.aml-kb-topnav__link:focus {
  background: var(--gin-color-primary-light, #f0f4ff);
  border-color: var(--gin-color-primary, #0056d6);
  color: var(--gin-color-primary, #0056d6);
  text-decoration: none;
}

.aml-kb-topnav__link--primary {
  background: var(--gin-color-primary, #0056d6);
  border-color: var(--gin-color-primary, #0056d6);
  color: #fff;
}

.aml-kb-topnav__link--primary:hover,
.aml-kb-topnav__link--primary:focus {
  background: var(--gin-color-primary-active, #003d99);
  border-color: var(--gin-color-primary-active, #003d99);
  color: #fff;
}

/* ------------------------------------------------------------------ *
 * Detail card
 * ------------------------------------------------------------------ */
.aml-kb-detail {
  max-width: 880px;
  margin: 0 0 2rem;
  border: 1px solid var(--gin-border-color, #d3d4d7);
  border-radius: 12px;
  background: var(--gin-bg-layer2, #fff);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.04);
  overflow: hidden;
}

.aml-kb-detail__header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 0.85rem;
  padding: 1.35rem 1.75rem 1.15rem;
  border-bottom: 1px solid var(--gin-border-color, #e6e6e8);
  background: linear-gradient(180deg, var(--gin-bg-app, #f7f7f9) 0%, var(--gin-bg-layer2, #fff) 100%);
}

.aml-kb-detail__title {
  margin: 0;
  font-size: 1.375rem;
  line-height: 1.3;
  font-weight: 700;
  color: var(--gin-color-title, #1b1b1d);
}

.aml-kb-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border: 1px solid transparent;
  white-space: nowrap;
}

.aml-kb-badge--published {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}

.aml-kb-badge--unpublished {
  background: #f4f4f5;
  color: #52525b;
  border-color: #e4e4e7;
}

/* ------------------------------------------------------------------ *
 * Body — the readable field list
 *
 * Markup comes from field--aml-knowledge-detail.html.twig:
 *   .aml-kb-field > .aml-kb-field__label + .aml-kb-field__value > .aml-kb-field__item
 * ------------------------------------------------------------------ */
.aml-kb-detail__body {
  padding: 1.5rem 1.75rem;
}

.aml-kb-field {
  margin: 0 0 1.15rem;
  padding: 0 0 1.15rem;
  border-bottom: 1px solid var(--gin-border-color-layer, #ededf0);
}

.aml-kb-field:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: 0;
}

/* Label: small, quiet, uppercase — unmistakably a caption. */
.aml-kb-field__label {
  display: block;
  margin: 0 0 0.25rem;
  font-size: 0.6875rem;
  font-weight: 700;
  line-height: 1.35;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gin-color-text-light, #75767b);
}

/* Value: the prominent line. */
.aml-kb-field__value {
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--gin-color-text, #1b1b1d);
}

.aml-kb-field__item + .aml-kb-field__item {
  margin-top: 0.25rem;
}

/* Reference / option lists render as chips. */
.aml-kb-field--type-entity-reference .aml-kb-field__value,
.aml-kb-field--type-list-string .aml-kb-field__value {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.4rem;
}

.aml-kb-field--type-entity-reference .aml-kb-field__item,
.aml-kb-field--type-list-string .aml-kb-field__item {
  margin-top: 0;
  padding: 0.15rem 0.55rem;
  border-radius: 6px;
  background: var(--gin-bg-app, #f4f4f6);
  border: 1px solid var(--gin-border-color, #d3d4d7);
  font-size: 0.8125rem;
}

.aml-kb-field__item a {
  color: var(--gin-color-primary, #0056d6);
  text-decoration: none;
}

.aml-kb-field__item a:hover {
  text-decoration: underline;
}

/* Long / formatted text fields (details, body, description). */
.aml-kb-field--type-text-long .aml-kb-field__item > *:first-child,
.aml-kb-field--type-text-with-summary .aml-kb-field__item > *:first-child {
  margin-top: 0;
}

.aml-kb-field--type-text-long .aml-kb-field__item > *:last-child,
.aml-kb-field--type-text-with-summary .aml-kb-field__item > *:last-child {
  margin-bottom: 0;
}

.aml-kb-field--type-text-long h3,
.aml-kb-field--type-text-long h4,
.aml-kb-field--type-text-with-summary h3,
.aml-kb-field--type-text-with-summary h4 {
  margin: 1.25rem 0 0.4rem;
  font-size: 0.95rem;
  font-weight: 700;
}

/* Inline-label fields keep the label on the same row but still distinct. */
.aml-kb-field--label-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem;
}

.aml-kb-field--label-inline .aml-kb-field__label {
  margin: 0;
}

/* ------------------------------------------------------------------ *
 * Dark mode (Gin)
 * ------------------------------------------------------------------ */
.gin--dark-mode .aml-kb-badge--published {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.35);
}

.gin--dark-mode .aml-kb-badge--unpublished {
  background: rgba(255, 255, 255, 0.06);
  color: #a1a1aa;
  border-color: rgba(255, 255, 255, 0.12);
}
