/* ============================================================
   EEMRIO App — styles specific to the analysis tool page
   Reuses design tokens from style.css
   ============================================================ */

/* ---- Page layout ---- */
.eemrio-app {
  padding: 64px 0 96px;
  min-height: calc(100vh - var(--nav-h) - 100px);
}

.eemrio-app__title {
  font-size: clamp(28px, 3.5vw, 44px);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}

.eemrio-app__sub {
  font-size: 16px;
  line-height: 1.65;
  color: var(--text-mid);
  max-width: 56ch;
  margin-bottom: 40px;
}

/* ---- Usage stats ---- */
.eemrio-stats[hidden] {
  display: none;
}

.eemrio-stats {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--text-mid);
  margin-bottom: 32px;
  font-family: var(--mono);
}

.eemrio-stats__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.eemrio-stats__icon {
  color: var(--accent);
  flex-shrink: 0;
}

.eemrio-stats__sep {
  color: var(--border);
  font-size: 18px;
  line-height: 1;
}

/* ---- Status banner ---- */
.eemrio-banner {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 32px;
}

.eemrio-banner--ok {
  background: var(--accent-light);
  color: var(--accent-dark);
}

.eemrio-banner--warn {
  background: #fef3c7;
  color: #92400e;
}

.eemrio-banner--error {
  background: #fee2e2;
  color: #991b1b;
}

/* ---- Steps ---- */
.eemrio-step {
  margin-bottom: 40px;
}

.eemrio-step__heading {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 16px;
}

.eemrio-step__hint {
  font-size: 14px;
  color: var(--text-mid);
  margin-bottom: 16px;
}

.eemrio-step__link {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 600;
}

.eemrio-step__link::before {
  content: "\2913 ";
}

.eemrio-step__link:hover {
  color: var(--accent-dark);
}

/* ---- Upload zone ---- */
.eemrio-upload {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.eemrio-upload:hover,
.eemrio-upload.is-dragover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.eemrio-upload.is-uploading {
  pointer-events: none;
  opacity: 0.7;
}

.eemrio-upload.is-error {
  border-color: #ef4444;
  background: #fee2e2;
}

.eemrio-upload__icon {
  color: var(--text-light);
  margin: 0 auto 16px;
}

.eemrio-upload__text {
  font-size: 15px;
  color: var(--text-mid);
  margin-bottom: 8px;
}

.eemrio-upload__browse {
  background: none;
  border: none;
  color: var(--accent);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.eemrio-upload__hint {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-light);
}

.eemrio-upload__error {
  color: #dc2626;
  font-size: 14px;
  margin-top: 12px;
}

/* ---- Column selection ---- */
.eemrio-columns {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.eemrio-check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.1s;
  user-select: none;
}

.eemrio-check:hover {
  background: #f5f5f4;
}

.eemrio-check--all {
  font-weight: 600;
  background: #f5f5f4;
  border-bottom: 1px solid var(--border);
}

/* Custom checkbox */
.eemrio-check input[type="checkbox"] {
  display: none;
}

.eemrio-check__box {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-radius: 4px;
  flex-shrink: 0;
  position: relative;
  transition: background 0.15s, border-color 0.15s;
}

.eemrio-check input:checked + .eemrio-check__box {
  background: var(--accent);
  border-color: var(--accent);
}

.eemrio-check input:checked + .eemrio-check__box::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 1px;
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.eemrio-columns__list {
  max-height: 320px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.eemrio-columns__list .eemrio-check {
  border-bottom: 1px solid var(--border);
}

.eemrio-columns__list .eemrio-check:nth-last-child(-n+2) {
  border-bottom: none;
}

.eemrio-columns__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
}

.eemrio-columns__count {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-mid);
}

/* ---- Progress ---- */
.eemrio-progress__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 500;
}

.eemrio-progress__track {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 12px;
}

.eemrio-progress__fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.4s ease;
}

