/*--------------------------------------------------------------
# RESTORE-SINPAIN components (on top of main.css)
--------------------------------------------------------------*/

/* ---- Header ---- */
.header .top-bar {
  font-size: 13px;
  margin-bottom: 10px;
}

.header .top-bar-logo {
  max-height: 22px;
  margin-right: 12px;
}

.header .logo img {
  max-height: 44px;
}

.header .logo h1 {
  font-size: 26px;
  white-space: nowrap;
}

@media (max-width: 575px) {
  .header .logo h1 {
    font-size: 19px;
  }

  /* Not enough room next to the title: on phones the button is replaced by a menu item (base.html) */
  .header .btn-getstarted {
    display: none;
  }
}

.header .logo .sitename-sep {
  color: var(--highlight-color);
}

.flash-container {
  margin-top: 20px;
}

.text-justify {
  text-align: justify;
}

/* ---- Buttons ---- */
.btn-accent {
  color: var(--contrast-color);
  background-color: var(--accent-color);
  border-color: var(--accent-color);
}

.btn-accent:hover,
.btn-accent:focus,
.btn-accent:disabled {
  color: var(--contrast-color);
  background-color: color-mix(in srgb, var(--accent-color), black 15%);
  border-color: color-mix(in srgb, var(--accent-color), black 15%);
}

.btn-highlight {
  color: var(--contrast-color);
  background-color: var(--highlight-color);
  border-color: var(--highlight-color);
}

.btn-highlight:hover,
.btn-highlight:focus {
  color: var(--contrast-color);
  background-color: color-mix(in srgb, var(--highlight-color), black 15%);
  border-color: color-mix(in srgb, var(--highlight-color), black 15%);
}

.btn-highlight:disabled {
  color: var(--contrast-color);
  background-color: color-mix(in srgb, var(--highlight-color), white 40%);
  border-color: transparent;
}

/* ---- Home ---- */
.home {
  min-height: 60vh;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent-color), white 88%) 0%, var(--highlight-soft-color) 100%);
}

.home h1 {
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

.home .home-img {
  max-width: 140px;
  margin-top: 0;
}

.home p {
  font-size: 24px;
}

.home .btn-get-started.btn-outline {
  color: var(--accent-color);
  background: transparent;
  border: 2px solid var(--accent-color);
}

.home .btn-get-started.btn-highlight {
  background: var(--highlight-color);
}

.about .about-item .about-logo {
  max-width: 320px;
}

.partners .partner-logo img {
  /* A fixed height so SVG logos (no intrinsic size) are not collapsed */
  height: 100px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  padding: 10px;
  opacity: 0.85;
}

.partners .funding-note {
  font-size: 14px;
  color: color-mix(in srgb, var(--default-color), transparent 25%);
}

/* ---- Definitions (home) ---- */
.definition-card {
  border-radius: 10px;
  overflow: hidden;
  background: var(--background-color);
  box-shadow: 0 2px 12px color-mix(in srgb, var(--default-color), transparent 88%);
  display: flex;
  flex-direction: column;
}

.definition-card .definition-image {
  display: block;
  background: #f4f6f9;
  height: 240px; /* same height for every card: the image is cropped, the lightbox shows it whole */
  overflow: hidden;
}

.definition-card .definition-image a,
.definition-card .definition-image img {
  display: block;
  width: 100%;
  height: 100%;
}

.definition-card .definition-image img {
  object-fit: cover;
  object-position: center;
  transition: transform 0.4s ease;
}

.definition-card .definition-image a:hover img {
  transform: scale(1.04);
}

.definition-card .definition-body {
  padding: 20px;
}

.definition-card h4 {
  font-size: 19px;
  font-weight: 700;
  margin: 8px 0 10px 0;
}

.definition-card p {
  font-size: 15px;
  margin-bottom: 0;
}

.modality-badge {
  background: var(--highlight-soft-color);
  color: color-mix(in srgb, var(--highlight-color), black 30%);
  font-weight: 600;
}

/* ---- Filters and tables (Database, Download) ---- */
.filter-bar {
  padding: 20px;
  border-radius: 10px;
  background-color: color-mix(in srgb, var(--accent-color), transparent 94%);
  margin-bottom: 24px;
}

.filter-bar .form-label {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
}

.result-count {
  font-size: 14px;
}

.data-table-wrapper {
  border-radius: 10px;
  box-shadow: 0 0 4px color-mix(in srgb, var(--default-color), transparent 85%);
}

.data-table {
  margin-bottom: 0;
}

.data-table thead th {
  background-color: color-mix(in srgb, var(--accent-color), transparent 90%);
  color: var(--heading-color);
  font-family: var(--heading-font);
  white-space: nowrap;
}

.group-badge {
  font-weight: 600;
}

.group-badge.group-C {
  background: #dff3e8;
  color: #17603c;
}

.group-badge.group-D {
  background: var(--highlight-soft-color);
  color: #8f2c00;
}

.group-badge.group-T {
  background: color-mix(in srgb, var(--accent-color), white 85%);
  color: color-mix(in srgb, var(--accent-color), black 25%);
}

.file-counts .file-count {
  display: inline-block;
  margin-right: 10px;
  font-size: 14px;
  white-space: nowrap;
  color: color-mix(in srgb, var(--default-color), transparent 20%);
}

.download-options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

/* ---- Patient page ---- */
.patient-block {
  margin-top: 40px;
}

.patient-block h3 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid color-mix(in srgb, var(--accent-color), transparent 80%);
}

