/*
 * Supplementary styles for CCA UI Profile v2.
 *
 * GOV.UK Frontend 6.4.0 supplies the shell, grid, typography, and components.
 * This file adds only what the design system does not provide: the metric
 * tiles, the capacity utilisation bar, the result list, and the CCA brand mark.
 *
 * Every colour is a GOV.UK palette token, per CCA-UI-001:
 *   #1d70b8 blue     #003078 dark blue   #00703c green
 *   #d4351c red      #f47738 orange      #ffdd00 yellow
 *   #0b0c0c black    #505a5f dark grey   #b1b4b6 mid grey   #f3f2f1 light grey
 *
 * Responsive boundaries match the fleet's 640/641/768 breakpoints.
 */

:root {
  --cca-blue: #1d70b8;
  --cca-dark-blue: #003078;
  --cca-green: #00703c;
  --cca-red: #d4351c;
  --cca-orange: #f47738;
  --cca-yellow: #ffdd00;
  --cca-black: #0b0c0c;
  --cca-dark-grey: #505a5f;
  --cca-mid-grey: #b1b4b6;
  --cca-light-grey: #f3f2f1;
}

.cca-mark {
  color: #ffffff;
  margin-right: 10px;
  vertical-align: middle;
}

.cca-code {
  font-family: ui-monospace, "SFMono-Regular", "Menlo", "Consolas", monospace;
  font-size: 0.9em;
  background-color: var(--cca-light-grey);
  padding: 1px 5px;
  border-radius: 2px;
  word-break: break-word;
}

.cca-code--wrap {
  word-break: break-all;
}

.cca-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  align-items: center;
  margin-top: 20px;
}

.cca-actions .govuk-button {
  margin-bottom: 0;
}

/* ------------------------------------------------------------------ Panels */

.cca-panel {
  background-color: var(--cca-light-grey);
  border-left: 5px solid var(--cca-blue);
  padding: 20px;
}

.cca-panel .govuk-summary-list {
  margin-bottom: 10px;
}

.cca-panel .govuk-summary-list__row {
  border-bottom-color: var(--cca-mid-grey);
}

/* ------------------------------------------------------------------- Cards */

.cca-cards {
  margin-top: 10px;
}

.cca-card {
  border-top: 4px solid var(--cca-blue);
  padding: 15px 0 20px;
  height: 100%;
}

/* ------------------------------------------------------------- Stat tiles */

.cca-stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 15px;
  margin: 20px 0 30px;
}

.cca-stat {
  background-color: var(--cca-light-grey);
  border-bottom: 4px solid var(--cca-blue);
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cca-stat__value {
  font-family: "GDS Transport", arial, sans-serif;
  font-weight: 700;
  font-size: 1.75rem;
  line-height: 1.1;
  color: var(--cca-dark-blue);
}

.cca-stat__label {
  font-size: 0.9rem;
  color: var(--cca-dark-grey);
}

/* --------------------------------------------------------- Utilisation bar */

.cca-bar {
  display: block;
  width: 100%;
  min-width: 80px;
  height: 14px;
  background-color: var(--cca-light-grey);
  border: 1px solid var(--cca-mid-grey);
  overflow: hidden;
}

.cca-bar__fill {
  display: block;
  height: 100%;
  background-color: var(--cca-green);
}

.cca-bar__fill--warn {
  background-color: var(--cca-yellow);
}

.cca-bar__fill--rollover {
  background-color: var(--cca-orange);
}

.cca-bar__fill--blocked {
  background-color: var(--cca-red);
}

/* ----------------------------------------------------------------- Results */

.cca-search-form {
  background-color: var(--cca-light-grey);
  padding: 20px 20px 5px;
  margin-bottom: 30px;
}

.cca-clear {
  margin-left: 15px;
}

.cca-results {
  margin-top: 10px;
}

.cca-result {
  border-bottom: 1px solid var(--cca-mid-grey);
  padding: 15px 0;
}

.cca-result:last-child {
  border-bottom: none;
}

.cca-result h3 {
  margin-bottom: 5px;
}

.cca-result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  color: var(--cca-dark-grey);
  margin-bottom: 0;
}

.cca-empty {
  background-color: var(--cca-light-grey);
  padding: 25px;
  border-left: 5px solid var(--cca-mid-grey);
}

.cca-empty h2:last-child,
.cca-empty p:last-child {
  margin-bottom: 0;
}

/* ------------------------------------------------------------- Registries */

.cca-registry {
  border-top: 2px solid var(--cca-mid-grey);
  padding-top: 25px;
  margin-top: 25px;
}

.cca-operation {
  border-left: 3px solid var(--cca-mid-grey);
  padding-left: 15px;
  margin-bottom: 30px;
}

.cca-toc {
  position: sticky;
  top: 20px;
}

/* ------------------------------------------------------ Responsive tuning */

@media (max-width: 640px) {
  .cca-stat-row {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }

  .cca-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .cca-toc {
    position: static;
  }
}

@media (min-width: 641px) and (max-width: 768px) {
  .cca-stat__value {
    font-size: 1.5rem;
  }
}

/* ------------------------------------------------------------ Preferences */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Keep focus visible everywhere, including on elements this file styles. */
a:focus,
button:focus,
input:focus,
select:focus,
summary:focus {
  outline: 3px solid transparent;
  box-shadow:
    0 -2px var(--cca-yellow),
    0 4px var(--cca-black);
  background-color: var(--cca-yellow);
  color: var(--cca-black);
}

@media print {
  .govuk-service-navigation,
  .govuk-footer,
  .cca-search-form {
    display: none;
  }
}