.eemrio-progress__status {
  font-size: 14px;
  color: var(--text-mid);
  margin-bottom: 12px;
}

.eemrio-log {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  max-height: 240px;
  overflow-y: auto;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-mid);
}

.eemrio-log__entry {
  display: block;
}

.eemrio-log__entry--ok {
  color: var(--accent);
}

.eemrio-log__entry--error {
  color: #dc2626;
}

/* ---- Results ---- */
.eemrio-results {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
  background: var(--bg-alt);
}

.eemrio-results__summary {
  font-size: 15px;
  color: var(--text-mid);
  line-height: 1.6;
  margin-bottom: 24px;
}

.eemrio-results__actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ---- Secondary button ---- */
.btn--secondary {
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--accent);
}

.btn--secondary:hover {
  background: var(--accent);
  color: #fff;
}

/* ---- Responsive ---- */
@media (max-width: 840px) {
  .eemrio-columns__list {
    grid-template-columns: 1fr;
  }

  .eemrio-columns__list .eemrio-check:last-child {
    border-bottom: none;
  }
}

@media (max-width: 540px) {
  .eemrio-app {
    padding: 40px 0 64px;
  }

  .eemrio-upload {
    padding: 32px 16px;
  }

  .eemrio-columns__footer {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .eemrio-results__actions {
    flex-direction: column;
  }
}
/* ---- Model selector (Step 1) ---- */
.eemrio-models {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 12px;
}

.eemrio-model-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  background: var(--surface, #ffffff);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
  font: inherit;
  color: inherit;
}

.eemrio-model-card:hover {
  border-color: var(--accent, #16a34a);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.eemrio-model-card:active {
  transform: translateY(1px);
}

.eemrio-model-card[disabled],
.eemrio-model-card.is-unavailable {
  cursor: not-allowed;
  opacity: 0.55;
}

.eemrio-model-card__label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 700;
}

.eemrio-model-card__badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-light, #64748b);
  background: rgba(15, 23, 42, 0.06);
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}

.eemrio-model-card__model {
  font-size: 13px;
  color: var(--text-light, #64748b);
  font-weight: 500;
}

.eemrio-model-card__methodology {
  font-size: 12px;
  color: var(--text-mid, #475569);
  margin: 2px 0 4px;
  line-height: 1.4;
}

.eemrio-model-card__methodology strong {
  font-weight: 600;
  color: var(--accent, #059669);
  letter-spacing: 0.02em;
}

.eemrio-model-card__desc {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-mid, #475569);
  margin: 4px 0 8px;
}

.eemrio-model-card__license {
  font-size: 12px;
  color: var(--text-light, #64748b);
  margin-top: auto;
}

.eemrio-model-card__cta {
  align-self: flex-start;
  margin-top: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent, #16a34a);
}

.eemrio-model-card.is-selected {
  border-color: var(--accent, #16a34a);
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.18);
}

/* Step 2 header row with "Change region" link */
.eemrio-step__header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

/* ---- Active-model pill (visible on steps 2+) ---- */
.eemrio-active-model {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 14px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 999px;
  background: var(--surface, #ffffff);
  font-size: 13px;
  line-height: 1.4;
  margin-bottom: 20px;
  max-width: 100%;
}

.eemrio-active-model__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent, #16a34a);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15);
}

.eemrio-active-model__label {
  color: var(--text-light, #64748b);
}

.eemrio-active-model__name {
  font-weight: 700;
  color: var(--text-dark, #0f172a);
}

.eemrio-active-model__meta {
  color: var(--text-light, #64748b);
}

.eemrio-active-model__meta::before {
  content: '\00b7';
  margin: 0 6px;
  color: var(--text-light, #64748b);
}

.eemrio-active-model__change {
  margin-left: 4px;
  font-weight: 600;
  color: var(--accent, #16a34a);
  text-decoration: none;
  border-bottom: 1px dotted currentColor;
}

.eemrio-active-model__change:hover {
  border-bottom-style: solid;
}