.patient-block h3 i {
  color: var(--accent-color);
}

.measurements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

.measurement {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--accent-color), transparent 95%);
  font-size: 14px;
}

.measurement .measurement-name {
  overflow-wrap: anywhere;
}

.measurement .measurement-value {
  font-weight: 600;
  white-space: nowrap;
}

.histogram-card,
.video-card,
.analytics-figure {
  margin: 0;
  border-radius: 10px;
  overflow: hidden;
  background: #f7f8fa;
  box-shadow: 0 0 4px color-mix(in srgb, var(--default-color), transparent 85%);
}

.histogram-card img,
.analytics-figure img {
  width: 100%;
  display: block;
}

.video-card video {
  width: 100%;
  display: block;
  background: #000;
}

.histogram-card figcaption,
.video-card figcaption,
.analytics-figure figcaption {
  padding: 8px 12px;
  font-size: 14px;
  text-align: center;
  background: var(--background-color);
}

.file-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.file-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--default-color), transparent 88%);
}

/* ---- Analytics tree ---- */
.analytics-tree details {
  border-left: 3px solid color-mix(in srgb, var(--accent-color), transparent 75%);
  margin: 6px 0;
}

.analytics-tree details.depth-0 {
  border-left-color: var(--accent-color);
  background: color-mix(in srgb, var(--accent-color), transparent 97%);
  border-radius: 0 8px 8px 0;
}

.analytics-tree summary {
  cursor: pointer;
  list-style: none;
  padding: 8px 14px;
  font-family: var(--heading-font);
  font-weight: 600;
  color: var(--heading-color);
}

.analytics-tree summary::-webkit-details-marker {
  display: none;
}

.analytics-tree details.depth-0 > summary {
  font-size: 20px;
}

.analytics-tree .tree-chevron {
  display: inline-block;
  transition: transform 0.2s;
  color: var(--accent-color);
}

.analytics-tree details[open] > summary .tree-chevron {
  transform: rotate(90deg);
}

.analytics-tree .tree-children {
  padding: 0 0 8px 18px;
}

.analytics-tree .tree-images {
  padding: 8px 14px 8px 0;
}

