/* Status board: grid layout, state colors. Bootstrap 5 for layout. */

:root {
  --green-solid: #22c55e;
  --red-solid: #ef4444;
  --grey-solid: #64748b;
  --amber-solid: #f59e0b;
}

body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: #f8fafc;
  color: #1e293b;
}

/* Compact header bar */
.header {
  padding: 0.25rem 0.75rem !important;
}
.header .overall {
  padding: 0.2rem 0.5rem;
  font-size: 0.8rem;
}
.header .overall__state {
  width: 0.65rem;
  height: 0.65rem;
}

/* Overall status badge */
.overall {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  border-radius: 0.375rem;
  font-weight: 600;
  font-size: 0.875rem;
}

.overall--green {
  background: rgba(34, 197, 94, 0.15);
  border: 2px solid var(--green-solid);
  color: #15803d;
}

.overall--red {
  background: rgba(239, 68, 68, 0.15);
  border: 2px solid var(--red-solid);
  color: #b91c1c;
}

.overall--grey {
  background: rgba(100, 116, 139, 0.15);
  border: 2px solid var(--grey-solid);
  color: #475569;
}

.overall--amber {
  background: rgba(245, 158, 11, 0.18);
  border: 2px solid var(--amber-solid);
  color: #b45309;
}

.overall__label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.overall__state {
  display: inline-block;
  width: 0.875rem;
  height: 0.875rem;
  border-radius: 50%;
  flex-shrink: 0;
}

.overall--green .overall__state {
  background: var(--green-solid);
}

.overall--red .overall__state {
  background: var(--red-solid);
}

.overall--grey .overall__state {
  background: var(--grey-solid);
}

.overall--amber .overall__state {
  background: var(--amber-solid);
}

/* Site cards: outer container for each site */
.site-card {
  background: #fff;
  border-radius: 0.5rem;
  overflow: hidden;
}

.site-card__header {
  background: #f1f5f9;
  border-bottom: 1px solid #e2e8f0;
  font-weight: 600;
  padding: 0.25rem 0.75rem !important;
}

.site-card__header .service-dot {
  flex-shrink: 0;
  width: 0.65rem;
  height: 0.65rem;
}

.site-card__header h2 {
  font-size: 0.9rem;
}

/* Service grid - Bootstrap row-cols max is 6, use custom CSS for more columns */
.service-tile-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.service-tile-grid > .col {
  flex: 0 0 auto;
  width: 25%;
  min-width: 0;
  transition: width 0.2s ease;
}
@media (min-width: 576px) {
  .service-tile-grid > .col { width: 16.666%; } /* 6 cols */
}
@media (min-width: 768px) {
  .service-tile-grid > .col { width: 14.28%; } /* 7 cols */
}
@media (min-width: 992px) {
  .service-tile-grid > .col { width: 12.5%; } /* 8 cols */
}
@media (min-width: 1200px) {
  .service-tile-grid > .col { width: 10%; } /* 10 cols at xl */
}
@media (min-width: 1400px) {
  .service-tile-grid > .col { width: 8.333%; } /* 12 cols at xxl, 2560px hits this */
}

/* Expanded tile: twice as wide for 5 seconds after click */
.service-tile-grid > .service-tile.service-tile--expanded { width: 50%; }
@media (min-width: 576px) {
  .service-tile-grid > .service-tile.service-tile--expanded { width: 33.333%; }
}
@media (min-width: 768px) {
  .service-tile-grid > .service-tile.service-tile--expanded { width: 28.56%; }
}
@media (min-width: 992px) {
  .service-tile-grid > .service-tile.service-tile--expanded { width: 25%; }
}
@media (min-width: 1200px) {
  .service-tile-grid > .service-tile.service-tile--expanded { width: 20%; }
}
@media (min-width: 1400px) {
  .service-tile-grid > .service-tile.service-tile--expanded { width: 16.666%; }
}

/* Service grid cards - compact */
.service-card {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  font-size: 0.875rem;
}

.service-card__body {
  padding: 0.375rem 0.5rem !important;
}

.service-card .fw-semibold {
  font-size: 0.8125rem;
}

.service-card__footer {
  font-size: 0.75rem;
  line-height: 1.3;
}

.service-card .service-actions .btn {
  padding: 0.125rem 0.375rem;
  font-size: 0.7rem;
}

.service-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
}

.service-card--green {
  border-left: 4px solid var(--green-solid) !important;
}

.service-card--red {
  border-left: 4px solid var(--red-solid) !important;
  background: rgba(239, 68, 68, 0.06) !important;
}

