/* ==========================================================================
   Apebox Theme — admin-page refinements & core CSS token accommodation
   --------------------------------------------------------------------------
   Two jobs:
   1. Refinements ported from the arizto_web reference theme (css/admin.css),
      reduced to the rules that apply here. Not ported: the /admin two-column
      panel layout (core's system.admin.css is loaded and already provides it)
      and the contextual-links fixes (contextual module not enabled).
   2. Restatements of core stylesheets that hardcode colors instead of using
      design tokens. Selectors mirror core exactly — theme CSS loads after
      core, so equal specificity wins and only the offending properties need
      restating. Deliberately not restated: the fullscreen AJAX throbber
      (.ajax-progress-fullscreen) — its spinner SVG has a baked-in dark
      background, so core's dark pill is correct in both modes.
   ========================================================================== */

/* Unpublished content rows/teasers: subtle red tint. Uses the error-tint
   token so it flips correctly in dark mode. */
.node--unpublished {
  background-color: var(--color-error-bg);
}

/* Blocks UI (/admin/structure/block): core's block.admin.css paints disabled
   block rows with a hardcoded near-white background (#fcfcfa), which glows in
   dark mode. Restate it on the design tokens — the opacity fade stays the
   primary "disabled" cue and works in both modes. The tr prefix out-specifies
   core's .block-disabled:not(:hover). */
tr.block-disabled:not(:hover) {
  opacity: 0.675;
  background: var(--color-bg-secondary);
}

/* Permissions page (/admin/people/permissions): core's user.permissions.js
   swaps real checkboxes for a "fake" placeholder on roles that inherit from
   Authenticated. Show only the relevant one per row. */
.permissions tbody tr:has(input[type="checkbox"].js-rid-authenticated:not(:checked)) .js-fake-checkbox {
  display: none;
}

.permissions tbody tr:has(input[type="checkbox"].js-rid-authenticated:checked) .js-real-checkbox {
  display: none;
}

/* ---------------------------------------------------------------------------
   Core CSS token accommodation
   --------------------------------------------------------------------------- */

/* core/misc/components/tabledrag.module.css: "No blocks in this region"
   rows hardcode #999. */
tr.region-message {
  color: var(--color-text-muted);
}

/* core/modules/system/css/system.admin.css — modules page. */
.system-modules label,
.system-modules-uninstall label {
  color: var(--color-text-primary);
}

.system-modules details,
.system-modules td details a {
  color: var(--color-text-secondary);
}

.admin-requirements,
.admin-required {
  color: var(--color-text-secondary);
}

.admin-enabled {
  color: var(--color-success);
}

.admin-missing {
  color: var(--color-error);
}

/* core/modules/system/css/system.admin.css — appearance page. */
.system-themes-list-uninstalled {
  border-top-color: var(--color-border-medium);
}

.theme-selector .screenshot,
.theme-selector .no-screenshot {
  border-color: var(--color-border-light);
}

.theme-default .screenshot {
  border-color: var(--color-border-medium);
}

.theme-selector .operations li {
  border-right-color: var(--color-border-medium); /* LTR */
}

[dir="rtl"] .theme-selector .operations li {
  border-left-color: var(--color-border-medium);
}

/* core/misc/components/progress.module.css — batch/progress bars
   (white track, black bar, grey text). */
.progress__track {
  border-color: var(--color-border-medium);
  background-color: var(--color-bg-secondary);
}

.progress__bar {
  background-color: var(--color-primary);
}

.progress__description,
.progress__percentage {
  color: var(--color-text-secondary);
}

/* jQuery UI dialogs (core/assets/vendor/jquery.ui/themes/base/theme.css):
   the base theme hardcodes light greys. Restate on the tokens so dialogs
   follow the palette and flip in dark mode. */
.ui-widget-content {
  border-color: var(--color-border-medium);
  background: var(--color-bg-primary);
  color: var(--color-text-primary);
}

.ui-widget-content a {
  color: var(--color-link);
}

.ui-widget-header {
  border-color: var(--color-border-light);
  background: var(--color-bg-secondary);
  color: var(--color-text-primary);
}

.ui-widget-header a {
  color: var(--color-text-primary);
}

/* Modal backdrop: mode-neutral black scrim instead of jQuery UI's #aaa. */
.ui-widget-overlay {
  background: var(--color-black);
  opacity: 0.4;
}

/* Titlebar close control: a bare icon button, not a theme button —
   neutralise the global button styling. */
.ui-dialog .ui-dialog-titlebar-close,
.ui-dialog .ui-dialog-titlebar-close:hover,
.ui-dialog .ui-dialog-titlebar-close:focus,
.ui-dialog .ui-dialog-titlebar-close:active {
  padding: 0;
  background: none;
  border: 0;
  box-shadow: none;
  transform: none;
}

/* The ui-icon close glyph is a dark-grey PNG sprite. Dark is the default
   scheme, so invert it by default and restore it on the light-terminal
   scheme. */
.ui-dialog .ui-icon {
  filter: invert(1) hue-rotate(180deg);
}

html[data-dark-mode="light"] .ui-dialog .ui-icon {
  filter: none;
}

@media (prefers-color-scheme: light) {
  html:not([data-dark-mode]) .ui-dialog .ui-icon {
    filter: none;
  }
}

/* core/modules/system/css/components/system-status-report-general-info.css:
   the status report info cards hardcode #ccc borders. */
.system-status-general-info__item {
  border-color: var(--color-border-medium);
  border-radius: var(--radius-lg);
}

.system-status-general-info__item-title {
  border-bottom-color: var(--color-border-medium);
}

/* core/modules/system/css/components/system-status-report-counters.css:
   the counters' near-black tint disappears on the dark scheme. */
.system-status-report-counters__item {
  background-color: var(--color-bg-secondary);
  border-radius: var(--radius-md);
}

/* core/modules/system/css/system.admin.css: top-aligned module cells look
   ragged against the theme's middle-aligned row rhythm. */
.system-modules td {
  vertical-align: middle;
}
