/* =============================================
   NHS Design Tokens
   ============================================= */
:root {
  --nhs-blue:          #005EB8;
  --nhs-dark-blue:     #003087;
  --nhs-light-blue:    #41B6E6;
  --nhs-warm-yellow:   #FFB81C;
  --nhs-red:           #DA291C;
  --nhs-orange:        #ED8B00;
  --nhs-black:         #212B32;
  --nhs-dark-grey:     #425563;
  --nhs-mid-grey:      #768692;
  --nhs-pale-grey:     #E8EDEE;
  --nhs-white:         #FFFFFF;
  --hcid-red:          #DA291C;
  --hcid-partial-bg:   #ED8B00;
  --prototype-yellow:  #FFB81C;
  --font-main: "Helvetica Neue", Arial, sans-serif;
  --radius-sm: 4px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.12);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.15);
}

/* =============================================
   Reset & Base
   ============================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-family: var(--font-main);
  font-size: 16px;
  color: var(--nhs-black);
  background: var(--nhs-pale-grey);
}

body {
  max-width: 1600px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

/* =============================================
   Prototype Banner — base
   ============================================= */
.prototype-banner {
  background: var(--prototype-yellow);
  color: var(--nhs-black);
  text-align: center;
  padding: 5px 16px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border-bottom: 2px solid #cc9200;
  flex-shrink: 0;
}

/* =============================================
   Header — base
   ============================================= */