.service-card--grey {
  border-left: 4px solid var(--grey-solid) !important;
  background: rgba(100, 116, 139, 0.06) !important;
}

.service-card--amber {
  border-left: 4px solid var(--amber-solid) !important;
  background: rgba(245, 158, 11, 0.1) !important;
}

/* Flap-damped tiles: keep orange left accent when not demoted (demoted uses its own strip). */
.service-card.service-card--amber:not(.service-card--demoted) {
  border-left-color: var(--amber-solid) !important;
}

.service-card .service-dot {
  display: inline-block;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  flex-shrink: 0;
}

.service-dot--green {
  background: var(--green-solid);
}

.service-dot--red {
  background: var(--red-solid);
}

.service-dot--grey {
  background: var(--grey-solid);
}

.service-dot--amber {
  background: var(--amber-solid);
}

/* Demoted cards: light yellow, dot black */
.service-card--demoted {
  border-left-color: #ca8a04 !important;
  background: rgba(250, 204, 21, 0.2) !important;
}

.service-card--demoted:hover {
  background: rgba(250, 204, 21, 0.3) !important;
}

.service-card--demoted .service-dot {
  background: #1e293b !important;
}

.service-card--demoted .text-muted {
  color: #64748b !important;
}

.service-card__message .service-message-full {
  font-size: inherit;
  vertical-align: baseline;
}

/* Status message modal (plain text, e.g. replication errors) */
#messageModal .message-modal-dialog {
  max-width: min(900px, 95vw);
}

#messageModal .message-modal-body {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.9rem;
}

/* Note modal: doubled size (default 500px -> 1000px), markdown content */
#noteModal .note-modal-dialog {
  max-width: 1000px;
}

/* Note modal: markdown-rendered content */
.note-modal-body--md h1,
.note-modal-body--md h2,
.note-modal-body--md h3 {
  margin-top: 0.75rem;
  margin-bottom: 0.5rem;
}
.note-modal-body--md h1:first-child,
.note-modal-body--md h2:first-child,
.note-modal-body--md h3:first-child {
  margin-top: 0;
}
.note-modal-body--md p {
  margin-bottom: 0.5rem;
}
.note-modal-body--md ul,
.note-modal-body--md ol {
  padding-left: 1.25rem;
}
.note-modal-body--md code {
  background: #f1f5f9;
  padding: 0.1em 0.3em;
  border-radius: 0.25rem;
  font-size: 0.9em;
}

/* Transitions page: filter layout polish */
.transitions-filter-help {
  color: #475569 !important;
  line-height: 1.45;
}

.transitions-filter-card .card-body {
  padding: 1rem 1.1rem;
}

@media (min-width: 992px) {
  .transitions-filter-card .card-body {
    padding: 1.15rem 1.25rem;
  }
}

.transitions-filter-card .form-label {
  font-weight: 600;
  color: #334155;
}

.transitions-filter-scope-row .form-text {
  line-height: 1.2;
  min-height: 1.15rem;
}

.transitions-filter-col-foot {
  min-height: 1.15rem;
  pointer-events: none;
}

.transitions-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  margin-right: 0.25rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  color: #0f172a;
  background: #e2e8f0;
}

.transitions-multiselect,
.transitions-transition-select {
  min-height: 7.5rem;
  font-size: 0.82rem;
}

@media (min-width: 1200px) {
  .transitions-multiselect,
  .transitions-transition-select {
    min-height: 8.25rem;
  }
}

#transitions-limit {
  max-width: 100%;
}

@media (min-width: 576px) {
  #transitions-limit {
    max-width: 7rem;
  }
}

.transitions-filter-actions {
  justify-content: flex-start;
}

@media (min-width: 1200px) {
  .transitions-filter-actions {
    justify-content: flex-end;
  }
}

.transitions-filter-actions .btn {
  min-width: 0;
}

.transitions-filter-actions #transitions-clear-filters {
  flex: 1 1 auto;
}

@media (min-width: 1200px) {
  .transitions-filter-actions #transitions-clear-filters {
    flex: 0 0 auto;
    min-width: 7.5rem;
  }
}

.table-responsive > .table > thead {
  position: sticky;
  top: 0;
  z-index: 2;
}

@media (max-width: 991.98px) {
  .transitions-multiselect,
  .transitions-transition-select {
    min-height: 7rem;
  }

  .transitions-filter-actions {
    justify-content: stretch;
  }

  .transitions-filter-actions .btn {
    flex: 1 1 calc(50% - 0.25rem);
  }
}
