/* ── Manage Connection Page ───────────────────────────────────────────────── */

/* ── Details ─────────────────────────────────────────────────────────────── */

.manage-connection-details__inprogress {
  color: var(--color-warning, #b45309);
}

.manage-connection-details__deleting {
  color: var(--danger, #c53030);
  font-weight: 600;
}

/* ── Collages built with this connection (collapsible) ───────────────────── */

.manage-connection-collages__title {
  margin-bottom: 0;
}

.manage-connection-collages__toggle {
  display: flex;
  align-items: center;
  gap: calc(0.8vw / 19.2 * 10);
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.manage-connection-collages__chevron {
  font-size: calc(1.4vh / 10.8 * 10);
  line-height: 1;
}

.manage-connection-collages__list {
  margin: calc(1.2vh / 10.8 * 10) 0 0;
  padding-left: calc(2.4vw / 19.2 * 10);
  display: flex;
  flex-direction: column;
  gap: calc(0.6vh / 10.8 * 10);
  font-size: calc(1.4vh / 10.8 * 10);
}

.manage-connection-collages__link {
  color: var(--color-primary, #6366f1);
  text-decoration: none;
}

.manage-connection-collages__link:hover {
  text-decoration: underline;
}

.manage-connection-collages__hidden {
  margin: calc(0.8vh / 10.8 * 10) 0 0;
  color: var(--text-muted, rgba(0, 0, 0, 0.45));
  font-size: calc(1.3vh / 10.8 * 10);
  font-style: italic;
}

/* ── Section header with action ──────────────────────────────────────────── */

.manage-page__section-header {
  display: flex;
  align-items: center;
  gap: calc(1.5vw / 19.2 * 10);
  margin-bottom: calc(1.2vh / 10.8 * 10);
}

.manage-page__section-header .manage-page__section-title {
  margin-bottom: 0;
}

.manage-page__section-header .btn--icon {
  padding: calc(6vh / 10.8);
  line-height: 0;
}

.manage-page__section-header .btn--icon svg {
  width: calc(24vw / 19.2);
  height: calc(24vw / 19.2);
}

.manage-page__ai-config-select {
  height: 40px;
  padding: 0 12px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dark);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

.manage-page__ai-config-select:focus {
  border-color: var(--accent);
}

.manage-page__update-warning {
  font-size: calc(1.2vh / 10.8 * 10);
  color: var(--color-warning, #b45309);
  align-self: center;
}

/* ── History list ─────────────────────────────────────────────────────────── */

.manage-connection-history-list {
  display: flex;
  flex-direction: column;
  gap: calc(1.2vh / 10.8 * 10);
}

.manage-connection-history-entry {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: calc(0.8vh / 10.8 * 10);
  margin: 0;
  padding: calc(1.4vh / 10.8 * 10) calc(1.6vw / 19.2 * 10);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: var(--radius-md, 6px);
  background: var(--surface-secondary, #fafafa);
}

.manage-connection-history-entry__stop {
  position: absolute;
  top: calc(1.4vh / 10.8 * 10);
  right: calc(1.6vw / 19.2 * 10);
}

.manage-connection-history-entry__actions {
  display: flex;
  gap: calc(0.8vw / 19.2 * 10);
  margin: 0;
}

.manage-connection-history-entry__row {
  display: flex;
  align-items: baseline;
  gap: calc(1.2vw / 19.2 * 10);
  font-size: calc(1.4vh / 10.8 * 10);
}

.manage-connection-history-entry__row dt {
  width: calc(14vw / 19.2 * 10);
  flex-shrink: 0;
  font-weight: 600;
  color: rgba(0, 0, 0, 0.45);
  font-size: calc(1.2vh / 10.8 * 10);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.manage-connection-history-entry__row dd {
  flex: 1;
  min-width: 0;
  margin: 0;
  color: var(--text-primary, #33323d);
  font-variant-numeric: tabular-nums;
}

.manage-connection-history-entry__columns {
  word-break: break-word;
  color: rgba(0, 0, 0, 0.5);
  font-size: calc(1.2vh / 10.8 * 10);
}

/* ── Image Imports section ────────────────────────────────────────────────── */

.conn-imports-list {
  display: flex;
  flex-direction: column;
  gap: calc(1.6vh / 10.8 * 10);
}

.conn-import-entry {
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: var(--radius-md, 6px);
  background: var(--surface-secondary, #fafafa);
  overflow: hidden;
}

.conn-import-entry__header {
  display: flex;
  align-items: center;
  gap: calc(1.2vw / 19.2 * 10);
  padding: calc(1.2vh / 10.8 * 10) calc(1.6vw / 19.2 * 10);
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid rgba(0, 0, 0, 0.07);
  transition: background 0.15s;
}

.conn-import-entry__header:hover {
  background: rgba(0, 0, 0, 0.03);
}

.conn-import-entry__name {
  font-weight: 600;
  font-size: calc(1.5vh / 10.8 * 10);
  color: var(--text-primary, #33323d);
}

.conn-import-entry__meta {
  font-size: calc(1.3vh / 10.8 * 10);
  color: var(--text-muted, rgba(0, 0, 0, 0.45));
}

.conn-import-entry__meta--date {
  margin-left: auto;
}

/* Wide metadata tables (many HE attribute columns) scroll inside the entry
   instead of being clipped by the entry's overflow: hidden. */
.conn-import-entry__table-scroll {
  overflow-x: auto;
}

.conn-import-entry__view-all {
  display: block;
  padding: calc(0.8vh / 10.8 * 10) calc(1.6vw / 19.2 * 10);
  font-size: calc(1.3vh / 10.8 * 10);
  color: var(--color-primary, #6366f1);
  text-decoration: none;
}

.conn-import-entry__view-all:hover {
  text-decoration: underline;
}

/* ── Connection update preview ────────────────────────────────────────────── */

.conn-update-compat-error {
  margin-top: 16px;
  padding: 14px 16px;
  background: #fff5f5;
  border: 1px solid #fed7d7;
  border-radius: 10px;
  color: #c53030;
}

.conn-update-compat-error__heading {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 700;
}

.conn-update-compat-error__text {
  margin: 4px 0;
  font-size: 13px;
  line-height: 1.5;
}

/* ── Prediction Preview Modal ──────────────────────────────────────────────── */

.model-preview-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(calc(140vw / 19.2 * 10), 94vw);
  max-height: 85vh;
  background: #fff;
  border-radius: var(--radius-lg, 8px);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  z-index: 1000;
}

.model-preview-modal__body {
  padding: calc(1.6vh / 10.8 * 10) calc(2.4vw / 19.2 * 10)
    calc(2.4vh / 10.8 * 10);
  overflow-y: auto;
}

.model-preview-modal__job-picker {
  display: flex;
  align-items: center;
  gap: calc(1.2vw / 19.2 * 10);
  margin-bottom: calc(1.4vh / 10.8 * 10);
  font-size: calc(1.4vh / 10.8 * 10);
}

.model-preview-modal__job-picker label {
  font-weight: 600;
  color: rgba(0, 0, 0, 0.55);
}

/* Wide tables (many prediction columns) scroll horizontally inside the modal. */
.model-preview-modal__table-scroll {
  overflow-x: auto;
}

/* ── View Data Modal ──────────────────────────────────────────────────────── */

.view-data-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(calc(110vw / 19.2 * 10), 92vw);
  max-height: 80vh;
  background: #fff;
  border-radius: var(--radius-lg, 8px);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  z-index: 1000;
}

.view-data-modal__body {
  padding: calc(1.6vh / 10.8 * 10) calc(2.4vw / 19.2 * 10)
    calc(2.4vh / 10.8 * 10);
  overflow-y: auto;
}

.view-data-modal__empty {
  color: var(--text-muted, rgba(0, 0, 0, 0.45));
  font-size: calc(1.4vh / 10.8 * 10);
}

.view-data-modal__table {
  width: 100%;
  border-collapse: collapse;
  font-size: calc(1.6vh / 10.8 * 10);
}

.view-data-modal__table th {
  text-align: left;
  font-weight: 600;
  font-size: calc(1.3vh / 10.8 * 10);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(0, 0, 0, 0.45);
  padding: calc(0.8vh / 10.8 * 10) calc(1vw / 19.2 * 10);
  border-bottom: 2px solid rgba(0, 0, 0, 0.08);
  white-space: nowrap;
}

.view-data-modal__table td {
  padding: calc(0.9vh / 10.8 * 10) calc(1vw / 19.2 * 10);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  vertical-align: top;
  color: var(--text-primary, #33323d);
}

.view-data-modal__col-name {
  font-weight: 500;
  white-space: nowrap;
}

.view-data-modal__col-type {
  color: rgba(0, 0, 0, 0.5);
  white-space: nowrap;
  font-family: monospace;
  font-size: calc(1.5vh / 10.8 * 10);
}

.view-data-modal__col-samples {
  color: rgba(0, 0, 0, 0.5);
  font-size: calc(1.5vh / 10.8 * 10);
  word-break: break-word;
}

.view-data-modal__badge {
  display: inline-block;
  padding: calc(0.3vh / 10.8 * 10) calc(0.6vw / 19.2 * 10);
  border-radius: calc(0.3vh / 10.8 * 10);
  font-size: calc(1.3vh / 10.8 * 10);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.view-data-modal__badge--dimension {
  background: rgba(99, 102, 241, 0.1);
  color: #4338ca;
}

.view-data-modal__badge--metric {
  background: rgba(16, 185, 129, 0.1);
  color: #065f46;
}

.view-data-rows-scroll {
  overflow-x: auto;
}

.view-data-rows-scroll .view-data-modal__table th,
.view-data-rows-scroll .view-data-modal__table td {
  white-space: nowrap;
}
