// ── Spinner Overlay ───────────────────────────────────────────────────────────

.testenv-spinner-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

// ── Toolbar ───────────────────────────────────────────────────────────────────

.testenv-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.testenv-toolbar-spinner {
  display: inline-flex;
}

// ── Grid Card ─────────────────────────────────────────────────────────────────

.testenv-grid-card {
  overflow-x: auto;
}

.testenv-row--stale td {
  opacity: 0.6;
}

.testenv-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  white-space: nowrap;
}

.testenv-sub {
  color: #777;
  font-size: 11px;
}

.testenv-none {
  color: #aaa;
  font-style: italic;
}

.testenv-empty {
  text-align: center;
  color: #999;
  padding: 24px 0;
}

.testenv-error-msg {
  font-size: 12px;
  color: #b00020;
  max-width: 240px;
  word-break: break-word;
}

// ── Badges ────────────────────────────────────────────────────────────────────

.testenv-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;

  &--sql {
    background: #e3f2fd;
    color: #1565c0;
  }

  &--pg {
    background: #e8f5e9;
    color: #2e7d32;
  }

  &--active {
    background: #e8f5e9;
    color: #2e7d32;
  }

  &--success {
    background: #e8f5e9;
    color: #2e7d32;
  }

  &--fail {
    background: #fce4ec;
    color: #b71c1c;
  }
}

// ── Confirm Bar ───────────────────────────────────────────────────────────────

.testenv-confirm-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff8e1;
  border: 1px solid #ffca28;
  border-radius: 4px;
  padding: 10px 16px;
  margin: 8px 0;
  flex-wrap: wrap;

  &--inline {
    background: #fff3e0;
    border-color: #ff9800;
    margin: 0;
    padding: 8px 12px;
  }
}

.testenv-confirm-icon {
  color: #f57c00;
  flex-shrink: 0;
}

.testenv-confirm-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-inline-start: auto;
}

.testenv-inline-confirm td {
  padding: 0 !important;
  border: none !important;
}

// ── Panel ─────────────────────────────────────────────────────────────────────

.testenv-panel {
  margin-top: 16px;
}

.testenv-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;

  h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
  }
}

.testenv-loading {
  display: flex;
  justify-content: center;
  padding: 32px 0;
}

// ── Snapshot Create Row ───────────────────────────────────────────────────────

.testenv-snapshot-create {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

// ── Clone Warning Banner ──────────────────────────────────────────────────────

.testenv-clone-warning {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #e3f2fd;
  border: 1px solid #90caf9;
  border-radius: 4px;
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 14px;
  color: #1565c0;

  mat-icon {
    flex-shrink: 0;
  }
}

// ── Forms ─────────────────────────────────────────────────────────────────────

.testenv-form {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 540px;
}

.testenv-form-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid #eee;
}

.testenv-input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 14px;
  transition: border-color 0.2s;

  &:focus {
    outline: none;
    border-color: #1976d2;
  }

  &[readonly] {
    background: #f5f5f5;
    cursor: default;
  }
}

.testenv-select {
  @extend .testenv-input;
  cursor: pointer;
}

// ── RTL Support ───────────────────────────────────────────────────────────────

[dir="rtl"] {
  .testenv-toolbar-actions {
    flex-direction: row-reverse;
  }

  .testenv-panel-header {
    flex-direction: row-reverse;
  }

  .testenv-confirm-bar {
    flex-direction: row-reverse;
  }

  .testenv-confirm-actions {
    margin-inline-start: 0;
    margin-inline-end: auto;
  }

  .testenv-actions {
    flex-direction: row-reverse;
  }

  .testenv-snapshot-create {
    flex-direction: row-reverse;
  }

  .testenv-form-actions {
    flex-direction: row-reverse;
  }

  .testenv-clone-warning {
    flex-direction: row-reverse;
  }
}