.site-header {
  background: var(--nhs-blue);
  color: var(--nhs-white);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.site-header__trust { display: flex; align-items: center; gap: 8px; }

.site-header__logo-placeholder {
  width: 32px; height: 32px;
  background: rgba(255,255,255,0.2);
  border: 1px dashed rgba(255,255,255,0.5);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 8px; color: rgba(255,255,255,0.7); text-align: center;
}

.site-header__name      { font-size: 12px; font-weight: 600; opacity: 0.85; }
.site-header__app-title { font-size: 15px; font-weight: 700; }

/* =============================================
   Breadcrumb — base
   ============================================= */
.breadcrumb { background: var(--nhs-dark-blue); padding: 5px 14px; flex-shrink: 0; }

.breadcrumb__list {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.breadcrumb__item         { color: rgba(255,255,255,0.7); }
.breadcrumb__item a       { color: var(--nhs-light-blue); text-decoration: none; }
.breadcrumb__item a:hover { text-decoration: underline; }
.breadcrumb__item--current { color: var(--nhs-white); font-weight: 600; }
.breadcrumb__sep          { color: rgba(255,255,255,0.35); }

/* =============================================
   Page Wrapper
   ============================================= */
.page-wrapper {
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* =============================================
   Toolbar — base
   ============================================= */
.toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.toolbar__search {
  position: relative;
  flex: 0 0 260px;
}

.toolbar__search input {
  width: 100%;
  padding: 7px 30px 7px 10px;
  font-size: 14px;
  font-family: var(--font-main);
  border: 2px solid var(--nhs-mid-grey);
  border-radius: var(--radius-sm);
  background: var(--nhs-white);
  color: var(--nhs-black);
}

.toolbar__search input:focus {
  outline: none;
  border-color: var(--nhs-blue);
  box-shadow: 0 0 0 3px rgba(0,94,184,0.2);
}

.toolbar__search__clear {
  position: absolute; right: 7px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  color: var(--nhs-mid-grey); font-size: 16px; display: none;
  padding: 2px; line-height: 1;
}

.toolbar__search__clear:hover { color: var(--nhs-black); }

/* =============================================
   Legend — base (visible by default)
   ============================================= */
.legend {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  color: var(--nhs-dark-grey);
  flex-wrap: wrap;
}

.legend__item { display: flex; align-items: center; gap: 5px; }

/* =============================================
   Badges
   ============================================= */
.badge {
  display: inline-block;
  font-size: 10px; font-weight: 700;
  padding: 2px 5px; border-radius: 3px;
  color: white; line-height: 1.4;
  letter-spacing: 0.02em; white-space: nowrap;
}

.badge--hcid    { background: var(--hcid-red); }
.badge--partial { background: var(--hcid-partial-bg); }
.badge--unbuilt { background: var(--nhs-pale-grey); color: var(--nhs-mid-grey); border: 1px solid #c0c8cc; }

/* =============================================
   Infection Grid — base: phone (2 col)
   ============================================= */
.infection-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  align-content: start;
  flex: 1;
}

/* =============================================
   Infection Buttons — base: phone
   ============================================= */
.infection-btn {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 10px 9px;
  background: var(--nhs-white);
  border: 1px solid #c0c8cc;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--nhs-black);
  font-family: var(--font-main);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s, box-shadow 0.1s;
  box-shadow: var(--shadow-sm);
  min-height: 48px;
}

.infection-btn:hover {
  background: #f0f5fb;
  border-color: var(--nhs-blue);
  box-shadow: var(--shadow-md);
  color: var(--nhs-dark-blue);
}

.infection-btn--hcid    { border-left: 3px solid var(--hcid-red); }
.infection-btn--unbuilt { opacity: 0.5; cursor: not-allowed; pointer-events: none; }
.infection-btn__name    { flex: 1; min-width: 0; }
.infection-btn__badge   { margin-left: 4px; flex-shrink: 0; margin-top: 1px; }
.infection-btn[hidden]  { display: none; }

/* =============================================
   No Results
   ============================================= */
.no-results {
  display: none;
  grid-column: 1 / -1;
  text-align: center;
  padding: 32px;
  color: var(--nhs-dark-grey);
  font-size: 15px;
}

/* =============================================
   Footer
   ============================================= */
.site-footer {
  background: var(--nhs-dark-blue);
  color: rgba(255,255,255,0.65);
  text-align: center;
  padding: 6px 14px;
  font-size: 11px;
  flex-shrink: 0;
}

.site-footer__watermark {
  font-weight: 700;
  color: var(--prototype-yellow);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: 8px;
}

/* =============================================
   Breakpoint: phone only (max 599px)
   Hide legend, full-width search
   ============================================= */
@media (max-width: 599px) {
  .legend {
    display: none;
  }
  .toolbar__search {
    flex: 1 1 100%;
  }
}

/* =============================================
   Breakpoint: tablet portrait 600px+ (4 col)
   ============================================= */
@media (min-width: 600px) {
  .infection-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
  }
  .infection-btn {
    padding: 12px 10px;
    font-size: 14px;
    min-height: 52px;
  }
}

/* =============================================
   Breakpoint: wide screens 1100px+ (6 col)
   Grid always goes to 6 col at this width,
   regardless of height
   ============================================= */
@media (min-width: 1100px) {
  .infection-grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
  }
  /* Chrome scales up at all wide widths */
  .prototype-banner   { font-size: 13px; padding: 8px 16px; }
  .site-header        { padding: 10px 24px; }
  .site-header__name  { font-size: 13px; }
  .site-header__app-title { font-size: 18px; }
  .breadcrumb         { padding: 6px 24px; }
  .breadcrumb__list   { font-size: 13px; }
  .page-wrapper       { padding: 12px 20px; }
  .toolbar__search    { flex: 0 0 300px; }
  .legend             { font-size: 13px; gap: 16px; }
}

/* =============================================
   Breakpoint: tall wide screens 1100px+ wide,
   1000px+ tall (iPad Pro landscape)
   Big beautiful buttons only when there is
   enough vertical space to show the full grid
   ============================================= */
@media (min-width: 1100px) and (min-height: 1000px) {
  .infection-btn {
    padding: 16px 14px;
    font-size: 15px;
    min-height: 64px;
  }
  .prototype-banner { font-size: 14px; padding: 10px 16px; }
  .site-header      { padding: 12px 24px; }
  .site-header__logo-placeholder { width: 44px; height: 44px; font-size: 10px; }
  .site-header__name      { font-size: 14px; }
  .site-header__app-title { font-size: 20px; }
  .breadcrumb             { padding: 7px 24px; }
  .breadcrumb__list       { font-size: 14px; }
  .page-wrapper           { padding: 14px 20px; }
  .toolbar__search        { flex: 0 0 320px; }
  .toolbar__search input  { font-size: 15px; padding: 8px 32px 8px 12px; }
  .legend                 { font-size: 13px; gap: 18px; }
}

/* =============================================
   Home Page
   ============================================= */
.home-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 24px 16px;
  gap: 20px;
}

