/* ------------------------------ */
/* PCAS Theme tokens              */
/* ------------------------------ */
:root {
  --pcas-primary: #1D70B8;
  --pcas-secondary: #003078;
  --pcas-accent: #28A197;
  --pcas-link: #1D70B8;
  --pcas-text: #0B0C0C;
  --pcas-bg: #FFFFFF;
  --pcas-muted: #F3F2F1;
  --pcas-focus: #FFDD00;
}

/* ------------------------------ */
/* Base typography (GOV.UK fonts) */
/* ------------------------------ */
html {
  font-family: "GDS Transport", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
body,
button,
input,
select,
textarea {
  font-family: inherit;
}
.govuk-template__body,
.govuk-body,
.govuk-heading-xl,
.govuk-heading-l,
.govuk-heading-m,
.govuk-heading-s,
.govuk-caption-xl,
.govuk-caption-l,
.govuk-caption-m {
  font-family: inherit;
}

.pcas-theme--blue { /* GOV.UK-adjacent */
  --pcas-primary: #1D70B8;
  --pcas-secondary: #003078;
  --pcas-accent: #28A197;
  --pcas-link: #1D70B8;
  --pcas-muted: #F3F2F1;
}
.pcas-theme--teal { /* Deep Teal */
  --pcas-primary: #11606D;
  --pcas-secondary: #0B3C47;
  --pcas-accent: #38A3A5;
  --pcas-link: #11606D;
  --pcas-muted: #F5F7F8;
}
.pcas-theme--burgundy {
  --pcas-primary: #7A1E2E;
  --pcas-secondary: #4F0E1A;
  --pcas-accent: #D53880;
  --pcas-link: #7A1E2E;
  --pcas-muted: #F7F2F4;
}
.pcas-theme--emerald {
  --pcas-primary: #00703C;
  --pcas-secondary: #0A4E2A;
  --pcas-accent: #0BB38A;
  --pcas-link: #00703C;
  --pcas-muted: #F3F7F4;
}
.pcas-theme--slate {
  --pcas-primary: #475569;
  --pcas-secondary: #1F2937;
  --pcas-accent: #22A7F0;
  --pcas-link: #1D70B8;
  --pcas-muted: #F5F6F8;
}
.pcas-theme--navy {
  --pcas-primary: #0B3D91;
  --pcas-secondary: #072D6B;
  --pcas-accent: #C9A227;
  --pcas-link: #0B3D91;
  --pcas-muted: #F3F5FA;
}

/* Black & White (Mono) */
.pcas-theme--mono {
  --pcas-primary: #000000;
  --pcas-secondary: #000000;
  --pcas-accent: #000000;
  --pcas-link: #000000;
  --pcas-text: #000000;
  --pcas-bg: #FFFFFF;
  --pcas-muted: #E5E5E5; /* light grey for borders */
  --pcas-focus: #000000; /* high-contrast focus outline */
}

/* Apply tokens to key components */
html[class*="pcas-theme--" ] .govuk-header.pcas-header { background-color: var(--pcas-primary); }
html[class*="pcas-theme--" ] .govuk-header.pcas-header .govuk-header__link { color: #fff; }
html[class*="pcas-theme--" ] .govuk-header.pcas-header .govuk-header__link:visited { color: #fff; }
html[class*="pcas-theme--" ] .govuk-header.pcas-header .govuk-header__service-name { color: #fff; opacity: .95; }
/* Service navigation themed */
html[class*="pcas-theme--" ] .govuk-service-navigation {
  background: var(--pcas-secondary);
  border-top: 1px solid var(--pcas-secondary);
}
html[class*="pcas-theme--" ] .govuk-service-navigation__item {
  border-color: transparent; /* reset default */
}
html[class*="pcas-theme--" ] .govuk-service-navigation__link,
html[class*="pcas-theme--" ] a.govuk-service-navigation__link {
  color: #ffffff;
}
html[class*="pcas-theme--" ] .govuk-service-navigation__link:visited {
  color: #ffffff;
}
html[class*="pcas-theme--" ] .govuk-service-navigation__link:hover {
  color: #ffffff;
  text-decoration-thickness: 2px;
}
html[class*="pcas-theme--" ] .govuk-service-navigation__item--active,
html[class*="pcas-theme--" ] .govuk-service-navigation__item--active .govuk-service-navigation__link {
  color: #ffffff;
}
html[class*="pcas-theme--" ] .govuk-service-navigation__item--active {
  border-bottom: 2px solid #ffffff; /* visible on dark secondary */
}
html[class*="pcas-theme--" ] .govuk-service-navigation__link:focus,
html[class*="pcas-theme--" ] .govuk-service-navigation__link:focus-visible {
  outline: 3px solid var(--pcas-focus);
  outline-offset: 0;
  background: transparent !important;
}
/* Toggle button (mobile) - ensure visible on dark service nav */
html[class*="pcas-theme--" ] .govuk-service-navigation__toggle {
  color: #ffffff;
  border-color: rgba(255,255,255,0.5);
}
html[class*="pcas-theme--" ] .govuk-service-navigation__toggle:hover {
  color: #ffffff;
  border-color: rgba(255,255,255,0.7);
  background: rgba(255,255,255,0.06);
}
html[class*="pcas-theme--" ] .govuk-service-navigation__toggle:focus,
html[class*="pcas-theme--" ] .govuk-service-navigation__toggle:focus-visible {
  outline: 3px solid var(--pcas-focus);
  outline-offset: 0;
}
/* Keep service nav items on a single row until space forces a wrap */
html[class*="pcas-theme--" ] .govuk-service-navigation__list {
  display: flex;              /* ensure horizontal layout */
  flex-wrap: wrap;            /* allow wrap only when necessary */
  align-items: center;
  gap: 0 10px;                /* base spacing between items */
}
html[class*="pcas-theme--" ] .govuk-service-navigation__item {
  margin: 0;                  /* remove any default margins to rely on gap */
}
html[class*="pcas-theme--" ] .govuk-service-navigation__link {
  white-space: nowrap;        /* prevent link text from breaking into multiple lines */
}
/* Toggle visibility: show on mobile, hide on desktop */
@media (max-width: 640px) {
  html[class*="pcas-theme--" ] .govuk-service-navigation__toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }
}
@media (min-width: 641px) {
  html[class*="pcas-theme--" ] .govuk-service-navigation__toggle {
    display: none !important;
  }
}
/* Mobile toggle behaviour: hide list when collapsed */
@media (max-width: 640px) {
  html[class*="pcas-theme--" ] .govuk-service-navigation__toggle[aria-expanded="false"] + .govuk-service-navigation__list {
    display: none;
  }
  html[class*="pcas-theme--" ] .govuk-service-navigation__toggle[aria-expanded="true"] + .govuk-service-navigation__list {
    display: flex;
    flex-direction: column;     /* stack items vertically */
    align-items: stretch;       /* make items full width */
    gap: 4px;                   /* vertical spacing between items */
  }
  html[class*="pcas-theme--" ] .govuk-service-navigation__toggle[aria-expanded="true"] + .govuk-service-navigation__list .govuk-service-navigation__item {
    width: 100%;
  }
  html[class*="pcas-theme--" ] .govuk-service-navigation__toggle[aria-expanded="true"] + .govuk-service-navigation__list .govuk-service-navigation__link {
    display: block;             /* expand tap target */
    padding: 8px 0;             /* comfortable touch area */
  }
}
/* Ensure list is always visible on wider screens */
@media (min-width: 641px) {
  html[class*="pcas-theme--" ] .govuk-service-navigation__list {
    display: flex;
  }
}
/* Responsive spacing for service navigation */
@media (min-width: 640px) {
  html[class*="pcas-theme--" ] .govuk-service-navigation__list {
    gap: 0 12px;              /* small tablets and up */
  }
}
@media (min-width: 1024px) {
  html[class*="pcas-theme--" ] .govuk-service-navigation__list {
    gap: 0 14px;              /* desktops and up */
  }
}
/* Remove default GOV.UK blue logotype chip; keep text white */
html[class*="pcas-theme--" ] .govuk-header.pcas-header .govuk-header__logotype-text,
html[class*="pcas-theme--" ] .govuk-header.pcas-header .govuk-header__logotype-text,
html[class*="pcas-theme--" ] .govuk-header__link--homepage .govuk-header__logotype-text,
html[class*="pcas-theme--" ] .govuk-header__logotype-text,
html[class*="pcas-theme--" ] .govuk-header__logotype-text:link,
html[class*="pcas-theme--" ] .govuk-header__logotype-text:visited,
html[class*="pcas-theme--" ] .govuk-header__logotype-text:hover,
html[class*="pcas-theme--" ] .govuk-header__logotype-text:focus {
  background: transparent !important;
  background-color: transparent !important;
  background-image: none !important;
  color: #ffffff;
  padding: 0;
  display: inline-block;
}
/* Ensure all surrounding containers are transparent across states */
html[class*="pcas-theme--" ] .govuk-header__logo,
html[class*="pcas-theme--" ] .govuk-header__logotype,
html[class*="pcas-theme--" ] .pcas-wordmark-row,
html[class*="pcas-theme--" ] .govuk-header__link.govuk-header__link--homepage,
html[class*="pcas-theme--" ] .govuk-header__logo:hover,
html[class*="pcas-theme--" ] .govuk-header__logotype:hover,
html[class*="pcas-theme--" ] .govuk-header__link.govuk-header__link--homepage:hover {
  background: transparent !important;
}
html[class*="pcas-theme--" ] .govuk-header__logotype-text::before,
html[class*="pcas-theme--" ] .govuk-header__logotype-text::after {
  content: none !important;
  background: transparent !important;
}
/* Prevent large colored banner on focus for header link; keep a visible focus ring */
html[class*="pcas-theme--" ] .govuk-header__link:focus,
html[class*="pcas-theme--" ] .govuk-header__link:focus-visible {
  background: transparent !important;
  color: #ffffff;
  text-decoration: none;
  box-shadow: none !important; /* avoid filled banner */
  outline: 3px solid var(--pcas-focus);
  outline-offset: 0;
}
/* Also neutralize all other link states in the header */
html[class*="pcas-theme--" ] .govuk-header__link,
html[class*="pcas-theme--" ] .govuk-header__link:hover,
html[class*="pcas-theme--" ] .govuk-header__link:active,
html[class*="pcas-theme--" ] .govuk-header__link:visited {
  background: transparent !important;
}
/* Service navigation link colour (global fallback when themeClass is missing) */
a.govuk-service-navigation__link, .govuk-service-navigation__link { color: #ffffff; }
.govuk-service-navigation__link:visited { color: #ffffff; }
.govuk-service-navigation__link:hover { color: #ffffff; text-decoration-thickness: 2px; }
/* Also ensure the service nav bar itself renders on dark background globally */
.govuk-service-navigation { background: var(--pcas-secondary); border-top: 1px solid var(--pcas-secondary); }
/* Active state and underline visible on dark background */
.govuk-service-navigation__item--active,
.govuk-service-navigation__item--active .govuk-service-navigation__link { color: #ffffff; }
.govuk-service-navigation__item--active { border-bottom: 2px solid #ffffff; }
/* Mobile toggle colours globally */
.govuk-service-navigation__toggle { color: #ffffff; border-color: rgba(255,255,255,0.5); }
.govuk-service-navigation__toggle:hover { color: #ffffff; border-color: rgba(255,255,255,0.7); background: rgba(255,255,255,0.06); }
 a, .govuk-link { color: var(--pcas-link); }
 /* Hard override: ensure service navigation links are always white (staff and public) */
 .govuk-service-navigation .govuk-service-navigation__link,
 .govuk-service-navigation a.govuk-service-navigation__link,
 .govuk-service-navigation button.govuk-service-navigation__link,
 .govuk-service-navigation .govuk-service-navigation__item a.govuk-service-navigation__link:link,
 .govuk-service-navigation .govuk-service-navigation__item a.govuk-service-navigation__link:visited,
 .govuk-service-navigation .govuk-service-navigation__item a.govuk-service-navigation__link:hover,
 .govuk-service-navigation .govuk-service-navigation__item a.govuk-service-navigation__link:active,
 .govuk-service-navigation .govuk-service-navigation__item a.govuk-service-navigation__link:focus {
   color: #ffffff !important;
 }
body { color: var(--pcas-text); background: var(--pcas-bg); }
.govuk-link:focus, a:focus { outline: 3px solid var(--pcas-focus); }

/* Buttons */
.govuk-button:not(.govuk-button--secondary):not(.govuk-button--warning) {
  background-color: var(--pcas-primary);
  border-color: var(--pcas-primary);
}
.govuk-button:not(.govuk-button--secondary):not(.govuk-button--warning):hover {
  filter: brightness(0.92);
}
.govuk-button--secondary {
  color: var(--pcas-primary);
  box-shadow: inset 0 0 0 2px var(--pcas-primary);
}
.govuk-button--secondary:hover { background: var(--pcas-muted); }

/* Footer (themed) */
html[class*="pcas-theme--" ] .govuk-footer { background: var(--pcas-secondary); border-top: 1px solid var(--pcas-secondary); color: #fff; }
html[class*="pcas-theme--" ] .govuk-footer .pcas-footer__brand { color: #ffffff; }
html[class*="pcas-theme--" ] .govuk-footer__meta,
html[class*="pcas-theme--" ] .govuk-footer__licence-description { color: rgba(255,255,255,0.95); }
html[class*="pcas-theme--" ] .govuk-footer__link { color: #ffffff; }
html[class*="pcas-theme--" ] .govuk-footer__link:visited { color: #ffffff; }
html[class*="pcas-theme--" ] .govuk-footer__link:hover { color: #ffffff; text-decoration-thickness: 2px; }
html[class*="pcas-theme--" ] .govuk-footer__inline-list .govuk-footer__inline-list-item:after { color: #ffffff; }

/* Tags */
.govuk-phase-banner__content__tag { background: var(--pcas-secondary); }

/* Panels */
.govuk-panel--confirmation { border-top: 5px solid var(--pcas-primary); }

/* Details and inset */
.govuk-inset-text { border-left-color: var(--pcas-muted); }
.govuk-details__summary { color: var(--pcas-link); }

/* Summary list borders lighter */
.govuk-summary-list__row { border-bottom-color: var(--pcas-muted); }

/* Theme gallery swatches */
.theme-swatch { display:flex; gap:8px; margin:8px 0; }
.theme-swatch__chip { width:28px; height:20px; border:1px solid #b1b4b6; }
.theme-card { border:1px solid #b1b4b6; padding:12px; margin-bottom:12px; }
/* Scoped admin tabs presentation fixes */
/* ------------------------------ */
/* PCAS Header alignment tweaks   */
/* ------------------------------ */
.pcas-header .govuk-header__logo .govuk-header__link {
  display: inline-flex;
  align-items: center;
}
.pcas-header .govuk-header__logotype {
  display: inline-flex;
  flex-direction: column;
}
.pcas-header .pcas-wordmark-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.pcas-header .govuk-header__logotype-crown {
  display: block; /* remove inline baseline quirks */
}
.pcas-header .govuk-header__logotype-text {
  line-height: 1;
}
.pcas-header .govuk-header__service-name {
  display: block;
  margin-top: 2px;
  font-size: 16px;
}

/* ------------------------------ */
/* PCAS Footer brand in crown slot */
/* ------------------------------ */
.pcas-footer__brand {
  display: block;
  margin-bottom: 20px; /* matches crown spacing above meta */
}
.pcas-footer__brand .pcas-footer__abbr {
  display: block;
  font-weight: 700;
  font-size: 24px;
  line-height: 1.1;
}
.pcas-footer__brand .pcas-footer__name {
  display: block;
  font-size: 16px;
  line-height: 1.2;
}
.admin-tabs .govuk-tabs {
  margin-top: 10px;
}

/* Keep tabs to a single horizontal row with horizontal scroll when needed */
.admin-tabs .govuk-tabs__list {
  display: flex;
  flex-wrap: wrap; /* allow wrapping to new lines */
  overflow-x: visible; /* no horizontal scroll */
  gap: 4px;
  padding-bottom: 4px;
  margin-bottom: 8px;
  border-bottom: 1px solid #b1b4b6; /* light grey */
}

/* Remove default margins that create uneven spacing when wrapping */
.admin-tabs .govuk-tabs__list-item {
  margin: 0;
}

/* Make each tab anchor size itself neatly on wrap */
.admin-tabs .govuk-tabs__tab {
  display: inline-block;
}

/* Prevent tabs text from wrapping into multiple lines */
.admin-tabs .govuk-tabs__tab {
  white-space: nowrap;
}

/* Subtle visual cue for selection without adding boxes */
.admin-tabs .govuk-tabs__list-item--selected {
  border-bottom: 2px solid #1d70b8; /* GovUK blue */
}

/* Remove panel framing and keep spacing consistent */
.admin-tabs .govuk-tabs__panel {
  padding: 0;
  border: 0;
  margin-top: 16px;
  min-height: 200px; /* reduce layout jump between panels */
}

/* Tighten headings inside panels */
.admin-tabs .govuk-tabs__panel > .govuk-heading-m:first-child,
.admin-tabs .govuk-tabs__panel > .govuk-heading-l:first-child {
  margin-top: 0;
}

/* No custom scrollbar: tabs wrap instead of scrolling */

/* ------------------------------ */
/* Stats panels (standard + mini) */
/* ------------------------------ */
.app-panel {
  background: #f3f2f1; /* govuk-colour("light-grey") */
  border-left: 5px solid #b1b4b6; /* govuk-colour("mid-grey") */
  padding: 16px;
  margin-bottom: 12px;
}

.app-panel__title {
  margin: 0 0 4px 0;
}

.app-panel__text {
  margin: 0;
}

/* Colour variants */
.app-panel--blue { border-left-color: #1d70b8; }
.app-panel--green { border-left-color: #00703c; }
.app-panel--yellow { border-left-color: #ffbf47; }
.app-panel--red { border-left-color: #d4351c; }
.app-panel--grey { border-left-color: #b1b4b6; }

/* Mini variant: tighter spacing */
.app-panel--mini {
  padding: 8px 12px;
}
.app-panel--mini .app-panel__title {
  margin-bottom: 2px;
}
.app-panel--mini .app-panel__text {
  margin: 0;
}

/* ------------------------------ */
/* Progress component (inline, wraps)
/* ------------------------------ */
.pcas-progress__list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  padding: 0;
  margin: 0;
}
.pcas-progress__item { list-style: none; }
.pcas-progress__current { background: var(--pcas-secondary); }
.pcas-progress__current::after {
  content: "";
  display: block;
  width: 100%;
  height: 2px;
  background: var(--pcas-secondary);
}