.image-placeholder {
  aspect-ratio: 4 / 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px;
  color: color-mix(in srgb, var(--default-color), transparent 45%);
  background: repeating-linear-gradient(45deg, #f1f3f6, #f1f3f6 10px, #e9edf2 10px, #e9edf2 20px);
  font-size: 12px;
  text-align: center;
  overflow-wrap: anywhere;
}

.image-placeholder i {
  font-size: 28px;
}

.image-placeholder .placeholder-name {
  font-weight: 600;
  color: color-mix(in srgb, var(--default-color), transparent 25%);
}

.image-placeholder .placeholder-path {
  font-family: var(--bs-font-monospace);
  font-size: 11px;
}

/* Fills the fixed-height box of the definition cards */
.definition-image .image-placeholder {
  height: 100%;
  aspect-ratio: auto;
}

.image-placeholder.about-placeholder {
  width: 100%;
  max-width: 500px;
  border-radius: 15px;
}

/* Same height as the partner logos */
.image-placeholder.logo-placeholder {
  aspect-ratio: auto;
  height: 100px;
  width: 100%;
  padding: 6px;
  gap: 2px;
  border-radius: 8px;
  font-size: 11px;
}

.image-placeholder.logo-placeholder i {
  font-size: 20px;
}

/* ---- Model serving ---- */
.ms-card {
  background: var(--background-color);
  border-radius: 10px;
  padding: 30px;
  box-shadow: 0 4px 20px color-mix(in srgb, var(--default-color), transparent 88%);
}

.ms-card h3 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.ms-card .step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent-color);
  color: var(--contrast-color);
  font-size: 15px;
}

.ms-card .hint {
  color: color-mix(in srgb, var(--default-color), transparent 30%);
  font-size: 14px;
}

.feature-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.feature-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid color-mix(in srgb, var(--default-color), transparent 75%);
  border-radius: 999px;
  background: #f8fafc;
  cursor: pointer;
  user-select: none;
  transition: 0.2s;
}

.feature-pill:has(input:checked) {
  border-color: var(--accent-color);
  background: color-mix(in srgb, var(--accent-color), transparent 90%);
}

.feature-pill input {
  accent-color: var(--accent-color);
}

.resolved-model {
  padding: 15px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent-color), transparent 95%);
  border: 1px solid color-mix(in srgb, var(--accent-color), transparent 80%);
}

.resolved-model .value {
  font-weight: 700;
  color: var(--heading-color);
}

.resolved-model .template-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 14px;
  font-weight: 600;
}

.resolved-model .meta {
  font-size: 14px;
  margin-top: 4px;
  color: color-mix(in srgb, var(--default-color), transparent 25%);
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 15px;
}

.stat-box {
  background: color-mix(in srgb, var(--accent-color), transparent 95%);
  padding: 15px;
  border-radius: 8px;
  text-align: center;
}

.stat-box .value {
  font-size: 1.8em;
  font-weight: 700;
  color: var(--accent-color);
}

.stat-box .label {
  margin-top: 6px;
  font-size: 14px;
  color: color-mix(in srgb, var(--default-color), transparent 25%);
}

/* Single patient / bulk tabs */
.ms-mode-tabs {
  gap: 8px;
}

.ms-mode-tabs .nav-link {
  border: 1px solid color-mix(in srgb, var(--accent-color), transparent 70%);
  border-radius: 999px;
  color: var(--accent-color);
  padding: 8px 16px;
}

.ms-mode-tabs .nav-link.active {
  background: var(--accent-color);
  border-color: var(--accent-color);
  color: var(--contrast-color);
}

/* Severity scale (single patient result) */
.severity {
  margin-bottom: 20px;
}

.severity-headline {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 12px;
  margin-bottom: 44px;
}

.severity-headline .bi {
  font-size: 26px;
  align-self: center;
}

.severity-headline .bi.is-control {
  color: #2e8b45;
}

.severity-headline .bi.is-oa {
  color: #c62828;
}

.severity-class {
  font-family: var(--heading-font);
  font-size: 26px;
  font-weight: 800;
  color: var(--heading-color);
}

.severity-prob {
  color: color-mix(in srgb, var(--default-color), transparent 20%);
}

.severity-scale {
  position: relative;
  height: 18px;
}

.severity-bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #2e8b45 0%, #8cc152 25%, #f2c200 50%, #f08a24 75%, #c62828 100%);
}

.severity-threshold {
  position: absolute;
  top: -6px;
  bottom: -6px;
  left: 50%;
  border-left: 2px dashed color-mix(in srgb, var(--default-color), transparent 40%);
}