.home-card {
  background: var(--nhs-white);
  border: 1px solid #c0c8cc;
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  padding: 32px;
  max-width: 520px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.home-card__status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--nhs-orange);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--nhs-orange);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

.home-card__title {
  font-size: 28px;
  font-weight: 700;
  color: var(--nhs-dark-blue);
  line-height: 1.2;
  margin: 0;
}

.home-card__subtitle {
  font-size: 14px;
  color: var(--nhs-dark-grey);
  margin: -8px 0 0;
}

.home-card__description {
  font-size: 14px;
  color: var(--nhs-black);
  line-height: 1.6;
  padding: 12px 14px;
  background: var(--nhs-pale-grey);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--nhs-blue);
}

.home-card__description p { margin: 0; }

.home-card__cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--nhs-blue);
  color: var(--nhs-white);
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: 15px;
  font-weight: 600;
  transition: background 0.15s;
}

.home-card__cta:hover {
  background: var(--nhs-dark-blue);
  color: var(--nhs-white);
}

.home-card__cta-arrow {
  font-size: 18px;
}

.home-card__status-detail {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--nhs-pale-grey);
}

.status-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex: 1;
}

.status-item__count {
  font-size: 18px;
  font-weight: 700;
  color: var(--nhs-dark-blue);
}

.status-item__label {
  font-size: 11px;
  color: var(--nhs-mid-grey);
  text-align: center;
}

.status-item__divider {
  width: 1px;
  height: 32px;
  background: var(--nhs-pale-grey);
}

.home-notice {
  max-width: 520px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.home-notice__item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 12px;
  color: var(--nhs-dark-grey);
  line-height: 1.5;
  padding: 10px 12px;
  background: var(--nhs-white);
  border: 1px solid #c0c8cc;
  border-radius: var(--radius-sm);
}

.home-notice__icon {
  font-size: 14px;
  flex-shrink: 0;
  margin-top: 1px;
}

/* =============================================
   404 Page
   ============================================= */
.error-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 24px 16px;
}

.error-card {
  background: var(--nhs-white);
  border: 1px solid #c0c8cc;
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  padding: 40px 32px;
  max-width: 480px;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.error-card__code {
  font-size: 72px;
  font-weight: 700;
  color: var(--nhs-pale-grey);
  line-height: 1;
  letter-spacing: -2px;
}

.error-card__title {
  font-size: 22px;
  font-weight: 700;
  color: var(--nhs-dark-blue);
  margin: -8px 0 0;
}

.error-card__message {
  font-size: 14px;
  color: var(--nhs-dark-grey);
  line-height: 1.6;
  margin: 0;
}

.error-card__actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 8px;
}

.error-card__btn {
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s;
}

.error-card__btn--primary {
  background: var(--nhs-blue);
  color: var(--nhs-white);
}

.error-card__btn--primary:hover {
  background: var(--nhs-dark-blue);
  color: var(--nhs-white);
}

.error-card__btn--secondary {
  background: var(--nhs-pale-grey);
  color: var(--nhs-dark-blue);
  border: 1px solid #c0c8cc;
}

.error-card__btn--secondary:hover {
  background: #d8e0e3;
}
