/*
 * Application-wide styles. GOV.UK Frontend is linked separately (and first)
 * from govuk-frontend.css; rules here may override it.
 *
 * Style rule: no domain concepts in CSS — classes here (app-*) must be
 * generic enough to extract to a library.
 */

/* Two-pane editor layout: controls on the left, framed preview on the right.
   Desktop-first (per MVP); stacks on narrow screens. */
.app-split-pane {
  display: grid;
  grid-template-columns: minmax(24rem, 2fr) 3fr;
  gap: 30px;
  align-items: start;
  padding: 15px 30px 30px;
}

@media (max-width: 768px) {
  .app-split-pane {
    grid-template-columns: 1fr;
  }
}

.app-page-header {
  padding: 30px 30px 0;
}

.app-split-pane__pane--framed {
  border: 1px solid #b1b4b6;
  background: #ffffff;
  min-height: 24rem;
  padding: 20px;
}

.app-split-pane__pane {
  box-sizing: border-box;
}

.app-split-pane__pane:not(.app-split-pane__pane--framed) {
  background: #f3f2f1;
  padding: 20px;
}

/* Keep the framed pane in view while the other pane scrolls. */
@media (min-width: 769px) {
  .app-split-pane__pane--framed {
    position: sticky;
    top: 15px;
    min-height: calc(100vh - 30px);
    max-height: calc(100vh - 30px);
    overflow-y: auto;
    overflow-x: hidden;
  }
}

/* Context shown in the service navigation after the service name, e.g. the
   thing currently being edited. */
.app-service-navigation__context {
  display: inline-block;
  padding: 15px 0;
  margin-right: 30px;
}

.app-service-navigation__separator {
  margin: 0 10px 0 0;
  color: #505a5f;
}

/* Tabs used as page navigation sit directly above the editor/preview panes,
   so drop the component's default bottom margin. */
.app-page-tabs {
  margin-bottom: 0;
}

/* Lay the tabs out on a single row. The component floats its list items by
   default; flex keeps the windowed block of tabs (plus its arrows) on one
   non-wrapping line. The selected tab is taller and rides up via a negative
   margin, so align bottoms. */
.app-page-tabs .govuk-tabs__list {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
}

.app-page-tabs .govuk-tabs__list-item {
  float: none;
  flex: 0 0 auto;
}

/* The arrow tabs hold a single chevron icon; centre it and match a normal
   tab's link height so the row stays level. */
.app-page-tabs__overflow .govuk-tabs__tab {
  display: flex;
  align-items: center;
}

.app-heading-size {
  margin-top: 10px;
}

.app-heading-size .govuk-select {
  width: auto;
}

.app-disclosure__summary {
  color: #0b0c0c;
  cursor: pointer;
  margin-bottom: 10px;
  text-decoration: underline;
}

.app-disclosure__summary:hover {
  color: #2b8cc4;
}

.app-disclosure__summary:focus {
  outline: 3px solid transparent;
  color: var(--govuk-focus-text-colour, #0b0c0c);
  background-color: var(--govuk-focus-colour, #fd0);
  box-shadow: 0 -2px var(--govuk-focus-colour, #fd0), 0 4px var(--govuk-focus-text-colour, #0b0c0c);
}

.app-disclosure__value {
  color: #505a5f;
}

.app-icon {
  display: block;
  width: 1.25rem;
  height: 1.25rem;
}

.app-icon-link,
.app-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
}

.app-icon-link {
  text-decoration: none;
}

.app-icon-button {
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
  font: inherit;
}

.app-icon-button--danger {
  color: #d4351c;
}

.app-icon-button:focus {
  outline: 3px solid transparent;
  background-color: var(--govuk-focus-colour, #fd0);
  box-shadow: 0 -2px var(--govuk-focus-colour, #fd0), 0 4px var(--govuk-focus-text-colour, #0b0c0c);
}

.app-empty-state {
  color: #505a5f;
}

/* A played-back uploaded image, capped to the width of its container so large
   uploads don't overflow the page. */
.app-uploaded-image {
  max-width: 100%;
  height: auto;
}

.app-warning {
  color: #d4351c;
}

/* Blue, left-aligned panel variant. The GOV.UK design system only ships the
   green confirmation panel, so this reuses the base .govuk-panel layout and
   supplies its own colours. */
.app-panel--information {
  color: #fff;
  background: #1d70b8;
  text-align: left;
}

/* Panels use white text throughout. The in-panel components keep their own
   dark text colours (govuk-body, govuk-heading-m...), so force them white
   wherever they sit inside the panel body. */
.govuk-panel__body,
.govuk-panel__body * {
  color: #fff;
}

.app-autosubmit__status {
  display: block;
  color: #505a5f;
  margin-top: 5px;
}

/* An editor card paired with its reorder arrows. The arrows are kept outside
   the card's <summary> (a click inside it would toggle the card open/closed),
   but positioned to sit on the summary line, pinned to its right edge, so they
   read as part of the summary whether the card is open or closed. */
.app-editor {
  position: relative;
}

.app-card__controls {
  position: absolute;
  top: 12px;
  right: 15px;
  display: flex;
  gap: 2px;
}

.app-card__controls-form {
  margin: 0;
}

/* A bordered, collapsible card grouping a removable editor block. The card
   is a <details> element; its <summary> shows a title and content snippet
   so collapsed cards stay identifiable. */
.app-card {
  border: 1px solid #b1b4b6;
  background: #ffffff;
  padding: 15px;
  margin-bottom: 20px;
}

.app-card__summary {
  cursor: pointer;
  /* Leave room on the right for the absolutely-positioned reorder arrows. */
  padding-right: 60px;
}

.app-card[open] > .app-card__summary {
  margin-bottom: 15px;
}

.app-card__title {
  display: inline-block;
  margin-bottom: 0;
}

.app-card__snippet {
  color: #505a5f;
  margin-bottom: 0;
  margin-left: 10px;
  display: inline-block;
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

.app-card__actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

/* One branch rule within a button card: a target page plus one or more
   ANDed conditions. */
.app-rule {
  border-top: 2px solid #b1b4b6;
  padding-top: 15px;
  margin-bottom: 25px;
}

/* An indented condition row within a rule (one of several ANDed together). */
.app-condition {
  border-left: 4px solid #b1b4b6;
  padding-left: 15px;
  margin-bottom: 20px;
}

/* Nudge the "Add condition" link up against its conditions. */
.app-rule__add-condition {
  display: inline-block;
  margin-bottom: 20px;
}

/* A vertical stack of buttons, one per line with tight spacing. */
.app-button-stack form {
  display: block;
}

.app-button-stack button {
  display: block;
  margin-bottom: 10px;
}

/* Render a form button as if it were an inline link (e.g. "Sign out" in navigation). */
.app-button-as-link {
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  font: inherit;
  text-decoration: underline;
}