.severity-marker {
  position: absolute;
  top: 50%;
  left: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--background-color);
  border: 4px solid var(--heading-color);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  transform: translate(-50%, -50%);
  transition: left 0.6s ease;
}

.severity-marker-value {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--heading-color);
  color: var(--contrast-color);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.severity-ends {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  font-size: 13px;
  color: color-mix(in srgb, var(--default-color), transparent 25%);
}

/* Method, guide and model-building sections: tinted background on alternate sections */
.model-serving-method,
.model-serving-built {
  background: color-mix(in srgb, var(--accent-color), transparent 96%);
}

.ms-pipeline {
  display: flex;
  gap: 36px;
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: pipeline;
}

.ms-pipeline-step {
  position: relative;
  flex: 1 1 0;
  padding: 24px 20px;
  border-radius: 10px;
  background: var(--background-color);
  box-shadow: 0 4px 20px color-mix(in srgb, var(--default-color), transparent 90%);
  text-align: center;
  counter-increment: pipeline;
}

.ms-pipeline-step > .bi {
  display: block;
  font-size: 32px;
  color: var(--accent-color);
  margin-bottom: 8px;
}

.ms-pipeline-step h4 {
  font-size: 18px;
  font-weight: 700;
}

.ms-pipeline-step h4::before {
  content: counter(pipeline) ". ";
  color: var(--highlight-color);
}

.ms-pipeline-step p {
  margin: 0;
  font-size: 14px;
}

/* Arrow between two steps */
.ms-pipeline-step:not(:last-child)::after {
  content: "\F138"; /* bi-arrow-right */
  font-family: "bootstrap-icons";
  position: absolute;
  top: 50%;
  right: -29px;
  transform: translateY(-50%);
  font-size: 22px;
  color: var(--highlight-color);
}

@media (max-width: 991px) {
  .ms-pipeline {
    flex-direction: column;
    gap: 34px;
  }

  .ms-pipeline-step:not(:last-child)::after {
    content: "\F128"; /* bi-arrow-down */
    top: auto;
    right: auto;
    bottom: -31px;
    left: 50%;
    transform: translateX(-50%);
  }
}

.ms-method-block {
  height: 100%;
  padding: 26px;
  border-radius: 10px;
  background: var(--background-color);
  box-shadow: 0 4px 20px color-mix(in srgb, var(--default-color), transparent 90%);
}

.ms-method-block h3 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 14px;
}

.ms-method-block h3 .bi {
  color: var(--accent-color);
  margin-right: 6px;
}

.ms-method-block .hint {
  color: color-mix(in srgb, var(--default-color), transparent 30%);
  font-size: 14px;
}

.ms-references {
  font-size: 14px;
}

.ms-references li {
  margin-bottom: 6px;
  scroll-margin-top: 120px;
}

.ms-references li:target {
  background: var(--highlight-soft-color);
  border-radius: 4px;
}

/* Guide */

.guide-step {
  height: 100%;
  padding: 24px;
  border-radius: 10px;
  background: var(--background-color);
  box-shadow: 0 4px 20px color-mix(in srgb, var(--default-color), transparent 90%);
}

.guide-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin-bottom: 12px;
  border-radius: 50%;
  background: var(--highlight-color);
  color: var(--contrast-color);
  font-weight: 700;
}

.guide-step h4 {
  font-size: 18px;
  font-weight: 700;
}

.guide-step p {
  margin: 0;
  font-size: 15px;
}

.ms-guide .accordion-button {
  font-family: var(--heading-font);
  font-weight: 700;
  color: var(--heading-color);
}

.ms-guide .accordion-button:not(.collapsed) {
  background: color-mix(in srgb, var(--accent-color), transparent 92%);
}


/* ---- Footer and errors ---- */
.footer .footer-funding p {
  font-size: 13px;
}

.footer .copyright p {
  font-size: 13px;
  margin: 0;
}

.error-page {
  padding: 80px 0;
}

.error-page .error-code {
  font-size: 72px;
  font-weight: 800;
  color: var(--accent-color);
  margin: 0;
  font-family: var(--heading-font);
}
